determinePageCompletion();
}
protected IPath queryForLocation(IProject initialSelection, String msg,
String title) {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
getControl().getShell(), initialSelection,
allowNewContainerName(), msg);
if (title != null) {
dialog.setTitle(title);
}
dialog.showClosedProjects(false);
dialog.setValidator(new ISelectionValidator() {
@Override
public String isValid(Object selection) {
if (!(selection instanceof IPath)) {
return "Please select a valid import location";
}
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IContainer container = (IContainer) root.findMember((IPath) selection);
if (container instanceof IProject) {
return "Please select a folder inside the project";
}
if (!ProjectHelper.isContentProject(container.getProject())) {
return "Project " + container.getProject().getName() + " is not a content project";
}
if ( ! ProjectUtil.isInsideContentSyncRoot(container) ) {
return "Please select a folder inside the content sync root folder "
+ ProjectUtil.getSyncDirectory(container.getProject()).getProjectRelativePath();
}
return null;
}
});
dialog.open();
Object[] result = dialog.getResult();
if (result != null && result.length == 1) {
return (IPath) result[0];
}
return null;
}