}
public Object execute(ExecutionEvent event) throws ExecutionException {
TestPageBookView debugView = (TestPageBookView) HandlerUtil.getActivePart(event);
TestViewPage activePage = (TestViewPage) debugView.getCurrentPage();
IResource resource = activePage.getResource();
IPath location = resource.getLocation();
String preFilePath = location.toPortableString();
File preFile = new File(preFilePath);
if (preFile.exists() == false || StringUtils.isEmpty(preFilePath)) {
printErrorDialog("The preprocessing file was not found!");
return null;
}
TypeSystemDescription defaultTypeSystemDescription = null;
List<String> types = new ArrayList<String>();
try {
String tsDesc = RutaProjectUtils.getTypeSystemDescriptorPath(location,
resource.getProject()).toPortableString();
defaultTypeSystemDescription = UIMAFramework.getXMLParser().parseTypeSystemDescription(
new XMLInputSource(new File(tsDesc)));
defaultTypeSystemDescription.resolveImports();
TypeDescription[] systemTypes = defaultTypeSystemDescription.getTypes();
for (TypeDescription typeDescription : systemTypes) {
types.add(typeDescription.getName());
}
Collections.sort(types);
} catch (InvalidXMLException e) {
RutaAddonsPlugin.error(e);
} catch (IOException e) {
RutaAddonsPlugin.error(e);
}
Display display = Display.getDefault();
Shell shell = new Shell(display, SWT.RESIZE | SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setText("Select included types");
SelectTypesDialog dialog = new SelectTypesDialog(shell, types, activePage.getIncludedTypes());
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
List<String> selectedTypes = dialog.getSelectedTypes();
activePage.setIncludedTypes(selectedTypes);
return Status.OK_STATUS;
}