}
if (tsd == null || cas == null) {
return Status.CANCEL_STATUS;
}
TreePath treePath = null;
final IAnnotationCheckTreeNode root = new AnnotationCheckRootNode();
for (File file : listFiles) {
cas.reset();
try {
XmiCasDeserializer.deserialize(new FileInputStream(file), cas, true);
} catch (FileNotFoundException e) {
RutaAddonsPlugin.error(e);
} catch (SAXException e) {
RutaAddonsPlugin.error(e);
} catch (IOException e) {
RutaAddonsPlugin.error(e);
}
CheckDocument element = getCheckDocument(docs, file.getAbsolutePath());
boolean documentAlreadyDone = documentAlreadyDoneforTypes(element, new LinkedList<String>(
typesToCheck.keySet()));
if (!documentAlreadyDone) {
AnnotationCheckTreeNode node = new AnnotationCheckTreeNode(root, element);
root.addChild(node);
AnnotationIndex<AnnotationFS> annotationIndex = cas.getAnnotationIndex();
for (AnnotationFS each : annotationIndex) {
boolean annotationAlreadyDoneforTypes = annotationAlreadyDoneforTypes(each,
typesToCheck.keySet(), element.checkedTypes);
if (!annotationAlreadyDoneforTypes) {
CheckElement ac = new CheckAnnotation(each);
AnnotationCheckTreeNode anode = new AnnotationCheckTreeNode(node, ac);
for (String feature : typesToCheck.get(each.getType().getName())) {
anode.addChild(new FeatureCheckTreeNode(anode, each.getType().getFeatureByBaseName(
feature), each.getFeatureValueAsString(each.getType().getFeatureByBaseName(
feature))));
}
if (treePath == null) {
treePath = new TreePath(new Object[] { root, node, anode });
}
node.addChild(anode);
}
}
if (treePath == null) {
treePath = new TreePath(new Object[] { root, node });
}
}
}
if (root.getChildren().length == 0) {
return Status.OK_STATUS;
}
if (previousSelection != null) {
CheckElement element = previousSelection.getElement();
TreePath oldPath = getPathTo(element, root);
if (oldPath != null) {
treePath = oldPath;
}
}
final TreeSelection firstSelection = new TreeSelection(treePath);