1 | package de.ugoe.cs.eventbench.swt;
|
---|
2 |
|
---|
3 | import org.eclipse.swt.program.Program;
|
---|
4 | import org.eclipse.swt.widgets.Dialog;
|
---|
5 | import org.eclipse.swt.widgets.Display;
|
---|
6 | import org.eclipse.swt.widgets.Shell;
|
---|
7 | import org.eclipse.swt.widgets.Label;
|
---|
8 | import org.eclipse.swt.SWT;
|
---|
9 | import org.eclipse.ui.forms.widgets.FormToolkit;
|
---|
10 | import org.eclipse.ui.forms.widgets.Hyperlink;
|
---|
11 | import org.eclipse.swt.events.MouseAdapter;
|
---|
12 | import org.eclipse.swt.events.MouseEvent;
|
---|
13 |
|
---|
14 | public class AboutDialog extends Dialog {
|
---|
15 |
|
---|
16 | protected Object result;
|
---|
17 | protected Shell shlAboutEventbenchconsole;
|
---|
18 | private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Create the dialog.
|
---|
22 | * @param parent
|
---|
23 | * @param style
|
---|
24 | */
|
---|
25 | public AboutDialog(Shell parent, int style) {
|
---|
26 | super(parent, style);
|
---|
27 | setText("SWT Dialog");
|
---|
28 | }
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Open the dialog.
|
---|
32 | * @return the result
|
---|
33 | */
|
---|
34 | public Object 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 | return result;
|
---|
45 | }
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Create contents of the dialog.
|
---|
49 | */
|
---|
50 | private void createContents() {
|
---|
51 | shlAboutEventbenchconsole = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
|
---|
52 | shlAboutEventbenchconsole.setSize(283, 113);
|
---|
53 | shlAboutEventbenchconsole.setText("About EventBenchConsole");
|
---|
54 |
|
---|
55 | Label lblEventbenchconsole = new Label(shlAboutEventbenchconsole, SWT.CENTER);
|
---|
56 | lblEventbenchconsole.setBounds(10, 10, 267, 15);
|
---|
57 | lblEventbenchconsole.setText("EventBenchConsole");
|
---|
58 |
|
---|
59 | Label lblFurtherInformationAbout = new Label(shlAboutEventbenchconsole, SWT.WRAP);
|
---|
60 | lblFurtherInformationAbout.setBounds(10, 31, 267, 31);
|
---|
61 | lblFurtherInformationAbout.setText("Further information about this software is provided on our homepage.");
|
---|
62 |
|
---|
63 | final Hyperlink hprlnkHttpeventbenchinformatikunigoettingende = formToolkit.createHyperlink(shlAboutEventbenchconsole, "http://eventbench.informatik.uni-goettingen.de", SWT.NONE);
|
---|
64 | hprlnkHttpeventbenchinformatikunigoettingende.addMouseListener(new MouseAdapter() {
|
---|
65 | @Override
|
---|
66 | public void mouseDown(MouseEvent e) {
|
---|
67 | Program.launch(hprlnkHttpeventbenchinformatikunigoettingende.getText());
|
---|
68 | }
|
---|
69 | });
|
---|
70 | hprlnkHttpeventbenchinformatikunigoettingende.setBounds(10, 68, 267, 17);
|
---|
71 | formToolkit.paintBordersFor(hprlnkHttpeventbenchinformatikunigoettingende);
|
---|
72 | hprlnkHttpeventbenchinformatikunigoettingende.setBackground(null);
|
---|
73 |
|
---|
74 | }
|
---|
75 | }
|
---|