private void handleBrowseAction() {
Class[] acceptedClasses = new Class[] { IProject.class, IFolder.class };
ISelectionStatusValidator validator = new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
if ((null == selection) || (selection.length == 0)) {
return new StatusInfo(IStatus.ERROR, "empty selection is not allowed");
}
if (selection.length > 1) {
return new StatusInfo(IStatus.ERROR, "multiple selection is not allowed");
}
if (IFolder.class.isInstance(selection[0]) || IProject.class.isInstance(selection[0])) {
return new StatusInfo();
}
return new StatusInfo(IStatus.ERROR, "not accepted type");
}
};
IWorkspaceRoot workspaceRoot = JDTUtil.getWorkspaceRoot();
IProject[] allProjects = workspaceRoot.getProjects();