]> git.argeo.org Git - lgpl/argeo-commons.git/blob - eclipse/runtime/org.argeo.eclipse.ui.jcr/src/main/java/org/argeo/eclipse/ui/jcr/dialogs/ChooseNameDialog.java
Add a logger
[lgpl/argeo-commons.git] / eclipse / runtime / org.argeo.eclipse.ui.jcr / src / main / java / org / argeo / eclipse / ui / jcr / dialogs / ChooseNameDialog.java
1 package org.argeo.eclipse.ui.jcr.dialogs;
2
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;
14
15 /** Dialog to change the current user password */
16 public class ChooseNameDialog extends TitleAreaDialog {
17 private Text nameT;
18
19 public ChooseNameDialog(Shell parentShell) {
20 super(parentShell);
21 setTitle("Choose name");
22 }
23
24 protected Point getInitialSize() {
25 return new Point(300, 250);
26 }
27
28 protected Control createDialogArea(Composite parent) {
29 Composite dialogarea = (Composite) super.createDialogArea(parent);
30 dialogarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
31 Composite composite = new Composite(dialogarea, SWT.NONE);
32 composite.setLayout(new GridLayout(2, false));
33 composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
34 nameT = createLT(composite, "Name");
35
36 setMessage("Choose name", IMessageProvider.INFORMATION);
37 parent.pack();
38 return composite;
39 }
40
41 /** Creates label and text. */
42 protected Text createLT(Composite parent, String label) {
43 new Label(parent, SWT.NONE).setText(label);
44 Text text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER);
45 text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
46 return text;
47 }
48
49 public String getName() {
50 return nameT.getText();
51 }
52 }