in eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ChooseArchetypeWizardPage.java [120:209]
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
layout.numColumns = 3;
layout.verticalSpacing = 9;
useDefaultWorkspaceLocationButton = new Button(container, SWT.CHECK);
GridData useDefaultWorkspaceLocationButtonData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1);
useDefaultWorkspaceLocationButton.setLayoutData(useDefaultWorkspaceLocationButtonData);
useDefaultWorkspaceLocationButton
.setText("Use default Workspace location");
useDefaultWorkspaceLocationButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean inWorkspace = useDefaultWorkspaceLocationButton.getSelection();
locationLabel.setEnabled(!inWorkspace);
locationCombo.setEnabled(!inWorkspace);
dialogChanged();
}
});
useDefaultWorkspaceLocationButton.setSelection(true);
locationLabel = new Label(container, SWT.NONE);
GridData locationLabelData = new GridData();
locationLabelData.horizontalIndent = 10;
locationLabel.setLayoutData(locationLabelData);
locationLabel.setText("Location:");
locationLabel.setEnabled(false);
locationCombo = new Combo(container, SWT.NONE);
GridData locationComboData = new GridData(SWT.FILL, SWT.CENTER, true, false);
locationCombo.setLayoutData(locationComboData);
locationCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
dialogChanged();
}
});
locationCombo.setEnabled(false);
Button locationBrowseButton = new Button(container, SWT.NONE);
GridData locationBrowseButtonData = new GridData(SWT.FILL, SWT.CENTER, false, false);
locationBrowseButton.setLayoutData(locationBrowseButtonData);
locationBrowseButton.setText("Browse...");
locationBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
dialog.setText("Select Location");
String path = locationCombo.getText();
if(path.length() == 0) {
path = ResourcesPlugin.getWorkspace().getRoot().getLocation().toPortableString();
}
dialog.setFilterPath(path);
String selectedDir = dialog.open();
if(selectedDir != null) {
locationCombo.setText(selectedDir);
useDefaultWorkspaceLocationButton.setSelection(false);
dialogChanged();
}
}
});
Label label = new Label(container, SWT.NULL);
label.setText("&Archetype:");
knownArchetypes = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
knownArchetypes.setLayoutData(gd);
knownArchetypes.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
dialogChanged();
}
});
knownArchetypes.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
getContainer().showPage(getNextPage());
}
});
setPageComplete(false);
setControl(container);
}