source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/swt/CommandHistoryDialog.java @ 194

Last change on this file since 194 was 192, checked in by sherbold, 13 years ago

Work on the SWT GUI prototype. The prototype is still incomplete and should not be used.

  • Property svn:mime-type set to text/plain
File size: 1.9 KB
Line 
1package de.ugoe.cs.eventbench.swt;
2
3import org.eclipse.swt.widgets.Dialog;
4import org.eclipse.swt.widgets.Display;
5import org.eclipse.swt.widgets.Shell;
6import org.eclipse.swt.widgets.List;
7import org.eclipse.swt.SWT;
8import org.eclipse.swt.widgets.Label;
9import org.eclipse.swt.widgets.Button;
10import org.eclipse.swt.layout.GridLayout;
11import org.eclipse.swt.layout.GridData;
12
13public class CommandHistoryDialog extends Dialog {
14
15        protected Object result;
16        protected Shell shell;
17
18        /**
19         * Create the dialog.
20         * @param parent
21         * @param style
22         */
23        public CommandHistoryDialog(Shell parent, int style) {
24                super(parent, style);
25                setText("SWT Dialog");
26        }
27
28        /**
29         * Open the dialog.
30         * @return the result
31         */
32        public Object open() {
33                createContents();
34                shell.open();
35                shell.layout();
36                Display display = getParent().getDisplay();
37                while (!shell.isDisposed()) {
38                        if (!display.readAndDispatch()) {
39                                display.sleep();
40                        }
41                }
42                return result;
43        }
44
45        /**
46         * Create contents of the dialog.
47         */
48        private void createContents() {
49                shell = new Shell(getParent(), SWT.DIALOG_TRIM);
50                shell.setSize(450, 300);
51                shell.setText(getText());
52                shell.setLayout(new GridLayout(3, false));
53               
54                Label lblRecentCommands = new Label(shell, SWT.NONE);
55                lblRecentCommands.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
56                lblRecentCommands.setText("Recent Commands:");
57                new Label(shell, SWT.NONE);
58               
59                List list = new List(shell, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
60                list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
61               
62                Button btnExec = new Button(shell, SWT.NONE);
63                btnExec.setText("Execute");
64               
65                Button btnCopyToClipboard = new Button(shell, SWT.NONE);
66                btnCopyToClipboard.setText("Copy to Clipboard");
67               
68                Button btnCreateBatchfile = new Button(shell, SWT.NONE);
69                btnCreateBatchfile.setText("Create Batchfile");
70
71        }
72}
Note: See TracBrowser for help on using the repository browser.