public Control createControl(Composite composite) { Composite nameComposite = new Composite(composite, SWT.NONE); nameComposite.setFont(composite.getFont()); nameComposite.setLayout(initGridLayout(new GridLayout(2, false), false)); fNameField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null)); fPackageField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(fPackageField.getTextControl(null)); fTemplateField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(fTemplateField.getComboControl(null)); fTemplateField .getComboControl(null) .addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { ProjectType type = getProjectType(); fdescriptionField.setEnabled(type != ProjectType.PROJECT); if (packagingProviderGroup != null) { packagingProviderGroup.updateEnablement(); } } }); fdescriptionField.doFillIntoGrid(nameComposite, 2); LayoutUtil.setHorizontalGrabbing(fdescriptionField.getTextControl(null)); return nameComposite; }
public NameGroup() { // text field for project name fNameField = new StringDialogField(); fNameField.setLabelText(NewWizardMessages.NewJavaProjectWizardPageOne_NameGroup_label_text); fNameField.setDialogFieldListener(this); fPackageField = new StringDialogField(); fPackageField.setLabelText("Top level package name:"); fPackageField.setDialogFieldListener(this); fTemplateField = new ComboDialogField(SWT.READ_ONLY); fTemplateField.setLabelText("Project type:"); List<String> types = new ArrayList<String>(); for (ProjectType type : ProjectType.values()) { types.add(type.getDisplayString()); } fTemplateField.setItems(types.toArray(new String[types.size()])); fTemplateField.selectItem(0); fdescriptionField = new StringDialogField(); fdescriptionField.setLabelText("Description"); fdescriptionField.setDialogFieldListener(this); fdescriptionField.setEnabled(false); }
public ProjectType getProjectType() { return ProjectType.fromDisplayString( fTemplateField.getItems()[fTemplateField.getSelectionIndex()]); }