* Opens the corpus folder chooser dialog and shows the chosen dialog in the corpus folder
* text field.
*/
public void widgetSelected(SelectionEvent e) {
final ElementTreeSelectionDialog folderSelectionDialog = new ElementTreeSelectionDialog(
getShell(), new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI
.getWorkbench().getDecoratorManager().getLabelDecorator()),
new BaseWorkbenchContentProvider());
folderSelectionDialog.addFilter(new CorpusElementFilter());
if (corpusElement != null) {
folderSelectionDialog.setInitialSelection(corpusElement);
}
folderSelectionDialog.setInput(org.apache.uima.caseditor.CasEditorPlugin.getNlpModel());
folderSelectionDialog.setTitle("Choose corpus");
folderSelectionDialog.setMessage("Please choose a corpus.");
folderSelectionDialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
if (selection.length == 1 && selection[0] instanceof CorpusElement) {
return new Status(IStatus.OK, CasEditorPlugin.ID, 0, "", null);
}
return new Status(IStatus.ERROR, CasEditorPlugin.ID, 0, "Please select a corpus!", null);
}
});
folderSelectionDialog.open();
Object[] results = folderSelectionDialog.getResult();
if (results != null) {
// validator makes sure that one CorpusElement is selected
corpusElement = (CorpusElement) results[0];