Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2017-07-26 12:39:00 +0000
committerMickael Istria2017-07-27 09:06:48 +0000
commitd2fed93bf40982d0a3648ebd04f5f07756d90620 (patch)
tree2072cecade6d5832eaf7909ea3a73fc76fda4e59
parent46d6b07f207bd78a88235cb93a0a97e1c8513427 (diff)
downloadeclipse.platform.ui-d2fed93bf40982d0a3648ebd04f5f07756d90620.tar.gz
eclipse.platform.ui-d2fed93bf40982d0a3648ebd04f5f07756d90620.tar.xz
eclipse.platform.ui-d2fed93bf40982d0a3648ebd04f5f07756d90620.zip
Bug 520205 - Associating content type with external editorI20170727-0610
The external editors are not pre-existing in the editor registry and must be added to the registry when loading or the association. Change-Id: Ia93b06cf3fbdf1cc39592ebc02ac8832985f3dce Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
index 9cba663725d..4187b87d316 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
@@ -747,6 +747,11 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
for (IMemento childMemento : memento.getChildren(IWorkbenchConstants.TAG_INFO)) {
List<IEditorDescriptor> editors = getEditorDescriptors(childMemento.getChildren(IWorkbenchConstants.TAG_EDITOR), editorTable);
+ editors.forEach(editor -> {
+ if (!mapIDtoEditor.containsKey(editor.getId())) {
+ mapIDtoEditor.put(editor.getId(), editor);
+ }
+ });
String contentTypeId = childMemento.getString(IWorkbenchConstants.TAG_CONTENT_TYPE);
if (contentTypeId != null) {
IContentType contentType = Platform.getContentTypeManager().getContentType(contentTypeId);
@@ -1629,6 +1634,9 @@ public class EditorRegistry extends EventManager implements IEditorRegistry, IEx
if (!this.contentTypeToEditorMappingsFromUser.containsKey(contentType)) {
this.contentTypeToEditorMappingsFromUser.put(contentType, new LinkedHashSet<>());
}
+ if (!mapIDtoEditor.containsKey(selectedEditor.getId())) {
+ mapIDtoEditor.put(selectedEditor.getId(), selectedEditor);
+ }
this.contentTypeToEditorMappingsFromUser.get(contentType).add(selectedEditor);
saveAssociations();
}

Back to the top