diff --git a/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditor.java b/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditor.java index d4672293b55..a4784b35e02 100644 --- a/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditor.java +++ b/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditor.java @@ -77,6 +77,12 @@ protected Component makeView() "Unsupported view: [" + getDescription().getView() + "]")); } + @Override + protected ExternalAnnotationEditorFactory getFactory() + { + return (ExternalAnnotationEditorFactory) super.getFactory(); + } + private ExternalEditorPluginDescripion getDescription() { return getFactory().getDescription(); diff --git a/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditorBase.java b/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditorBase.java index bd4946b550d..f062b44e0a3 100644 --- a/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditorBase.java +++ b/inception/inception-external-editor/src/main/java/de/tudarmstadt/ukp/inception/externaleditor/ExternalAnnotationEditorBase.java @@ -59,6 +59,7 @@ import de.tudarmstadt.ukp.inception.diam.model.ajax.DefaultAjaxResponse; import de.tudarmstadt.ukp.inception.editor.AnnotationEditorBase; import de.tudarmstadt.ukp.inception.editor.AnnotationEditorExtensionRegistry; +import de.tudarmstadt.ukp.inception.editor.AnnotationEditorFactory; import de.tudarmstadt.ukp.inception.editor.AnnotationEditorRegistry; import de.tudarmstadt.ukp.inception.editor.action.AnnotationActionHandler; import de.tudarmstadt.ukp.inception.editor.view.DocumentViewExtensionPoint; @@ -129,11 +130,9 @@ protected void onInitialize() LOG.trace("[{}][{}] {}", getMarkupId(), vis.getMarkupId(), getClass().getSimpleName()); } - protected ExternalAnnotationEditorFactory getFactory() + protected AnnotationEditorFactory getFactory() { - var factory = (ExternalAnnotationEditorFactory) annotationEditorRegistry - .getEditorFactory(editorFactoryId); - return factory; + return annotationEditorRegistry.getEditorFactory(editorFactoryId); } protected DiamAjaxBehavior createDiamBehavior() @@ -218,25 +217,6 @@ private String getPropertiesAsJson() } } - private String getUserPreferencesAsJson() - { - var userPreferencesKey = getFactory().getUserPreferencesKey(); - if (userPreferencesKey.isEmpty()) { - return "{}"; - } - - try { - var sessionOwner = userService.getCurrentUser(); - var prefs = preferencesService.loadTraitsForUserAndProject(userPreferencesKey.get(), - sessionOwner, getModelObject().getProject()); - - return JSONUtil.toInterpretableJsonString(prefs); - } - catch (IOException e) { - throw new IllegalStateException(e); - } - } - private CharSequence destroyScript() { return "ExternalEditor.destroy(document.getElementById('" + vis.getMarkupId() + "'));"; @@ -268,8 +248,8 @@ private String assembleScript(CommandQueue aCommandQueue) private String getOrInitializeEditorScript() { return format( - "ExternalEditor.getOrInitialize(document.getElementById('%s'), Diam.factory(), %s, %s)", - vis.getMarkupId(), getPropertiesAsJson(), getUserPreferencesAsJson()); + "ExternalEditor.getOrInitialize(document.getElementById('%s'), Diam.factory(), %s)", + vis.getMarkupId(), getPropertiesAsJson()); } @Override