source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/AboutDialog.java @ 324

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