[195] | 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 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 | */
|
---|
[287] | 32 | public void open() {
|
---|
[195] | 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 | }
|
---|