[570] | 1 |
|
---|
[526] | 2 | package de.ugoe.cs.quest.ui.swt;
|
---|
| 3 |
|
---|
| 4 | import org.eclipse.swt.program.Program;
|
---|
| 5 | import org.eclipse.swt.widgets.Dialog;
|
---|
| 6 | import org.eclipse.swt.widgets.Display;
|
---|
| 7 | import org.eclipse.swt.widgets.Shell;
|
---|
| 8 | import org.eclipse.swt.widgets.Label;
|
---|
| 9 | import org.eclipse.swt.SWT;
|
---|
| 10 | import org.eclipse.ui.forms.widgets.FormToolkit;
|
---|
| 11 | import org.eclipse.ui.forms.widgets.Hyperlink;
|
---|
| 12 | import org.eclipse.swt.events.MouseAdapter;
|
---|
| 13 | import org.eclipse.swt.events.MouseEvent;
|
---|
| 14 |
|
---|
| 15 | public class AboutDialog extends Dialog {
|
---|
| 16 |
|
---|
[570] | 17 | protected Shell shlAboutEventbenchconsole;
|
---|
| 18 | private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
---|
[526] | 19 |
|
---|
[570] | 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 | }
|
---|
[526] | 30 |
|
---|
[570] | 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 | }
|
---|
[526] | 45 |
|
---|
[570] | 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");
|
---|
[526] | 53 |
|
---|
[570] | 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 | }
|
---|
[526] | 77 | }
|
---|