01: //This is free software; for terms and warranty disclaimer see ./COPYING.
02:
03: package gnu.jemacs.swt;
04:
05: import org.eclipse.swt.SWT;
06: import org.eclipse.swt.widgets.Dialog;
07: import org.eclipse.swt.widgets.Display;
08: import org.eclipse.swt.widgets.Shell;
09:
10: /**
11: * @author Christian Surlykke
12: * 28-07-2004
13: */
14: public class CommandDialog extends Dialog {
15:
16: /**
17: * @param parent
18: */
19: public CommandDialog(Shell parent) {
20: super (parent);
21: }
22:
23: /**
24: * @param parent
25: * @param style
26: */
27: public CommandDialog(Shell parent, int style) {
28: super (parent, style);
29: }
30:
31: public String getCommand() {
32: Shell parent = getParent();
33: Shell shell = new Shell(parent, SWT.DIALOG_TRIM
34: | SWT.APPLICATION_MODAL);
35: shell.setText(getText());
36: // Your code goes here (widget creation, set result, etc).
37: shell.open();
38: Display display = parent.getDisplay();
39: while (!shell.isDisposed()) {
40: if (!display.readAndDispatch())
41: display.sleep();
42: }
43: return "hejsa";
44: }
45: }
|