source: trunk/autoquest-ui-swt/src/main/java/de/ugoe/cs/autoquest/ui/swt/AboutDialog.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
  • Property svn:mime-type set to text/plain
File size: 3.4 KB
Line 
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
15package de.ugoe.cs.autoquest.ui.swt;
16
17import org.eclipse.swt.program.Program;
18import org.eclipse.swt.widgets.Dialog;
19import org.eclipse.swt.widgets.Display;
20import org.eclipse.swt.widgets.Shell;
21import org.eclipse.swt.widgets.Label;
22import org.eclipse.swt.SWT;
23import org.eclipse.ui.forms.widgets.FormToolkit;
24import org.eclipse.ui.forms.widgets.Hyperlink;
25import org.eclipse.swt.events.MouseAdapter;
26import org.eclipse.swt.events.MouseEvent;
27
28public class AboutDialog extends Dialog {
29
30    protected Shell shlAboutEventbenchconsole;
31    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
32
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    }
43
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    }
58
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");
66
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    }
90}
Note: See TracBrowser for help on using the repository browser.