Author: scabanovich
Date: 2011-10-06 15:13:20 -0400 (Thu, 06 Oct 2011)
New Revision: 35430
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
Log:
JBIDE-9852
https://issues.jboss.org/browse/JBIDE-9852
Method getExtensionByRuntime(String) added
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-10-06
18:28:58 UTC (rev 35429)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/CDIExtensionManager.java 2011-10-06
19:13:20 UTC (rev 35430)
@@ -40,6 +40,11 @@
* Mapping of extension ids (class names) to instances.
*/
Map<String, ICDIExtension> instances = new HashMap<String,
ICDIExtension>();
+
+ /**
+ * Mapping of runtime extension class names to instances.
+ */
+ Map<String, ICDIExtension> instancesByRuntime = new HashMap<String,
ICDIExtension>();
/**
* Mapping of feature ids to extension instances.
@@ -95,6 +100,7 @@
ICDIExtension ext = factory.createExtensionInstance(cls);
if(ext == null) continue;
instances.put(cls, ext);
+ instancesByRuntime.put(runtime, ext);
for (Class<?> feature: CDIExtensionFactory.getInstance().getFeatures(ext)) {
Set<ICDIExtension> es = featureToExtensions.get(feature);
if(es == null) {
@@ -110,6 +116,7 @@
private void deleteRuntime(String runtime) {
allRuntimes.remove(runtime);
+ instancesByRuntime.remove(runtime);
Set<String> clss =
CDIExtensionFactory.getInstance().getExtensionClassesByRuntime(runtime);
if(clss != null) {
for (String cls: clss) {
@@ -137,6 +144,10 @@
return featureToExtensions.containsKey(feature) ? featureToExtensions.get(feature) :
EMPTY;
}
+ public ICDIExtension getExtensionByRuntime(String runtime) {
+ return instancesByRuntime.get(runtime);
+ }
+
public Set<IProcessAnnotatedMemberFeature> getProcessAnnotatedMemberFeatures() {
return getFeatures(IProcessAnnotatedMemberFeature.class);
}