in eclipse/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/propertyPages/SlingProjectPropertyPage.java [84:144]
protected Control createContents(Composite parent) {
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(3, false));
new Label(c, SWT.NONE).setText("Content sync root directory");
folderText = new Text(c, SWT.BORDER);
folderText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
folderText.setText(ProjectUtil.getSyncDirectoryValue(getProject()).toString());
folderText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateApplyButton();
}
});
Button browseButton = new Button(c, SWT.PUSH);
browseButton.setText("Browse...");
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final IProject project = getProject();
ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), project, false, null);
dialog.showClosedProjects(false);
dialog.setValidator(new ISelectionValidator() {
@Override
public String isValid(Object selection) {
if (!(selection instanceof IPath)) {
return null;
}
IPath path = (IPath) selection;
if (project.getFullPath().isPrefixOf(path)) {
return null;
}
return "The folder must be contained in the " + project.getName() + " project";
}
});
dialog.open();
Object[] results = dialog.getResult();
if (results == null) {
return;
}
IPath selectedPath = (IPath) results[0];
folderText.setText(selectedPath.removeFirstSegments(1).toString());
}
});
Dialog.applyDialogFont(c);
return c;
}