[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.ui.swt;
|
---|
[526] | 16 |
|
---|
| 17 | import org.eclipse.swt.program.Program;
|
---|
| 18 | import org.eclipse.swt.widgets.Dialog;
|
---|
| 19 | import org.eclipse.swt.widgets.Display;
|
---|
| 20 | import org.eclipse.swt.widgets.Shell;
|
---|
| 21 | import org.eclipse.swt.widgets.Label;
|
---|
| 22 | import org.eclipse.swt.SWT;
|
---|
| 23 | import org.eclipse.ui.forms.widgets.FormToolkit;
|
---|
| 24 | import org.eclipse.ui.forms.widgets.Hyperlink;
|
---|
| 25 | import org.eclipse.swt.events.MouseAdapter;
|
---|
| 26 | import org.eclipse.swt.events.MouseEvent;
|
---|
| 27 |
|
---|
| 28 | public class AboutDialog extends Dialog {
|
---|
| 29 |
|
---|
[570] | 30 | protected Shell shlAboutEventbenchconsole;
|
---|
| 31 | private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
|
---|
[526] | 32 |
|
---|
[570] | 33 | /**
|
---|
| 34 | * Create the dialog.
|
---|
| 35 | *
|
---|
| 36 | * @param parent
|
---|
| 37 | * @param style
|
---|
| 38 | */
|
---|
| 39 | public AboutDialog(Shell parent, int style) {
|
---|
| 40 | super(parent, style);
|
---|
| 41 | setText("SWT Dialog");
|
---|
| 42 | }
|
---|
[526] | 43 |
|
---|
[570] | 44 | /**
|
---|
| 45 | * Open the dialog.
|
---|
| 46 | */
|
---|
| 47 | public void open() {
|
---|
| 48 | createContents();
|
---|
| 49 | shlAboutEventbenchconsole.open();
|
---|
| 50 | shlAboutEventbenchconsole.layout();
|
---|
| 51 | Display display = getParent().getDisplay();
|
---|
| 52 | while (!shlAboutEventbenchconsole.isDisposed()) {
|
---|
| 53 | if (!display.readAndDispatch()) {
|
---|
| 54 | display.sleep();
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
[526] | 58 |
|
---|
[570] | 59 | /**
|
---|
| 60 | * Create contents of the dialog.
|
---|
| 61 | */
|
---|
| 62 | private void createContents() {
|
---|
| 63 | shlAboutEventbenchconsole = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
|
---|
| 64 | shlAboutEventbenchconsole.setSize(283, 113);
|
---|
| 65 | shlAboutEventbenchconsole.setText("About EventBenchConsole");
|
---|
[526] | 66 |
|
---|
[570] | 67 | Label lblEventbenchconsole = new Label(shlAboutEventbenchconsole, SWT.CENTER);
|
---|
| 68 | lblEventbenchconsole.setBounds(10, 10, 267, 15);
|
---|
| 69 | lblEventbenchconsole.setText("EventBenchConsole");
|
---|
| 70 |
|
---|
| 71 | Label lblFurtherInformationAbout = new Label(shlAboutEventbenchconsole, SWT.WRAP);
|
---|
| 72 | lblFurtherInformationAbout.setBounds(10, 31, 267, 31);
|
---|
| 73 | lblFurtherInformationAbout
|
---|
| 74 | .setText("Further information about this software is provided on our homepage.");
|
---|
| 75 |
|
---|
| 76 | final Hyperlink hprlnkHttpeventbenchinformatikunigoettingende =
|
---|
| 77 | formToolkit.createHyperlink(shlAboutEventbenchconsole,
|
---|
| 78 | "http://eventbench.informatik.uni-goettingen.de", SWT.NONE);
|
---|
| 79 | hprlnkHttpeventbenchinformatikunigoettingende.addMouseListener(new MouseAdapter() {
|
---|
| 80 | @Override
|
---|
| 81 | public void mouseDown(MouseEvent e) {
|
---|
| 82 | Program.launch(hprlnkHttpeventbenchinformatikunigoettingende.getText());
|
---|
| 83 | }
|
---|
| 84 | });
|
---|
| 85 | hprlnkHttpeventbenchinformatikunigoettingende.setBounds(10, 68, 267, 17);
|
---|
| 86 | formToolkit.paintBordersFor(hprlnkHttpeventbenchinformatikunigoettingende);
|
---|
| 87 | hprlnkHttpeventbenchinformatikunigoettingende.setBackground(null);
|
---|
| 88 |
|
---|
| 89 | }
|
---|
[526] | 90 | }
|
---|