Browse Source

Refactoring of generator and feature library extension points:
* generator extensions can be mapped to multiple feature libraries now.
* adpated c and java code generators.

markus.muehlbrandt@gmail.com 12 years ago
parent
commit
7effdf60a1

+ 7 - 1
plugins/org.yakindu.sct.generator.c/plugin.xml

@@ -11,13 +11,19 @@
             description="YAKINDU SCT C Code Generator"
             id="yakindu::c"
             name="YAKINDU SCT C Code Generator">
+         <FeatureLibrary
+               library_id="org.yakindu.generator.core.features">
+         </FeatureLibrary>
+         <FeatureLibrary
+               library_id="org.yakindu.sct.generator.feature.c">
+         </FeatureLibrary>
       </SCTGenerator>
    </extension>
    <extension
          point="org.yakindu.sct.generator.core.featuretypes">
       <FeatureLibrary
             defaultProvider="org.yakindu.sct.generator.c.features.CDefaultFeatureValueProvider"
-            generatorId="yakindu::c"
+            library_id="org.yakindu.sct.generator.feature.c"
             uri="platform:/plugin/org.yakindu.sct.generator.c/library/FeatureTypeLibrary.xmi">
       </FeatureLibrary>
    </extension>

+ 7 - 4
plugins/org.yakindu.sct.generator.core/plugin.xml

@@ -7,19 +7,22 @@
  <extension
          point="org.yakindu.sct.generator.core.featuretypes">
       <FeatureLibrary
+            library_id="org.yakindu.generator.core.features"
             defaultProvider="org.yakindu.sct.generator.core.features.impl.CoreLibraryDefaultFeatureValueProvider"
             generatorId="ALL"
             uri="platform:/plugin/org.yakindu.sct.generator.core/library/CoreFeatureTypeLibrary.xmi">
       </FeatureLibrary>
       <FeatureLibrary
+            library_id="org.yakindu.generator.core.features.xpand"
             defaultProvider="org.yakindu.sct.generator.core.features.impl.XpandLibraryDefaultFeatureValueProvider"
             generatorId="yakindu::xpand"
             uri="platform:/plugin/org.yakindu.sct.generator.core/library/XpandFeatureTypeLibrary.xmi">
       </FeatureLibrary>
-      <FeatureLibrary 
-   			defaultProvider="org.yakindu.sct.generator.core.features.impl.GenericJavaLibraryDefaultValueProvider"
-      		generatorId="yakindu::generic" 
-          	uri="platform:/plugin/org.yakindu.sct.generator.core/library/GenericJavaFeatureTypeLibrary.xmi">
+      <FeatureLibrary
+            library_id="org.yakindu.generator.core.features.generic"
+            defaultProvider="org.yakindu.sct.generator.core.features.impl.GenericJavaLibraryDefaultValueProvider"
+            generatorId="yakindu::generic"
+            uri="platform:/plugin/org.yakindu.sct.generator.core/library/GenericJavaFeatureTypeLibrary.xmi">
    	  </FeatureLibrary>
    </extension>
  <extension

+ 2 - 2
plugins/org.yakindu.sct.generator.core/schema/featuretypes.exsd

@@ -49,14 +49,14 @@
 
    <element name="FeatureLibrary">
       <complexType>
-         <attribute name="uri" type="string" use="required">
+         <attribute name="library_id" type="string" use="required">
             <annotation>
                <documentation>
                   
                </documentation>
             </annotation>
          </attribute>
-         <attribute name="generatorId" type="string" use="required">
+         <attribute name="uri" type="string" use="required">
             <annotation>
                <documentation>
                   

+ 168 - 150
plugins/org.yakindu.sct.generator.core/schema/generator.exsd

@@ -1,150 +1,168 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.generator.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.generator.core" id="org.yakindu.sct.generator.core.generator" name="Generator"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="SCTGenerator"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="SCTGenerator">
-      <complexType>
-         <attribute name="class" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.generator.core.ISCTGenerator"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="icon" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="resource"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="description" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="contentType" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="elementRefType" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.eclipse.emf.ecore.EObject"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.yakindu.sct.generator.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.yakindu.sct.generator.core" id="org.yakindu.sct.generator.core.generator" name="Generator"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="SCTGenerator"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="SCTGenerator">
+      <complexType>
+         <sequence minOccurs="0" maxOccurs="unbounded">
+            <element ref="FeatureLibrary"/>
+         </sequence>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.generator.core.ISCTGenerator"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="icon" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="resource"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="description" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="contentType" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="elementRefType" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.eclipse.emf.ecore.EObject"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="FeatureLibrary">
+      <complexType>
+         <attribute name="library_id" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="identifier" basedOn="org.yakindu.sct.generator.core.featuretypes/FeatureLibrary/@library_id"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

