]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.project/src/org/simantics/project/internal/ProjectFeatureRegistry.java
Project feature dependency injection is broken
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / internal / ProjectFeatureRegistry.java
index e861bc09dc47e81f3b1857889c835db091837048..b07304ed1ce3b8d39af3c5c8d06b1dd5cc6ccf3e 100644 (file)
@@ -94,7 +94,7 @@ public class ProjectFeatureRegistry implements IProjectFeatureRegistry, IExtensi
                 String description = StringUtils.safeString(el.getAttribute("description"));
                 boolean published = "true".equalsIgnoreCase(el.getAttribute("published"));
                 Collection<ProjectFeatureReference> requires = readProjectFeatureReferenceCollection(el, "requires");
-                Collection<InjectedDependency> injections = readInjectedDependencies(el);
+                Collection<InjectedDependency> injections = readInjectedDependencies(el, id);
                 Collection<GroupReference> installGroups = readGroupReferenceCollection(el, "installGroup");
 
                 ProjectFeatureExtension ext = new ProjectFeatureExtension(el, id, label, description, published, requires, injections, installGroups);
@@ -111,19 +111,17 @@ public class ProjectFeatureRegistry implements IProjectFeatureRegistry, IExtensi
         this.extensions = newExtensions.toArray(new IProjectFeatureExtension[newExtensions.size()]);
     }
 
-    private Collection<InjectedDependency> readInjectedDependencies(IConfigurationElement element) {
+    private Collection<InjectedDependency> readInjectedDependencies(IConfigurationElement element, String id) {
         Collection<InjectedDependency> result = new ArrayList<InjectedDependency>();
 
         for (IConfigurationElement child : element.getChildren(INJECT_DEPENDENCY)) {
-            String id = StringUtils.safeString(child.getAttribute("id"));
-            if (id.isEmpty())
-                // Invalid extension
-                return null;
-
             String targetId = StringUtils.safeString(child.getAttribute("targetId"));
             if (targetId.isEmpty())
                 // Invalid extension
                 return null;
+            
+            result.add(new InjectedDependency(new ProjectFeatureReference(id, false), new ProjectFeatureReference(targetId, false)));
+            
         }
 
         return result;