use of gate.gui.annedit.OwnedAnnotationEditor in project gate-core by GateNLP.
the class AnnotationSetsView method createAnnotationEditor.
/**
* Create the annotation editor (responsible for creating the window
* used to edit individual annotations).
* @throws ResourceInstantiationException if an error occurs
*/
protected gate.gui.annedit.OwnedAnnotationEditor createAnnotationEditor(TextualDocumentView textView, AnnotationSetsView asView) throws ResourceInstantiationException {
// find the last VR that implements the AnnotationEditor interface
List<String> vrTypes = new ArrayList<String>(Gate.getCreoleRegister().getPublicVrTypes());
Collections.reverse(vrTypes);
for (String aVrType : vrTypes) {
ResourceData rData = Gate.getCreoleRegister().get(aVrType);
try {
Class<? extends Resource> resClass = rData.getResourceClass();
if (OwnedAnnotationEditor.class.isAssignableFrom(resClass)) {
OwnedAnnotationEditor newEditor = (OwnedAnnotationEditor) resClass.newInstance();
newEditor.setOwner(this);
newEditor.init();
if (currentOrientation != null) {
newEditor.changeOrientation(currentOrientation);
}
return newEditor;
}
} catch (ClassNotFoundException cnfe) {
// ignore
Err.prln("Invalid CREOLE data:");
cnfe.printStackTrace(Err.getPrintWriter());
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
// if we got this far, we couldn't find an editor
Err.prln("Could not find any annotation editors. Editing annotations disabled.");
return null;
}
Aggregations