]>
git.argeo.org Git - gpl/argeo-slc.git/blob - parts/ChooseNameDialog.java
1 package org
.argeo
.cms
.ui
.workbench
.internal
.jcr
.parts
;
3 import org
.eclipse
.jface
.dialogs
.IMessageProvider
;
4 import org
.eclipse
.jface
.dialogs
.TitleAreaDialog
;
5 import org
.eclipse
.swt
.SWT
;
6 import org
.eclipse
.swt
.graphics
.Point
;
7 import org
.eclipse
.swt
.layout
.GridData
;
8 import org
.eclipse
.swt
.layout
.GridLayout
;
9 import org
.eclipse
.swt
.widgets
.Composite
;
10 import org
.eclipse
.swt
.widgets
.Control
;
11 import org
.eclipse
.swt
.widgets
.Label
;
12 import org
.eclipse
.swt
.widgets
.Shell
;
13 import org
.eclipse
.swt
.widgets
.Text
;
15 /** Ask end user for a name */
16 public class ChooseNameDialog
extends TitleAreaDialog
{
17 private static final long serialVersionUID
= 280139710002698692L;
20 public ChooseNameDialog(Shell parentShell
) {
22 setTitle("Choose name");
25 protected Point
getInitialSize() {
26 return new Point(300, 250);
29 protected Control
createDialogArea(Composite parent
) {
30 Composite dialogarea
= (Composite
) super.createDialogArea(parent
);
31 dialogarea
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, true));
32 Composite composite
= new Composite(dialogarea
, SWT
.NONE
);
33 composite
.setLayout(new GridLayout(2, false));
34 composite
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false));
35 nameTxt
= createLT(composite
, "Name");
36 setMessage("Choose name", IMessageProvider
.INFORMATION
);
42 /** Creates label and text. */
43 protected Text
createLT(Composite parent
, String label
) {
44 new Label(parent
, SWT
.NONE
).setText(label
);
45 Text text
= new Text(parent
, SWT
.SINGLE
| SWT
.LEAD
| SWT
.BORDER
);
46 text
.setLayoutData(new GridData(SWT
.FILL
, SWT
.FILL
, true, false));
50 public String
getName() {
51 return nameTxt
.getText();