setControl(container);
checkPage();
}
protected String handleBrowse(String title) {
ElementTreeSelectionDialog etsd = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
etsd.setInput(refactoring.getProject().getWorkspace());
etsd.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element == null) {
return false;
}
if (element instanceof IFile) {
IFile file = ((IFile)element);
String extension = file.getFileExtension();
return (extension != null && extension.equals("xml")); //$NON-NLS-1$
}
if (element instanceof IProject) {
return ((IProject)element).equals(refactoring.getProject());
}
return true;
}
});
etsd.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
return (selection.length == 1 && selection[0] instanceof IFile) ? SELECTION_OK_STATUS : SELECTION_NOT_OK_STATUS;
}
});
etsd.open();
Object[] results = etsd.getResult();
if (results.length == 1) {
if (results[0] instanceof IFile) {
return ((IFile)results[0]).getProjectRelativePath().toPortableString();
}
}