498553: Editors available on marketplace dialog ignores "do not ask me again"
Workaround for platform bug 502514: Don't persist association to system
editors
Bug: 498553
Change-Id: I17b120e117c6094c753008b49abb8c8582af8d3f
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=498553
See also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=502514
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
index dc9dd67..dc192e4 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
@@ -93,7 +93,9 @@
.getMarketplaceClientService();
IMarketplaceClientConfiguration config = marketplaceClientService.newConfiguration();
marketplaceClientService.open(config, new LinkedHashSet<INode>(nodes));
- } else if (dialog.isAssociateToExtension()) {
+ } else if (dialog.isAssociateToExtension() &&
+ // FIXME bug 498553: workaround for platform bug 502514 - persisting system editor association leads to NPE
+ res.isInternal() && !AskMarketPlaceForFileSupportStrategy.isSystem(res.getId())) {
List<String> extensions = new ArrayList<String>(1);
extensions.add(fileExtension);
// need internal API:
@@ -112,6 +114,7 @@
newMapping.setDefaultEditor(res);
mappings[mappings.length - 1] = newMapping;
((EditorRegistry) editorRegistry).setFileEditorMappings(mappings);
+
((EditorRegistry) editorRegistry).saveAssociations();
}
return Status.OK_STATUS;
@@ -141,4 +144,8 @@
return res;
}
+ private static boolean isSystem(String id) {
+ return IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID.equals(id)
+ || IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID.equals(id);
+ }
}