source: trunk/quest-ui-swt/src/main/java/de/ugoe/cs/quest/ui/swt/AboutDialog.java @ 570

Last change on this file since 570 was 570, checked in by sherbold, 12 years ago
  • adapted to quest coding style
  • Property svn:mime-type set to text/plain
File size: 2.8 KB
Line 
1
2package de.ugoe.cs.quest.ui.swt;
3
4import org.eclipse.swt.program.Program;
5import org.eclipse.swt.widgets.Dialog;
6import org.eclipse.swt.widgets.Display;
7import org.eclipse.swt.widgets.Shell;
8import org.eclipse.swt.widgets.Label;
9import org.eclipse.swt.SWT;
10import org.eclipse.ui.forms.widgets.FormToolkit;
11import org.eclipse.ui.forms.widgets.Hyperlink;
12import org.eclipse.swt.events.MouseAdapter;
13import org.eclipse.swt.events.MouseEvent;
14
15public class AboutDialog extends Dialog {
16
17    protected Shell shlAboutEventbenchconsole;
18    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
19
20    /**
21     * Create the dialog.
22     *
23     * @param parent
24     * @param style
25     */
26    public AboutDialog(Shell parent, int style) {
27        super(parent, style);
28        setText("SWT Dialog");
29    }
30
31    /**
32     * Open the dialog.
33     */
34    public void open() {
35        createContents();
36        shlAboutEventbenchconsole.open();
37        shlAboutEventbenchconsole.layout();
38        Display display = getParent().getDisplay();
39        while (!shlAboutEventbenchconsole.isDisposed()) {
40            if (!display.readAndDispatch()) {
41                display.sleep();
42            }
43        }
44    }
45
46    /**
47     * Create contents of the dialog.
48     */
49    private void createContents() {
50        shlAboutEventbenchconsole = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
51        shlAboutEventbenchconsole.setSize(283, 113);
52        shlAboutEventbenchconsole.setText("About EventBenchConsole");
53
54        Label lblEventbenchconsole = new Label(shlAboutEventbenchconsole, SWT.CENTER);
55        lblEventbenchconsole.setBounds(10, 10, 267, 15);
56        lblEventbenchconsole.setText("EventBenchConsole");
57
58        Label lblFurtherInformationAbout = new Label(shlAboutEventbenchconsole, SWT.WRAP);
59        lblFurtherInformationAbout.setBounds(10, 31, 267, 31);
60        lblFurtherInformationAbout
61            .setText("Further information about this software is provided on our homepage.");
62
63        final Hyperlink hprlnkHttpeventbenchinformatikunigoettingende =
64            formToolkit.createHyperlink(shlAboutEventbenchconsole,
65                                        "http://eventbench.informatik.uni-goettingen.de", SWT.NONE);
66        hprlnkHttpeventbenchinformatikunigoettingende.addMouseListener(new MouseAdapter() {
67            @Override
68            public void mouseDown(MouseEvent e) {
69                Program.launch(hprlnkHttpeventbenchinformatikunigoettingende.getText());
70            }
71        });
72        hprlnkHttpeventbenchinformatikunigoettingende.setBounds(10, 68, 267, 17);
73        formToolkit.paintBordersFor(hprlnkHttpeventbenchinformatikunigoettingende);
74        hprlnkHttpeventbenchinformatikunigoettingende.setBackground(null);
75
76    }
77}
Note: See TracBrowser for help on using the repository browser.