return chooseFile(false);
}
private String chooseFile(boolean multiple) {
//IProject project = MuClipsePlugin.getProject(currentProject);
final ElementTreeSelectionDialog dialog =
new ElementTreeSelectionDialog(getShell(),
new FileLabelProvider(),
new FileTreeContentProvider(false));
dialog.setAllowMultiple(multiple);
dialog.setTitle("Choose file");
dialog.setSorter(new FileViewerSorter());
//dialog.setInput(project);
if(multiple) {
dialog.setMessage("Select resources. Press CTRL or SHIFT" +
" to select multiple resources.");
dialog.setValidator(new TypedElementSelectionValidator(
new Class[]{IFile.class, IFolder.class}, true));
if(dialog.open() == Window.OK) {
Object[] results = dialog.getResult();
StringBuffer ret = new StringBuffer();
if (results != null) {
for (int i = 0; i < results.length; i++) {
IResource rc = (IResource)results[i];
ret.append(rc.getFullPath().removeFirstSegments(1));
ret.append(";");
}
return ret.toString();
}
}
} else {
dialog.setMessage("Select a .class file");
dialog.setValidator(new TypedElementSelectionValidator(
new Class[]{IFile.class}, false));
if(dialog.open() == Window.OK) {
IResource rc = (IResource)dialog.getFirstResult();
if (rc != null)
return rc.getFullPath().removeFirstSegments(1).toString();
}
}
return null;