+ 33 - 10
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/GeneratorExtensions.java

@@ -13,6 +13,8 @@ package org.yakindu.sct.generator.core.extensions;
 import static com.google.common.collect.Iterables.transform;
 import static com.google.common.collect.Lists.newArrayList;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.NoSuchElementException;
 
 import org.eclipse.core.runtime.CoreException;
@@ -33,6 +35,8 @@ public class GeneratorExtensions {
 	private static final String EXTENSION_POINT_ID = "org.yakindu.sct.generator.core.generator";
 	private static final String ATTRIBUTE_CLASS = "class";
 	private static final String ATTRIBUTE_ID = "id";
+	private static final String LIBRARY_CONFIG_ELEMENT = "FeatureLibrary";
+	private static final String ATTRIBUTE_LIBRARY_ID = "library_id";
 	private static final String ATTRIBUTE_NAME = "name";
 	private static final String ATTRIBUTE_CONTENT_TYPE = "contentType";
 	private static final String ATTRIBUTE_ELEMENT_REF_TYPE = "elementRefType";
@@ -50,13 +54,26 @@ public class GeneratorExtensions {
 
 		public ISCTGenerator createGenerator() {
 			try {
-				return (ISCTGenerator) configElement.createExecutableExtension(ATTRIBUTE_CLASS);
+				return (ISCTGenerator) configElement
+						.createExecutableExtension(ATTRIBUTE_CLASS);
 			} catch (CoreException e) {
 				e.printStackTrace();
 			}
 			return null;
 		}
 
+		public List<String> getLibraryIDs() {
+			List<String> libs = new ArrayList<String>();
+			for (IConfigurationElement child : configElement
+					.getChildren(LIBRARY_CONFIG_ELEMENT)) {
+				String lib_id = child.getAttribute(ATTRIBUTE_LIBRARY_ID);
+				if (lib_id != null && !lib_id.isEmpty()) {
+					libs.add(lib_id);
+				}
+			}
+			return libs;
+		}
+
 		public String getId() {
 			return configElement.getAttribute(ATTRIBUTE_ID);
 		}
@@ -117,10 +134,13 @@ public class GeneratorExtensions {
 	}
 
 	public static Iterable<GeneratorDescriptor> getGeneratorDescriptors() {
-		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(
-				EXTENSION_POINT_ID);
+		IConfigurationElement[] configurationElements = Platform
+				.getExtensionRegistry().getConfigurationElementsFor(
+						EXTENSION_POINT_ID);
 		if (generatorDescriptors == null) {
-			generatorDescriptors = transform(newArrayList(configurationElements), new CreateGeneratorDescriptor());
+			generatorDescriptors = transform(
+					newArrayList(configurationElements),
+					new CreateGeneratorDescriptor());
 		}
 		return generatorDescriptors;
 	}
@@ -129,13 +149,16 @@ public class GeneratorExtensions {
 	 * returns the Generator Descriptor for the given generator id, or null, if
 	 * the id is unknown
 	 */
-	public static GeneratorDescriptor getGeneratorDescriptorForId(final String generatorId) {
+	public static GeneratorDescriptor getGeneratorDescriptorForId(
+			final String generatorId) {
 		try {
-			return Iterables.find(getGeneratorDescriptors(), new Predicate<GeneratorDescriptor>() {
-				public boolean apply(GeneratorDescriptor input) {
-					return input != null && input.getId() != null && input.getId().equals(generatorId);
-				}
-			});
+			return Iterables.find(getGeneratorDescriptors(),
+					new Predicate<GeneratorDescriptor>() {
+						public boolean apply(GeneratorDescriptor input) {
+							return input != null && input.getId() != null
+									&& input.getId().equals(generatorId);
+						}
+					});
 		} catch (NoSuchElementException ex) {
 			return null;
 		}

+ 20 - 14
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/LibraryExtensions.java

@@ -13,6 +13,8 @@ package org.yakindu.sct.generator.core.extensions;
 import static com.google.common.collect.Iterables.transform;
 import static com.google.common.collect.Lists.newArrayList;
 
+import java.util.List;
+
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
@@ -33,7 +35,7 @@ public class LibraryExtensions {
 
 	private static final String EXTENSION_POINT_ID = "org.yakindu.sct.generator.core.featuretypes";
 	private static final String ATTRIBUTE_URI = "uri";
-	private static final String ATTRIBUTE_GENERATOR_ID = "generatorId";
+	private static final String ATTRIBUTE_LIBRARY_ID = "library_id";
 	private static final String DEFAULT_PROVIDER = "defaultProvider";
 
 	public static final String GLOBAL_ID = "ALL";
@@ -48,9 +50,9 @@ public class LibraryExtensions {
 		public URI getURI() {
 			return URI.createURI(configElement.getAttribute(ATTRIBUTE_URI));
 		}
-
-		public String getGeneratorId() {
-			return configElement.getAttribute(ATTRIBUTE_GENERATOR_ID);
+		
+		public String getLibraryId() {
+			return configElement.getAttribute(ATTRIBUTE_LIBRARY_ID);
 		}
 
 		public IDefaultFeatureValueProvider createFeatureValueProvider() {
@@ -64,30 +66,34 @@ public class LibraryExtensions {
 		}
 	}
 
-	public static Iterable<LibraryDescriptor> getLibraryDescriptor() {
+	public static Iterable<LibraryDescriptor> getLibraryDescriptors() {
 		IConfigurationElement[] configurationElements = Platform
 				.getExtensionRegistry().getConfigurationElementsFor(
 						EXTENSION_POINT_ID);
 		return transform(newArrayList(configurationElements),
 				new CreateLibraryDescriptor());
 	}
-
-	public static Iterable<LibraryDescriptor> getLibraryDescriptor(
-			final String generatorId) {
+	
+	public static Iterable<LibraryDescriptor> getLibraryDescriptors(
+			final List<String> libraryIds) {
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor();
+				.getLibraryDescriptors();
 		return Iterables.filter(libraryDescriptor,
 				new Predicate<LibraryDescriptor>() {
 					public boolean apply(LibraryDescriptor input) {
-						return input.getGeneratorId().equals(generatorId)
-								|| input.getGeneratorId().equals(GLOBAL_ID);
+						for (String libId : libraryIds) {
+							if (input.getLibraryId().equals(libId)) {
+								return true;
+							}
+						}
+						return false;
 					}
 				});
 	}
-
+	
 	public static IDefaultFeatureValueProvider getDefaultFeatureValueProvider(
-			String generatorId, FeatureTypeLibrary library) {
-		Iterable<LibraryDescriptor> libraryDescriptor = getLibraryDescriptor(generatorId);
+			List<String> libraryId, FeatureTypeLibrary library) {
+		Iterable<LibraryDescriptor> libraryDescriptor = getLibraryDescriptors(libraryId);
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			IDefaultFeatureValueProvider defaultProvider = desc
 					.createFeatureValueProvider();

+ 7 - 1
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/quickfix/SGenQuickfixProvider.java

@@ -22,7 +22,9 @@ import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
 import org.eclipse.xtext.ui.editor.quickfix.Fix;
 import org.eclipse.xtext.ui.editor.quickfix.IssueResolutionAcceptor;
 import org.eclipse.xtext.validation.Issue;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.genmodel.validation.SGenJavaValidator;
 import org.yakindu.sct.model.sgen.FeatureConfiguration;
@@ -60,8 +62,12 @@ public class SGenQuickfixProvider extends DefaultQuickfixProvider {
 			final Issue issue, EObject element) {
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(element);
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(model.getGeneratorId());
+		
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor(model.getGeneratorId());
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			ResourceSet set = new ResourceSetImpl();
 			Resource resource = set.getResource(desc.getURI(), true);

+ 8 - 1
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/templates/SGenTemplateProposalProvider.java

@@ -24,7 +24,9 @@ import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
 import org.eclipse.xtext.ui.editor.contentassist.ITemplateAcceptor;
 import org.eclipse.xtext.ui.editor.templates.ContextTypeIdHelper;
 import org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.genmodel.services.SGenGrammarAccess;
 import org.yakindu.sct.model.sgen.FeatureType;
@@ -72,8 +74,13 @@ public class SGenTemplateProposalProvider extends
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(context.getCurrentModel());
 
+
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(model.getGeneratorId());
+		
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor(model.getGeneratorId());
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			ResourceSet set = new ResourceSetImpl();
 			Resource resource = set.getResource(desc.getURI(), true);

+ 14 - 2
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/ModelCreator.java

@@ -17,7 +17,9 @@ import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
 import org.yakindu.sct.model.sgen.FeatureConfiguration;
@@ -72,8 +74,13 @@ public class ModelCreator {
 
 	private FeatureConfiguration createFeatureConfiguration(
 			Statechart statechart, FeatureType featureType) {
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(generatorId);
+		
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor(generatorId);
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			IDefaultFeatureValueProvider defaultProvider = desc
 					.createFeatureValueProvider();
@@ -88,8 +95,13 @@ public class ModelCreator {
 
 	public static List<FeatureType> getFeatureTypes(String generatorId) {
 		ArrayList<FeatureType> features = Lists.newArrayList();
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(generatorId);
+		
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor(generatorId);
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			ResourceSet set = new ResourceSetImpl();
 			Resource resource = set.getResource(desc.getURI(), true);

+ 57 - 36
plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/scoping/SGenScopeProvider.java

@@ -64,66 +64,87 @@ public class SGenScopeProvider extends AbstractDeclarativeScopeProvider {
 		return super.getScope(context, reference);
 	}
 
-	protected IScope scope_GeneratorEntry_elementRef(final EObject context, final EReference reference) {
-		GeneratorModel generatorModel = (GeneratorModel) EcoreUtil2.getRootContainer(context);
+	protected IScope scope_GeneratorEntry_elementRef(final EObject context,
+			final EReference reference) {
+		GeneratorModel generatorModel = (GeneratorModel) EcoreUtil2
+				.getRootContainer(context);
 		String id = generatorModel.getGeneratorId();
-		final GeneratorDescriptor desc = GeneratorExtensions.getGeneratorDescriptorForId(id);
+		final GeneratorDescriptor desc = GeneratorExtensions
+				.getGeneratorDescriptorForId(id);
 		if (desc == null)
 			return IScope.NULLSCOPE;
 		final String elementRefType = desc.getElementRefType();
-		return new FilteringScope(getDelegate().getScope(context, reference), new Predicate<IEObjectDescription>() {
-			public boolean apply(IEObjectDescription input) {
-				return elementRefType.equals(input.getEClass().getInstanceClassName());
-			}
-		});
+		return new FilteringScope(getDelegate().getScope(context, reference),
+				new Predicate<IEObjectDescription>() {
+					public boolean apply(IEObjectDescription input) {
+						return elementRefType.equals(input.getEClass()
+								.getInstanceClassName());
+					}
+				});
 	}
 
 	protected IScope scope_Parameter(final EObject context, EReference reference) {
 		IScope libraryScope = getLibraryScope(context.eResource());
-		return new FilteringScope(libraryScope, new Predicate<IEObjectDescription>() {
-			public boolean apply(IEObjectDescription input) {
-				if (!input.getEClass().equals(SGenPackage.Literals.FEATURE_PARAMETER)) {
-					return false;
-				}
-				// Only allow references to FeatureParameters defined by
-				// enclosing Feature
-				FeatureConfiguration configuration = EcoreUtil2.getContainerOfType(context, FeatureConfiguration.class);
-				if (configuration == null || configuration.getType() == null)
-					return false;
-				String featureName = configuration.getType().getName();
-				if (featureName == null) {
-					return false;
-				}
-				return featureName.equals(input.getUserData(FeatureResourceDescription.FEATURE_CONTAINER));
+		return new FilteringScope(libraryScope,
+				new Predicate<IEObjectDescription>() {
+					public boolean apply(IEObjectDescription input) {
+						if (!input.getEClass().equals(
+								SGenPackage.Literals.FEATURE_PARAMETER)) {
+							return false;
+						}
+						// Only allow references to FeatureParameters defined by
+						// enclosing Feature
+						FeatureConfiguration configuration = EcoreUtil2
+								.getContainerOfType(context,
+										FeatureConfiguration.class);
+						if (configuration == null
+								|| configuration.getType() == null)
+							return false;
+						String featureName = configuration.getType().getName();
+						if (featureName == null) {
+							return false;
+						}
+						return featureName.equals(input
+								.getUserData(FeatureResourceDescription.FEATURE_CONTAINER));
 
-			}
-		});
+					}
+				});
 	}
 
 	protected IScope scope_Type(EObject context, EReference reference) {
 		IScope libraryScope = getLibraryScope(context.eResource());
-		return new FilteringScope(libraryScope, new Predicate<IEObjectDescription>() {
-			public boolean apply(IEObjectDescription input) {
-				return input.getEClass().equals(SGenPackage.Literals.FEATURE_TYPE);
-			}
-		});
+		return new FilteringScope(libraryScope,
+				new Predicate<IEObjectDescription>() {
+					public boolean apply(IEObjectDescription input) {
+						return input.getEClass().equals(
+								SGenPackage.Literals.FEATURE_TYPE);
+					}
+				});
 	}
 
 	protected SimpleScope getLibraryScope(Resource resource) {
-		GeneratorModel generatorModel = (GeneratorModel) EcoreUtil.getObjectByType(resource.getContents(),
-				SGenPackage.Literals.GENERATOR_MODEL);
+		GeneratorModel generatorModel = (GeneratorModel) EcoreUtil
+				.getObjectByType(resource.getContents(),
+						SGenPackage.Literals.GENERATOR_MODEL);
 		Assert.isNotNull(generatorModel);
 		String generatorId = generatorModel.getGeneratorId();
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(generatorId);
 
+		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
 		Iterable<IEObjectDescription> allElements = Lists.newArrayList();
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptor(generatorId);
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			Resource library = resourceSet.getResource(desc.getURI(), true);
-			FeatureResourceDescription description = new FeatureResourceDescription(library);
+			FeatureResourceDescription description = new FeatureResourceDescription(
+					library);
 			injector.injectMembers(description);
-			allElements = Iterables.concat(allElements, description.getExportedObjects());
+			allElements = Iterables.concat(allElements,
+					description.getExportedObjects());
 		}
+
 		return new SimpleScope(allElements);
 	}
-
 }

+ 16 - 3
plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/validation/SGenJavaValidator.java

@@ -123,8 +123,12 @@ public class SGenJavaValidator extends AbstractSGenJavaValidator {
 			return;
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(value);
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(model.getGeneratorId());
+		
 		IDefaultFeatureValueProvider provider = LibraryExtensions
-				.getDefaultFeatureValueProvider(model.getGeneratorId(), value
+				.getDefaultFeatureValueProvider(generatorDescriptor.getLibraryIDs(), value
 						.getParameter().getFeatureType().getLibrary());
 		IStatus status = provider.validateParameterValue(value);
 		createMarker(status);
@@ -192,8 +196,13 @@ public class SGenJavaValidator extends AbstractSGenJavaValidator {
 	public void checkRequiredFeatures(GeneratorEntry entry) {
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(entry);
+
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(model.getGeneratorId());
+
 		Iterable<LibraryDescriptor> libraryDescriptors = LibraryExtensions
-				.getLibraryDescriptor(model.getGeneratorId());
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+
 		Iterable<FeatureType> requiredFeatures = filter(
 				concat(transform(
 						transform(libraryDescriptors, getFeatureTypeLibrary()),
@@ -215,8 +224,12 @@ public class SGenJavaValidator extends AbstractSGenJavaValidator {
 	public void checkRequiredParameters(FeatureConfiguration configuration) {
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(configuration);
+
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(model.getGeneratorId());
+
 		Iterable<LibraryDescriptor> libraryDescriptors = LibraryExtensions
-				.getLibraryDescriptor(model.getGeneratorId());
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
 
 		Iterable<String> requiredParameters = transform(
 				filter(concat(transform(

+ 7 - 1
plugins/org.yakindu.sct.generator.java/plugin.xml

@@ -10,13 +10,19 @@
             contentType="statechart"
             elementRefType="org.yakindu.sct.model.sgraph.Statechart"
             name="YAKINDU SCT Java Code Generator">
+          <FeatureLibrary
+                library_id="org.yakindu.generator.core.features">
+          </FeatureLibrary>
+          <FeatureLibrary
+                library_id="org.yakindu.sct.generator.feature.java">
+          </FeatureLibrary>
       </SCTGenerator>
    </extension>
    <extension
          point="org.yakindu.sct.generator.core.featuretypes">
       <FeatureLibrary
             defaultProvider="org.yakindu.sct.generator.java.features.JavaFeatureValueProvider"
-            generatorId="yakindu::java"
+            library_id="org.yakindu.sct.generator.feature.java"
             uri="platform:/plugin/org.yakindu.sct.generator.java/library/FeatureTypeLibrary.xmi">
       </FeatureLibrary>
    </extension>

+ 8 - 1
test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/HelpIntegrationTest.java

@@ -23,7 +23,9 @@ import org.eclipse.xtext.resource.IEObjectDescription;
 import org.eclipse.xtext.resource.XtextResourceSet;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription;
 import org.yakindu.sct.generator.genmodel.test.util.SGenInjectorProvider;
@@ -107,8 +109,13 @@ public class HelpIntegrationTest {
 	}
 
 	private List<String> getFeaturesWithoutDocumentation(String generatorId) {
+		
+		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptorForId(generatorId);
+		
 		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptor(generatorId);
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
 		Iterable<IEObjectDescription> allElements = Lists.newArrayList();
 		for (LibraryDescriptor desc : libraryDescriptor) {
 			Resource library = resourceSet.getResource(desc.getURI(), true);