Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2021-02-02 09:51:45 +0000
committerEike Stepper2021-02-02 09:51:45 +0000
commit8044d2059ecdb93c1ad154631d06cea2a9c56969 (patch)
treed2583ca851ed932ca039fc5f9c30b527536abb21
parentbe629151bfd77e357d9308cc398fe47e9e8bf02d (diff)
downloadcdo-8044d2059ecdb93c1ad154631d06cea2a9c56969.tar.gz
cdo-8044d2059ecdb93c1ad154631d06cea2a9c56969.tar.xz
cdo-8044d2059ecdb93c1ad154631d06cea2a9c56969.zip
[570833] Provide a facility for clients to contribute global URI handlers
https://bugs.eclipse.org/bugs/show_bug.cgi?id=570833
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/util/URIHandlerRegistryImpl.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/util/URIHandlerRegistryImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/util/URIHandlerRegistryImpl.java
index 7f102664d3..56585c6451 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/util/URIHandlerRegistryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/util/URIHandlerRegistryImpl.java
@@ -69,16 +69,33 @@ public final class URIHandlerRegistryImpl implements URIHandlerRegistry, URIHand
@Override
protected void onAdded(IContainer<Entry<IFactoryKey, IFactory>> container, Map.Entry<IFactoryKey, IFactory> element)
{
- String scheme = element.getKey().getType();
- URIHandler handler = (URIHandler)IPluginContainer.INSTANCE.getElement(URIHandlerFactory.PRODUCT_GROUP, scheme, null);
- addURIHandler(scheme, handler);
+ String scheme = getScheme(element);
+ if (scheme != null)
+ {
+ URIHandler handler = (URIHandler)IPluginContainer.INSTANCE.getElement(URIHandlerFactory.PRODUCT_GROUP, scheme, null);
+ addURIHandler(scheme, handler);
+ }
}
@Override
protected void onRemoved(IContainer<Entry<IFactoryKey, IFactory>> container, Map.Entry<IFactoryKey, IFactory> element)
{
- String scheme = element.getKey().getType();
- removeURIHandler(scheme);
+ String scheme = getScheme(element);
+ if (scheme != null)
+ {
+ removeURIHandler(scheme);
+ }
+ }
+
+ private String getScheme(Map.Entry<IFactoryKey, IFactory> element)
+ {
+ IFactoryKey key = element.getKey();
+ if (URIHandlerFactory.PRODUCT_GROUP.equals(key.getProductGroup()))
+ {
+ return key.getType();
+ }
+
+ return null;
}
});
}

Back to the top