]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.team.ui/src/org/simantics/team/ui/StageInitDialog.java
e59875227369d1f71c907c1c83915fa7fb2ba33a
[simantics/platform.git] / bundles / org.simantics.team.ui / src / org / simantics / team / ui / StageInitDialog.java
1 package org.simantics.team.ui;\r
2 \r
3 import org.eclipse.jface.dialogs.Dialog;\r
4 import org.eclipse.jface.layout.GridDataFactory;\r
5 import org.eclipse.jface.layout.GridLayoutFactory;\r
6 import org.eclipse.swt.SWT;\r
7 import org.eclipse.swt.widgets.Composite;\r
8 import org.eclipse.swt.widgets.Control;\r
9 import org.eclipse.swt.widgets.Label;\r
10 import org.eclipse.swt.widgets.Shell;\r
11 import org.eclipse.swt.widgets.Text;\r
12 \r
13 /**\r
14  * Dialog for chart properties:\r
15  * \r
16  * Comment: \r
17  */\r
18 public class StageInitDialog extends Dialog {\r
19     public static class Data {\r
20         public String comment;\r
21     }\r
22     Label lName;\r
23     Text tName;\r
24     Data data;\r
25     public StageInitDialog(Shell parentShell, Data data) {\r
26         super(parentShell);\r
27         this.data = data;\r
28         setShellStyle(SWT.RESIZE | SWT.TITLE | SWT.CLOSE | SWT.BORDER);\r
29     }\r
30     @Override\r
31     protected Control createDialogArea(Composite parent) {\r
32         Composite c = (Composite) super.createDialogArea(parent);\r
33         GridLayoutFactory.fillDefaults().margins(8, 8).numColumns(9).applyTo(c);\r
34         GridDataFactory gd1 = GridDataFactory.fillDefaults().span(1, 1);\r
35         GridDataFactory gd2 = GridDataFactory.fillDefaults().grab(true, false).span(8, 1);\r
36         // Comment:\r
37         lName = new Label(c, 0);\r
38         lName.setText("Comment:");\r
39         gd1.applyTo(lName);\r
40         tName = new Text(c, SWT.BORDER);\r
41         tName.setEnabled(true);\r
42         if (null != data.comment)\r
43             tName.setText(data.comment);\r
44         gd2.applyTo(tName);\r
45         return c;\r
46     }\r
47     @Override\r
48     protected void okPressed() {\r
49         data.comment = tName.getText();\r
50         super.okPressed();\r
51     }\r
52     @Override\r
53     protected void configureShell(Shell newShell) {\r
54         super.configureShell(newShell);\r
55         newShell.setText("Comment");\r
56     }\r
57 }\r