Переглянути джерело

Merge pull request #365 from Yakindu/issue_358

Issue 358
jdicks 9 роки тому
батько
коміт
5375477eaa
22 змінених файлів з 1581 додано та 1539 видалено
  1. 148 145
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainRegistry.java
  2. 17 0
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainDescriptor.java
  3. 5 5
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/GeneratorExecutor.java
  4. 26 55
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/GeneratorExtensions.java
  5. 40 0
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/IGeneratorDescriptor.java
  6. 14 0
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/ILibraryDescriptor.java
  7. 45 46
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/LibraryExtensions.java
  8. 5 7
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/contentassist/SGenProposalProvider.java
  9. 6 6
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/quickfix/SGenQuickfixProvider.java
  10. 105 105
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/templates/SGenTemplateProposalProvider.java
  11. 3 3
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/CoreGenerator.java
  12. 9 9
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/ModelCreator.java
  13. 2 2
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/SGenNewFileWizard.java
  14. 226 225
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/SGenWizardPage2.java
  15. 2 2
      plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/SGenWizardPage2LabelProvider.java
  16. 8 8
      plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/scoping/SGenScopeProvider.java
  17. 369 369
      plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/validation/SGenJavaValidator.java
  18. 67 67
      plugins/org.yakindu.sct.model.resource/src/org/yakindu/sct/model/resource/SCTResourceFactory.java
  19. 2 2
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/AbstractEditorPropertySection.java
  20. 219 219
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/StatechartPropertySection.java
  21. 118 118
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/DomainWizardPage.java
  22. 145 146
      test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/HelpIntegrationTest.java

+ 148 - 145
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainRegistry.java

@@ -1,145 +1,148 @@
-/**
- * Copyright (c) 2015 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.domain.extension;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.osgi.framework.Bundle;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class DomainRegistry {
-
-	private static final String EXTENSION_POINT = "org.yakindu.sct.domain";
-	private static final String DOMAIN_ID = "domainID";
-	private static final String DESCRIPTION = "description";
-	private static final String IMAGE = "image";
-	private static final String NAME = "name";
-	private static final String MODULE_PROVIDER = "domainModuleProvider";
-
-	private DomainRegistry() {
-	}
-
-	private static List<DomainDescriptor> descriptors = null;
-
-	public static final class DomainDescriptor {
-
-		private final IConfigurationElement configElement;
-
-		private Image image;
-
-		private IDomainInjectorProvider injectorProvider;
-
-		DomainDescriptor(IConfigurationElement configElement) {
-			this.configElement = configElement;
-		}
-
-		public String getDomainID() {
-			return configElement.getAttribute(DOMAIN_ID);
-		}
-
-		public String getName() {
-			return configElement.getAttribute(NAME);
-		}
-
-		public String getDescription() {
-			return configElement.getAttribute(DESCRIPTION);
-		}
-
-		public IDomainInjectorProvider getDomainInjectorProvider() {
-			if (injectorProvider == null) {
-				try {
-					injectorProvider = (IDomainInjectorProvider) configElement
-							.createExecutableExtension(MODULE_PROVIDER);
-				} catch (CoreException e) {
-					e.printStackTrace();
-				}
-			}
-			return injectorProvider;
-		}
-
-		public Image getImage() {
-			if (image != null)
-				return image;
-			String path = configElement.getAttribute(IMAGE);
-			if (path == null)
-				return null;
-
-			Bundle extensionBundle = Platform.getBundle(configElement.getContributor().getName());
-			URL entry = extensionBundle.getEntry(path);
-			ImageDescriptor descriptor = ImageDescriptor.createFromURL(entry);
-			image = descriptor.createImage();
-			return image;
-		}
-
-		public IConfigurationElement getConfigElement() {
-			return configElement;
-		}
-
-		public void setImage(Image image) {
-			this.image = image;
-		}
-	}
-
-	public static List<DomainDescriptor> getDomainDescriptors() {
-		if (descriptors == null) {
-			descriptors = new ArrayList<DomainDescriptor>();
-			IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
-					.getConfigurationElementsFor(EXTENSION_POINT);
-			for (IConfigurationElement iConfigurationElement : configurationElements) {
-				descriptors.add(new DomainDescriptor(iConfigurationElement));
-			}
-		}
-		return descriptors;
-	}
-
-	public static DomainDescriptor getDomainDescriptor(final String id) {
-		final String defaultDomainID = SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral();
-		try {
-			return Iterables.find(getDomainDescriptors(), new Predicate<DomainDescriptor>() {
-				@Override
-				public boolean apply(DomainDescriptor input) {
-					return input.getDomainID().equals(id != null ? id : defaultDomainID);
-				}
-			});
-		} catch (NoSuchElementException e) {
-			if (defaultDomainID.equals(id)) {
-				throw new IllegalArgumentException("No default domain found!");
-			}
-			System.err.println("Could not find domain descriptor for id " + id + " - > using default domain");
-			return getDomainDescriptor(defaultDomainID);
-		}
-	}
-
-	public static DomainDescriptor getDomainDescriptor(EObject object) {
-		EObject rootContainer = EcoreUtil.getRootContainer(object);
-		Assert.isTrue(rootContainer instanceof Statechart);
-		return getDomainDescriptor(((Statechart) rootContainer).getDomainID());
-	}
-}
+/**
+ * Copyright (c) 2015 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.domain.extension;
+
+import java.net.URL;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Bundle;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.model.sgraph.Statechart;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class DomainRegistry {
+
+	private static final String EXTENSION_POINT_ID = "org.yakindu.sct.domain";
+	private static final String DOMAIN_ID = "domainID";
+	private static final String DESCRIPTION = "description";
+	private static final String IMAGE = "image";
+	private static final String NAME = "name";
+	private static final String MODULE_PROVIDER = "domainModuleProvider";
+
+	private DomainRegistry() {
+	}
+
+	private static List<IDomainDescriptor> descriptors;
+
+	private static final class ConfigElementDomainDescriptor implements IDomainDescriptor {
+
+		private final IConfigurationElement configElement;
+
+		private Image image;
+
+		private IDomainInjectorProvider injectorProvider;
+
+		ConfigElementDomainDescriptor(IConfigurationElement configElement) {
+			this.configElement = configElement;
+		}
+
+		@Override
+		public String getDomainID() {
+			return configElement.getAttribute(DOMAIN_ID);
+		}
+
+		@Override
+		public String getName() {
+			return configElement.getAttribute(NAME);
+		}
+
+		@Override
+		public String getDescription() {
+			return configElement.getAttribute(DESCRIPTION);
+		}
+
+		@Override
+		public IDomainInjectorProvider getDomainInjectorProvider() {
+			if (injectorProvider == null) {
+				try {
+					injectorProvider = (IDomainInjectorProvider) configElement
+							.createExecutableExtension(MODULE_PROVIDER);
+				} catch (CoreException e) {
+					e.printStackTrace();
+				}
+			}
+			return injectorProvider;
+		}
+
+		@Override
+		public Image getImage() {
+			if (image != null)
+				return image;
+			String path = configElement.getAttribute(IMAGE);
+			if (path == null)
+				return null;
+
+			Bundle extensionBundle = Platform.getBundle(configElement.getContributor().getName());
+			URL entry = extensionBundle.getEntry(path);
+			ImageDescriptor descriptor = ImageDescriptor.createFromURL(entry);
+			image = descriptor.createImage();
+			return image;
+		}
+	}
+
+	public static List<IDomainDescriptor> getDomainDescriptors() {
+		if (descriptors == null) {
+			descriptors = Lists.newArrayList();
+			if (Platform.isRunning()) {
+				initFromExtensions();
+			}
+		}
+		return descriptors;
+	}
+
+	protected static void initFromExtensions() {
+		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
+				.getConfigurationElementsFor(EXTENSION_POINT_ID);
+		for (IConfigurationElement iConfigurationElement : configurationElements) {
+			descriptors.add(new ConfigElementDomainDescriptor(iConfigurationElement));
+		}
+	}
+
+	public static IDomainDescriptor getDomainDescriptor(final String id) {
+		final String defaultDomainID = SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral();
+		try {
+			return Iterables.find(getDomainDescriptors(), new Predicate<IDomainDescriptor>() {
+				@Override
+				public boolean apply(IDomainDescriptor input) {
+					return input.getDomainID().equals(id != null ? id : defaultDomainID);
+				}
+			});
+		} catch (NoSuchElementException e) {
+			if (defaultDomainID.equals(id)) {
+				throw new IllegalArgumentException("No default domain found!");
+			}
+			System.err.println("Could not find domain descriptor for id " + id + " - > using default domain");
+			return getDomainDescriptor(defaultDomainID);
+		}
+	}
+
+	public static IDomainDescriptor getDomainDescriptor(EObject object) {
+		EObject rootContainer = EcoreUtil.getRootContainer(object);
+		Assert.isTrue(rootContainer instanceof Statechart);
+		return getDomainDescriptor(((Statechart) rootContainer).getDomainID());
+	}
+}

+ 17 - 0
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainDescriptor.java

@@ -0,0 +1,17 @@
+package org.yakindu.sct.domain.extension;
+
+import org.eclipse.swt.graphics.Image;
+
+public interface IDomainDescriptor {
+
+	String getDomainID();
+
+	String getName();
+
+	String getDescription();
+
+	IDomainInjectorProvider getDomainInjectorProvider();
+
+	Image getImage();
+
+}

+ 5 - 5
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/GeneratorExecutor.java

@@ -20,7 +20,7 @@ import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
 import org.yakindu.sct.model.sgen.GeneratorEntry;
 import org.yakindu.sct.model.sgen.GeneratorModel;
 
@@ -40,8 +40,8 @@ public class GeneratorExecutor {
 		GeneratorModel model = (GeneratorModel) resource.getContents().get(0);
 
 		String generatorId = model.getGeneratorId();
-		GeneratorDescriptor description = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorId);
+		IGeneratorDescriptor description = GeneratorExtensions
+				.getGeneratorDescriptor(generatorId);
 		if (description == null)
 			return;
 		final ISCTGenerator generator = description.createGenerator();
@@ -66,8 +66,8 @@ public class GeneratorExecutor {
 	public void executeGenerator(GeneratorModel model) {
 
 		String generatorId = model.getGeneratorId();
-		GeneratorDescriptor description = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorId);
+		IGeneratorDescriptor description = GeneratorExtensions
+				.getGeneratorDescriptor(generatorId);
 		if (description == null)
 			throw new RuntimeException("No generator registered for ID: " + generatorId);
 		final ISCTGenerator generator = description.createGenerator();

+ 26 - 55
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/GeneratorExtensions.java

@@ -10,9 +10,6 @@
  */
 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.net.URL;
 import java.util.ArrayList;
 import java.util.List;
@@ -26,9 +23,9 @@ import org.eclipse.swt.graphics.Image;
 import org.osgi.framework.Bundle;
 import org.yakindu.sct.generator.core.ISCTGenerator;
 
-import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 
 /**
  * @author holger willebrandt - Initial contribution and API
@@ -46,9 +43,9 @@ public class GeneratorExtensions {
 	private static final String ATTRIBUTE_ICON = "icon";
 	private static final String ATTRIBUTE_DESCRIPTION = "description";
 
-	private static Iterable<GeneratorDescriptor> generatorDescriptors;
+	private static List<IGeneratorDescriptor> descriptors;
 
-	public static class GeneratorDescriptor {
+	private static class GeneratorDescriptor implements IGeneratorDescriptor {
 
 		private final IConfigurationElement configElement;
 
@@ -58,6 +55,7 @@ public class GeneratorExtensions {
 			this.configElement = configElement;
 		}
 
+		@Override
 		public ISCTGenerator createGenerator() {
 			try {
 				return (ISCTGenerator) configElement.createExecutableExtension(ATTRIBUTE_CLASS);
@@ -67,6 +65,7 @@ public class GeneratorExtensions {
 			return null;
 		}
 
+		@Override
 		public List<String> getLibraryIDs() {
 			List<String> libs = new ArrayList<String>();
 			for (IConfigurationElement child : configElement.getChildren(LIBRARY_CONFIG_ELEMENT)) {
@@ -78,17 +77,17 @@ public class GeneratorExtensions {
 			return libs;
 		}
 
+		@Override
 		public String getId() {
 			return configElement.getAttribute(ATTRIBUTE_ID);
 		}
 
+		@Override
 		public String getName() {
 			return configElement.getAttribute(ATTRIBUTE_NAME);
 		}
 
-		/**
-		 * may return null!!
-		 */
+		@Override
 		public Image getImage() {
 			if (image != null)
 				return image;
@@ -103,14 +102,17 @@ public class GeneratorExtensions {
 			return image;
 		}
 
+		@Override
 		public String getContentType() {
 			return configElement.getAttribute(ATTRIBUTE_CONTENT_TYPE);
 		}
 
+		@Override
 		public String getDescription() {
 			return configElement.getAttribute(ATTRIBUTE_DESCRIPTION);
 		}
 
+		@Override
 		public String getElementRefType() {
 			try {
 				return configElement.getAttribute(ATTRIBUTE_ELEMENT_REF_TYPE);
@@ -119,58 +121,34 @@ public class GeneratorExtensions {
 				return null;
 			}
 		}
+	}
 
-		@Override
-		public int hashCode() {
-			String id = getId();
-			final int prime = 31;
-			int result = 1;
-			result = prime * result + ((id == null) ? 0 : id.hashCode());
-			return result;
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			if (this == obj) {
-				return true;
-			}
-			if (obj == null) {
-				return false;
-			}
-			if (getClass() != obj.getClass()) {
-				return false;
-			}
-			GeneratorDescriptor other = (GeneratorDescriptor) obj;
-			String id = getId();
-			if (id == null) {
-				if (other.getId() != null) {
-					return false;
-				}
-			} else if (!id.equals(other.getId())) {
-				return false;
+	public static List<IGeneratorDescriptor> getGeneratorDescriptors() {
+		if (descriptors == null) {
+			descriptors = Lists.newArrayList();
+			if (Platform.isRunning()) {
+				initFromExtensions();
 			}
-			return true;
 		}
-
-
+		return descriptors;
 	}
 
-	public static Iterable<GeneratorDescriptor> getGeneratorDescriptors() {
-		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID);
-		if (generatorDescriptors == null) {
-			generatorDescriptors = transform(newArrayList(configurationElements), new CreateGeneratorDescriptor());
+	protected static void initFromExtensions() {
+		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
+				.getConfigurationElementsFor(EXTENSION_POINT_ID);
+		for (IConfigurationElement iConfigurationElement : configurationElements) {
+			descriptors.add(new GeneratorDescriptor(iConfigurationElement));
 		}
-		return generatorDescriptors;
 	}
 
 	/**
 	 * 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 IGeneratorDescriptor getGeneratorDescriptor(final String generatorId) {
 		try {
-			return Iterables.find(getGeneratorDescriptors(), new Predicate<GeneratorDescriptor>() {
-				public boolean apply(GeneratorDescriptor input) {
+			return Iterables.find(getGeneratorDescriptors(), new Predicate<IGeneratorDescriptor>() {
+				public boolean apply(IGeneratorDescriptor input) {
 					return input != null && input.getId() != null && input.getId().equals(generatorId);
 				}
 			});
@@ -179,11 +157,4 @@ public class GeneratorExtensions {
 		}
 	}
 
-	private static final class CreateGeneratorDescriptor implements Function<IConfigurationElement, GeneratorDescriptor> {
-
-		public GeneratorDescriptor apply(IConfigurationElement from) {
-			return new GeneratorDescriptor(from);
-		}
-	}
-
 }

+ 40 - 0
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/IGeneratorDescriptor.java

@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2016 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ * 		committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.core.extensions;
+
+import java.util.List;
+
+import org.eclipse.swt.graphics.Image;
+import org.yakindu.sct.generator.core.ISCTGenerator;
+
+public interface IGeneratorDescriptor {
+
+	ISCTGenerator createGenerator();
+
+	List<String> getLibraryIDs();
+
+	String getId();
+
+	String getName();
+
+	/**
+	 * may return null!!
+	 */
+	Image getImage();
+
+	String getContentType();
+
+	String getDescription();
+
+	String getElementRefType();
+
+}

+ 14 - 0
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/ILibraryDescriptor.java

@@ -0,0 +1,14 @@
+package org.yakindu.sct.generator.core.extensions;
+
+import org.eclipse.emf.common.util.URI;
+import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
+
+public interface ILibraryDescriptor {
+
+	URI getURI();
+
+	String getLibraryId();
+
+	IDefaultFeatureValueProvider createFeatureValueProvider();
+
+}

+ 45 - 46
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/extensions/LibraryExtensions.java

@@ -10,9 +10,6 @@
  */
 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;
@@ -22,9 +19,9 @@ import org.eclipse.emf.common.util.URI;
 import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
 import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
 
-import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
 
 /**
  * 
@@ -40,25 +37,29 @@ public class LibraryExtensions {
 
 	public static final String GLOBAL_ID = "ALL";
 
-	public static class LibraryDescriptor {
+	private static List<ILibraryDescriptor> descriptors;
+
+	private static class LibraryDescriptor implements ILibraryDescriptor {
 		private final IConfigurationElement configElement;
 
 		LibraryDescriptor(IConfigurationElement configElement) {
 			this.configElement = configElement;
 		}
 
+		@Override
 		public URI getURI() {
 			return URI.createURI(configElement.getAttribute(ATTRIBUTE_URI));
 		}
-		
+
+		@Override
 		public String getLibraryId() {
 			return configElement.getAttribute(ATTRIBUTE_LIBRARY_ID);
 		}
 
+		@Override
 		public IDefaultFeatureValueProvider createFeatureValueProvider() {
 			try {
-				return (IDefaultFeatureValueProvider) configElement
-						.createExecutableExtension(DEFAULT_PROVIDER);
+				return (IDefaultFeatureValueProvider) configElement.createExecutableExtension(DEFAULT_PROVIDER);
 			} catch (CoreException e) {
 				e.printStackTrace();
 			}
@@ -66,51 +67,49 @@ public class LibraryExtensions {
 		}
 	}
 
-	public static Iterable<LibraryDescriptor> getLibraryDescriptors() {
-		IConfigurationElement[] configurationElements = Platform
-				.getExtensionRegistry().getConfigurationElementsFor(
-						EXTENSION_POINT_ID);
-		return transform(newArrayList(configurationElements),
-				new CreateLibraryDescriptor());
+	public static List<ILibraryDescriptor> getLibraryDescriptors() {
+
+		if (descriptors == null) {
+			descriptors = Lists.newArrayList();
+			if (Platform.isRunning()) {
+				initFromExtensions();
+			}
+		}
+		return descriptors;
+	}
+
+	protected static void initFromExtensions() {
+		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
+				.getConfigurationElementsFor(EXTENSION_POINT_ID);
+		for (IConfigurationElement iConfigurationElement : configurationElements) {
+			descriptors.add(new LibraryDescriptor(iConfigurationElement));
+		}
 	}
-	
-	public static Iterable<LibraryDescriptor> getLibraryDescriptors(
-			final List<String> libraryIds) {
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptors();
-		return Iterables.filter(libraryDescriptor,
-				new Predicate<LibraryDescriptor>() {
-					public boolean apply(LibraryDescriptor input) {
-						for (String libId : libraryIds) {
-							if (input.getLibraryId().equals(libId)) {
-								return true;
-							}
-						}
-						return false;
+
+	public static List<ILibraryDescriptor> getLibraryDescriptors(final List<String> libraryIds) {
+		Iterable<ILibraryDescriptor> libraryDescriptor = getLibraryDescriptors();
+		return Lists.newArrayList(Iterables.filter(libraryDescriptor, new Predicate<ILibraryDescriptor>() {
+			public boolean apply(ILibraryDescriptor input) {
+				for (String libId : libraryIds) {
+					if (input.getLibraryId().equals(libId)) {
+						return true;
 					}
-				});
+				}
+				return false;
+			}
+		}));
 	}
-	
-	public static IDefaultFeatureValueProvider getDefaultFeatureValueProvider(
-			List<String> libraryId, FeatureTypeLibrary library) {
-		Iterable<LibraryDescriptor> libraryDescriptor = getLibraryDescriptors(libraryId);
-		for (LibraryDescriptor desc : libraryDescriptor) {
-			IDefaultFeatureValueProvider defaultProvider = desc
-					.createFeatureValueProvider();
-			if (defaultProvider != null
-					&& defaultProvider.isProviderFor(library)) {
+
+	public static IDefaultFeatureValueProvider getDefaultFeatureValueProvider(List<String> libraryId,
+			FeatureTypeLibrary library) {
+		List<ILibraryDescriptor> libraryDescriptor = getLibraryDescriptors(libraryId);
+		for (ILibraryDescriptor desc : libraryDescriptor) {
+			IDefaultFeatureValueProvider defaultProvider = desc.createFeatureValueProvider();
+			if (defaultProvider != null && defaultProvider.isProviderFor(library)) {
 				return defaultProvider;
 			}
 		}
 		return null;
 	}
 
-	private static final class CreateLibraryDescriptor implements
-			Function<IConfigurationElement, LibraryDescriptor> {
-
-		public LibraryDescriptor apply(IConfigurationElement from) {
-			return new LibraryDescriptor(from);
-		}
-	}
-
 }

+ 5 - 7
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/contentassist/SGenProposalProvider.java

@@ -19,13 +19,11 @@ import org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal;
 import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
 import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
 import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
 import org.yakindu.sct.model.sgen.GeneratorModel;
 
 /**
- * 
  * @author andreas muelder - Initial contribution and API
- * 
  */
 public class SGenProposalProvider extends AbstractSGenProposalProvider {
 
@@ -36,8 +34,8 @@ public class SGenProposalProvider extends AbstractSGenProposalProvider {
 
 		GeneratorModel generatorModel = EcoreUtil2.getContainerOfType(model,
 				GeneratorModel.class);
-		GeneratorDescriptor descriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorModel.getGeneratorId());
+		IGeneratorDescriptor descriptor = GeneratorExtensions
+				.getGeneratorDescriptor(generatorModel.getGeneratorId());
 		if (descriptor == null)
 			return;
 		ICompletionProposal proposal = createCompletionProposal(
@@ -49,9 +47,9 @@ public class SGenProposalProvider extends AbstractSGenProposalProvider {
 	public void completeGeneratorModel_GeneratorId(EObject model,
 			Assignment assignment, ContentAssistContext context,
 			ICompletionProposalAcceptor acceptor) {
-		Iterable<GeneratorDescriptor> descriptions = GeneratorExtensions
+		Iterable<IGeneratorDescriptor> descriptions = GeneratorExtensions
 				.getGeneratorDescriptors();
-		for (GeneratorDescriptor desc : descriptions) {
+		for (IGeneratorDescriptor desc : descriptions) {
 			ICompletionProposal proposal = createCompletionProposal(
 					desc.getId(),
 					new StyledString((desc.getName() != null) ? desc.getName()

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

@@ -23,9 +23,9 @@ 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.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
 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;
 import org.yakindu.sct.model.sgen.FeatureType;
@@ -63,12 +63,12 @@ public class SGenQuickfixProvider extends DefaultQuickfixProvider {
 		GeneratorModel model = (GeneratorModel) EcoreUtil2
 				.getRootContainer(element);
 		
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
 		
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
+		Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions
 				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
-		for (LibraryDescriptor desc : libraryDescriptor) {
+		for (ILibraryDescriptor desc : libraryDescriptor) {
 			ResourceSet set = new ResourceSetImpl();
 			Resource resource = set.getResource(desc.getURI(), true);
 			FeatureTypeLibrary lib = (FeatureTypeLibrary) resource

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

@@ -1,105 +1,105 @@
-/**
- * Copyright (c) 2012 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.generator.genmodel.ui.templates;
-
-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.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.TemplateContext;
-import org.eclipse.jface.text.templates.TemplateProposal;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.xtext.EcoreUtil2;
-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;
-import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-
-import com.google.inject.Inject;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SGenTemplateProposalProvider extends
-		DefaultTemplateProposalProvider {
-
-	@Inject
-	private SGenGrammarAccess gaccess;
-	@Inject
-	private SGenProposalCreator creator;
-
-	private final ContextTypeIdHelper helper;
-
-	@Inject
-	public SGenTemplateProposalProvider(TemplateStore templateStore,
-			ContextTypeRegistry registry, ContextTypeIdHelper helper) {
-		super(templateStore, registry, helper);
-		this.helper = helper;
-	}
-
-	@Override
-	protected void createTemplates(TemplateContext templateContext,
-			ContentAssistContext context, ITemplateAcceptor acceptor) {
-		super.createTemplates(templateContext, context, acceptor);
-
-		String id = helper.getId(gaccess.getFeatureConfigurationRule());
-		if (templateContext.getContextType().getId().equals(id)) {
-			createFeatureConfigurationTemplates(templateContext, context,
-					acceptor);
-		}
-	}
-
-	private void createFeatureConfigurationTemplates(
-			TemplateContext templateContext, ContentAssistContext context,
-			ITemplateAcceptor acceptor) {
-		GeneratorModel model = (GeneratorModel) EcoreUtil2
-				.getRootContainer(context.getCurrentModel());
-
-
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
-		
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
-		
-		for (LibraryDescriptor desc : libraryDescriptor) {
-			ResourceSet set = new ResourceSetImpl();
-			Resource resource = set.getResource(desc.getURI(), true);
-			FeatureTypeLibrary lib = (FeatureTypeLibrary) resource
-					.getContents().get(0);
-			EList<FeatureType> types = lib.getTypes();
-
-			for (FeatureType featureType : types) {
-				Template template = new Template(featureType.getName()
-						+ " feature", "Creates feature "
-						+ featureType.getName(), featureType.getName(),
-						creator.createProposal(featureType,
-								desc.createFeatureValueProvider(),
-								context.getCurrentModel()), false);
-				TemplateProposal proposal = createProposal(template,
-						templateContext, context, getImage(template),
-						getRelevance(template));
-				acceptor.accept(proposal);
-			}
-		}
-	}
-}
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.genmodel.ui.templates;
+
+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.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateProposal;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.xtext.EcoreUtil2;
+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.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
+import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.genmodel.services.SGenGrammarAccess;
+import org.yakindu.sct.model.sgen.FeatureType;
+import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
+import org.yakindu.sct.model.sgen.GeneratorModel;
+
+import com.google.inject.Inject;
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SGenTemplateProposalProvider extends
+		DefaultTemplateProposalProvider {
+
+	@Inject
+	private SGenGrammarAccess gaccess;
+	@Inject
+	private SGenProposalCreator creator;
+
+	private final ContextTypeIdHelper helper;
+
+	@Inject
+	public SGenTemplateProposalProvider(TemplateStore templateStore,
+			ContextTypeRegistry registry, ContextTypeIdHelper helper) {
+		super(templateStore, registry, helper);
+		this.helper = helper;
+	}
+
+	@Override
+	protected void createTemplates(TemplateContext templateContext,
+			ContentAssistContext context, ITemplateAcceptor acceptor) {
+		super.createTemplates(templateContext, context, acceptor);
+
+		String id = helper.getId(gaccess.getFeatureConfigurationRule());
+		if (templateContext.getContextType().getId().equals(id)) {
+			createFeatureConfigurationTemplates(templateContext, context,
+					acceptor);
+		}
+	}
+
+	private void createFeatureConfigurationTemplates(
+			TemplateContext templateContext, ContentAssistContext context,
+			ITemplateAcceptor acceptor) {
+		GeneratorModel model = (GeneratorModel) EcoreUtil2
+				.getRootContainer(context.getCurrentModel());
+
+
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
+		
+		Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
+		for (ILibraryDescriptor desc : libraryDescriptor) {
+			ResourceSet set = new ResourceSetImpl();
+			Resource resource = set.getResource(desc.getURI(), true);
+			FeatureTypeLibrary lib = (FeatureTypeLibrary) resource
+					.getContents().get(0);
+			EList<FeatureType> types = lib.getTypes();
+
+			for (FeatureType featureType : types) {
+				Template template = new Template(featureType.getName()
+						+ " feature", "Creates feature "
+						+ featureType.getName(), featureType.getName(),
+						creator.createProposal(featureType,
+								desc.createFeatureValueProvider(),
+								context.getCurrentModel()), false);
+				TemplateProposal proposal = createProposal(template,
+						templateContext, context, getImage(template),
+						getRelevance(template));
+				acceptor.accept(proposal);
+			}
+		}
+	}
+}

+ 3 - 3
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/CoreGenerator.java

@@ -12,7 +12,7 @@ package org.yakindu.sct.generator.genmodel.ui.wizard;
 
 import java.util.Comparator;
 
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
 
 /**
  * Defines all Generators that are known to be core-generators (provided by
@@ -58,9 +58,9 @@ public enum CoreGenerator {
 	 * Comparator to sort {@link GeneratorDescriptor}s. YAKINDU
 	 * {@link CoreGenerator}s come first.
 	 */
-	public static final Comparator<GeneratorDescriptor> generatorOrder = new Comparator<GeneratorDescriptor>() {
+	public static final Comparator<IGeneratorDescriptor> generatorOrder = new Comparator<IGeneratorDescriptor>() {
 
-		public int compare(GeneratorDescriptor o1, GeneratorDescriptor o2) {
+		public int compare(IGeneratorDescriptor o1, IGeneratorDescriptor o2) {
 			int a = 0;
 			int b = 0;
 			try {

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

@@ -18,9 +18,9 @@ import org.eclipse.emf.ecore.EObject;
 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.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
-import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
 import org.yakindu.sct.model.sgen.FeatureConfiguration;
 import org.yakindu.sct.model.sgen.FeatureType;
@@ -39,11 +39,11 @@ import com.google.common.collect.Lists;
 public class ModelCreator {
 
 	private final SGenFactory factory = SGenFactory.eINSTANCE;
-	private final GeneratorDescriptor descriptor;
+	private final IGeneratorDescriptor descriptor;
 
 	private final List<EObject> eobjects;
 
-	public ModelCreator(GeneratorDescriptor selectedGenerator, List<EObject> objects) {
+	public ModelCreator(IGeneratorDescriptor selectedGenerator, List<EObject> objects) {
 		this.descriptor = selectedGenerator;
 		this.eobjects = objects;
 	}
@@ -72,9 +72,9 @@ public class ModelCreator {
 	}
 
 	private FeatureConfiguration createFeatureConfiguration(EObject object, FeatureType featureType) {
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(descriptor
+		Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(descriptor
 				.getLibraryIDs());
-		for (LibraryDescriptor desc : libraryDescriptor) {
+		for (ILibraryDescriptor desc : libraryDescriptor) {
 			IDefaultFeatureValueProvider defaultProvider = desc.createFeatureValueProvider();
 			if (defaultProvider != null && defaultProvider.isProviderFor(featureType.getLibrary())) {
 				return defaultProvider.createDefaultFeatureConfiguration(featureType, object);
@@ -83,11 +83,11 @@ public class ModelCreator {
 		return null;
 	}
 
-	public static List<FeatureType> getFeatureTypes(GeneratorDescriptor descriptor) {
+	public static List<FeatureType> getFeatureTypes(IGeneratorDescriptor descriptor) {
 		ArrayList<FeatureType> features = Lists.newArrayList();
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(descriptor
+		Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions.getLibraryDescriptors(descriptor
 				.getLibraryIDs());
-		for (LibraryDescriptor desc : libraryDescriptor) {
+		for (ILibraryDescriptor desc : libraryDescriptor) {
 			ResourceSet set = new ResourceSetImpl();
 			Resource resource = set.getResource(desc.getURI(), true);
 			FeatureTypeLibrary lib = (FeatureTypeLibrary) resource.getContents().get(0);

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

@@ -38,7 +38,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.part.FileEditorInput;
 import org.yakindu.sct.builder.nature.SCTNature;
 import org.yakindu.sct.builder.nature.ToggleSCTNatureAction;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
 import org.yakindu.sct.model.sgen.GeneratorModel;
 import org.yakindu.sct.ui.wizards.ModelCreationWizardPage;
 
@@ -131,7 +131,7 @@ public class SGenNewFileWizard extends Wizard implements INewWizard {
 
 	private Resource createDefaultModel(URI uri) {
 		List<EObject> selectedObjects = generatorConfigPage.getSelectedElements();
-		GeneratorDescriptor selectedGenerator = generatorConfigPage.getSelectedGenerator();
+		IGeneratorDescriptor selectedGenerator = generatorConfigPage.getSelectedGenerator();
 		ModelCreator creator = new ModelCreator(selectedGenerator, selectedObjects);
 		GeneratorModel model = creator.create();
 

+ 226 - 225
plugins/org.yakindu.sct.generator.genmodel.ui/src/org/yakindu/sct/generator/genmodel/ui/wizard/SGenWizardPage2.java

@@ -1,225 +1,226 @@
-/**
- * Copyright (c) 2013 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.generator.genmodel.ui.wizard;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.yakindu.sct.generator.core.extensions.FileExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
-import org.yakindu.sct.ui.wizards.ModelCreationWizardPage;
-
-import com.google.common.collect.Lists;
-
-/**
- * 
- * @author holger willebrandt - Initial contribution and API
- * @author andreas muelder - extension point for contribution of file extensions
- *         added
- * @author oliver bohl - changed for more generic
- * 
- */
-public class SGenWizardPage2 extends WizardPage {
-
-	private final static Map<String, CoreGenerator> PROJECT_NATURES = new TreeMap<String, CoreGenerator>();
-	static {
-		PROJECT_NATURES.put("org.eclipse.cdt.core.cnature", CoreGenerator.C);
-		PROJECT_NATURES.put("org.eclipse.cdt.core.ccnature", CoreGenerator.Cpp);
-		PROJECT_NATURES.put(JavaCore.NATURE_ID, CoreGenerator.Java);
-	}
-
-	private ComboViewer generatorCombo;
-
-	protected CheckboxTreeViewer resourceTree;
-
-	private final ModelCreationWizardPage fileSelectionPage;
-
-	@SuppressWarnings("unused")
-	private final IStructuredSelection selection;
-
-	private Label lblNewLabel;
-
-	protected SGenWizardPage2(String pageName, ModelCreationWizardPage fileSelectionPage, IStructuredSelection selection) {
-		super(pageName);
-		this.fileSelectionPage = fileSelectionPage;
-		this.selection = selection;
-	}
-
-	public void createControl(Composite parent) {
-		Composite container = new Composite(parent, SWT.NULL);
-		setControl(container);
-		container.setLayout(new GridLayout(1, false));
-		createGeneratorCombo(container);
-		createObjectTree(container);
-		refreshInput();
-	}
-
-	private void createObjectTree(Composite container) {
-		lblNewLabel = new Label(container, SWT.NONE);
-		lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
-		lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
-
-		resourceTree = new CheckboxTreeViewer(container, SWT.BORDER);
-		resourceTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-
-		resourceTree.setContentProvider(new SGenWizardPage2ContentProvider());
-		resourceTree.setLabelProvider(new SGenWizardPage2LabelProvider());
-
-		TreePropagatingCheckStateListener checkStateListener = new TreePropagatingCheckStateListener(resourceTree) {
-			@Override
-			public void checkStateChanged(CheckStateChangedEvent event) {
-				super.checkStateChanged(event);
-			}
-		};
-		resourceTree.addCheckStateListener(checkStateListener);
-		resourceTree.addDoubleClickListener(new TreeExpandingDoubleClickListener(resourceTree, checkStateListener));
-		resourceTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
-		resourceTree.setFilters(new ViewerFilter[] { new ViewerFilter() {
-			@Override
-			public boolean select(Viewer viewer, Object parentElement, Object element) {
-				// TODO: Filter by common navigator filter instead of supressing
-				// '.' prefixed folder
-				if (element instanceof IFolder) {
-					return !((IFolder) element).getName().startsWith(".");
-				}
-				return true;
-			}
-		} });
-	}
-
-	private void createGeneratorCombo(Composite container) {
-		Label lblGenerator = new Label(container, SWT.NONE);
-		lblGenerator.setText("Generator");
-		generatorCombo = new ComboViewer(container, SWT.READ_ONLY);
-		generatorCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
-		generatorCombo.setLabelProvider(new GeneratorDescriptorLabelProvider());
-		generatorCombo.setContentProvider(new ArrayContentProvider());
-		List<GeneratorDescriptor> descriptors = Lists.newArrayList(GeneratorExtensions.getGeneratorDescriptors());
-		Collections.sort(descriptors, CoreGenerator.generatorOrder);
-		generatorCombo.setInput(descriptors);
-		generatorCombo.getCombo().select(0);
-		generatorCombo.addSelectionChangedListener(new ISelectionChangedListener() {
-			public void selectionChanged(SelectionChangedEvent event) {
-				refreshInput();
-			}
-		});
-	}
-
-	protected void refreshInput() {
-		lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
-		((SGenWizardPage2ContentProvider) resourceTree.getContentProvider()).setFileExtension(FileExtensions
-				.getFileExtension(getSelectedGenerator().getId()));
-		resourceTree.setInput(getSelectedProject());
-	}
-
-	protected IProject getSelectedProject() {
-		IPath containerPath = fileSelectionPage.getFilePath();
-		IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath);
-		return folder.getProject();
-	}
-
-	public List<EObject> getSelectedElements() {
-		List<EObject> selectedElements = Lists.newArrayList();
-		Object[] checkedElements = resourceTree.getCheckedElements();
-		for (Object object : checkedElements) {
-			if (object instanceof IFile) {
-				selectedElements.add(loadReferencedObject((IResource) object));
-			}
-		}
-		return selectedElements;
-	}
-
-	protected EObject loadReferencedObject(IResource resource) {
-		URI uri = URI.createPlatformResourceURI(resource.getFullPath().toString(), true);
-		ResourceSet resourceSet = new ResourceSetImpl();
-		Resource emfResource = resourceSet.getResource(uri, true);
-
-		GeneratorDescriptor desc = getSelectedGenerator();
-		String className = desc.getElementRefType();
-
-		TreeIterator<EObject> content = emfResource.getAllContents();
-		List<EObject> contentList = Lists.newArrayList(content);
-
-		for (EObject obj : contentList) {
-			if (obj.eClass().getInstanceClassName().equals(className))
-				return obj;
-		}
-
-		for (EObject obj : contentList) {
-			List<EClass> superClasses = obj.eClass().getEAllSuperTypes();
-			for (EClass superClass : superClasses) {
-				if (superClass.getInstanceClassName().equals(className)) {
-					return obj;
-				}
-			}
-		}
-		return null;
-	}
-
-	public GeneratorDescriptor getSelectedGenerator() {
-		return (GeneratorDescriptor) ((StructuredSelection) generatorCombo.getSelection()).getFirstElement();
-	}
-
-	private static class GeneratorDescriptorLabelProvider extends LabelProvider {
-
-		@Override
-		public String getText(Object element) {
-			if (element instanceof GeneratorDescriptor) {
-				return ((GeneratorDescriptor) element).getName();
-			}
-			return super.getText(element);
-		}
-
-		@Override
-		public Image getImage(Object element) {
-			if (element instanceof GeneratorDescriptor) {
-				return ((GeneratorDescriptor) element).getImage();
-			}
-			return super.getImage(element);
-		}
-	}
-}
+/**
+ * Copyright (c) 2013 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.generator.genmodel.ui.wizard;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.yakindu.sct.generator.core.extensions.FileExtensions;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
+import org.yakindu.sct.ui.wizards.ModelCreationWizardPage;
+
+import com.google.common.collect.Lists;
+
+/**
+ * 
+ * @author holger willebrandt - Initial contribution and API
+ * @author andreas muelder - extension point for contribution of file extensions
+ *         added
+ * @author oliver bohl - changed for more generic
+ * 
+ */
+public class SGenWizardPage2 extends WizardPage {
+
+	private final static Map<String, CoreGenerator> PROJECT_NATURES = new TreeMap<String, CoreGenerator>();
+	static {
+		PROJECT_NATURES.put("org.eclipse.cdt.core.cnature", CoreGenerator.C);
+		PROJECT_NATURES.put("org.eclipse.cdt.core.ccnature", CoreGenerator.Cpp);
+		PROJECT_NATURES.put(JavaCore.NATURE_ID, CoreGenerator.Java);
+	}
+
+	private ComboViewer generatorCombo;
+
+	protected CheckboxTreeViewer resourceTree;
+
+	private final ModelCreationWizardPage fileSelectionPage;
+
+	@SuppressWarnings("unused")
+	private final IStructuredSelection selection;
+
+	private Label lblNewLabel;
+
+	protected SGenWizardPage2(String pageName, ModelCreationWizardPage fileSelectionPage,
+			IStructuredSelection selection) {
+		super(pageName);
+		this.fileSelectionPage = fileSelectionPage;
+		this.selection = selection;
+	}
+
+	public void createControl(Composite parent) {
+		Composite container = new Composite(parent, SWT.NULL);
+		setControl(container);
+		container.setLayout(new GridLayout(1, false));
+		createGeneratorCombo(container);
+		createObjectTree(container);
+		refreshInput();
+	}
+
+	private void createObjectTree(Composite container) {
+		lblNewLabel = new Label(container, SWT.NONE);
+		lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
+		lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
+
+		resourceTree = new CheckboxTreeViewer(container, SWT.BORDER);
+		resourceTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+		resourceTree.setContentProvider(new SGenWizardPage2ContentProvider());
+		resourceTree.setLabelProvider(new SGenWizardPage2LabelProvider());
+
+		TreePropagatingCheckStateListener checkStateListener = new TreePropagatingCheckStateListener(resourceTree) {
+			@Override
+			public void checkStateChanged(CheckStateChangedEvent event) {
+				super.checkStateChanged(event);
+			}
+		};
+		resourceTree.addCheckStateListener(checkStateListener);
+		resourceTree.addDoubleClickListener(new TreeExpandingDoubleClickListener(resourceTree, checkStateListener));
+		resourceTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
+		resourceTree.setFilters(new ViewerFilter[]{new ViewerFilter() {
+			@Override
+			public boolean select(Viewer viewer, Object parentElement, Object element) {
+				// TODO: Filter by common navigator filter instead of supressing
+				// '.' prefixed folder
+				if (element instanceof IFolder) {
+					return !((IFolder) element).getName().startsWith(".");
+				}
+				return true;
+			}
+		}});
+	}
+
+	private void createGeneratorCombo(Composite container) {
+		Label lblGenerator = new Label(container, SWT.NONE);
+		lblGenerator.setText("Generator");
+		generatorCombo = new ComboViewer(container, SWT.READ_ONLY);
+		generatorCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+		generatorCombo.setLabelProvider(new GeneratorDescriptorLabelProvider());
+		generatorCombo.setContentProvider(new ArrayContentProvider());
+		List<IGeneratorDescriptor> descriptors = Lists.newArrayList(GeneratorExtensions.getGeneratorDescriptors());
+		Collections.sort(descriptors, CoreGenerator.generatorOrder);
+		generatorCombo.setInput(descriptors);
+		generatorCombo.getCombo().select(0);
+		generatorCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+			public void selectionChanged(SelectionChangedEvent event) {
+				refreshInput();
+			}
+		});
+	}
+
+	protected void refreshInput() {
+		lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
+		((SGenWizardPage2ContentProvider) resourceTree.getContentProvider())
+				.setFileExtension(FileExtensions.getFileExtension(getSelectedGenerator().getId()));
+		resourceTree.setInput(getSelectedProject());
+	}
+
+	protected IProject getSelectedProject() {
+		IPath containerPath = fileSelectionPage.getFilePath();
+		IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath);
+		return folder.getProject();
+	}
+
+	public List<EObject> getSelectedElements() {
+		List<EObject> selectedElements = Lists.newArrayList();
+		Object[] checkedElements = resourceTree.getCheckedElements();
+		for (Object object : checkedElements) {
+			if (object instanceof IFile) {
+				selectedElements.add(loadReferencedObject((IResource) object));
+			}
+		}
+		return selectedElements;
+	}
+
+	protected EObject loadReferencedObject(IResource resource) {
+		URI uri = URI.createPlatformResourceURI(resource.getFullPath().toString(), true);
+		ResourceSet resourceSet = new ResourceSetImpl();
+		Resource emfResource = resourceSet.getResource(uri, true);
+
+		IGeneratorDescriptor desc = getSelectedGenerator();
+		String className = desc.getElementRefType();
+
+		TreeIterator<EObject> content = emfResource.getAllContents();
+		List<EObject> contentList = Lists.newArrayList(content);
+
+		for (EObject obj : contentList) {
+			if (obj.eClass().getInstanceClassName().equals(className))
+				return obj;
+		}
+
+		for (EObject obj : contentList) {
+			List<EClass> superClasses = obj.eClass().getEAllSuperTypes();
+			for (EClass superClass : superClasses) {
+				if (superClass.getInstanceClassName().equals(className)) {
+					return obj;
+				}
+			}
+		}
+		return null;
+	}
+
+	public IGeneratorDescriptor getSelectedGenerator() {
+		return (IGeneratorDescriptor) ((StructuredSelection) generatorCombo.getSelection()).getFirstElement();
+	}
+
+	private static class GeneratorDescriptorLabelProvider extends LabelProvider {
+
+		@Override
+		public String getText(Object element) {
+			if (element instanceof IGeneratorDescriptor) {
+				return ((IGeneratorDescriptor) element).getName();
+			}
+			return super.getText(element);
+		}
+
+		@Override
+		public Image getImage(Object element) {
+			if (element instanceof IGeneratorDescriptor) {
+				return ((IGeneratorDescriptor) element).getImage();
+			}
+			return super.getImage(element);
+		}
+	}
+}

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

@@ -21,7 +21,7 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.IDE;
 import org.yakindu.sct.generator.core.extensions.FileExtensions;
 import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
 
 /**
  * 
@@ -38,7 +38,7 @@ class SGenWizardPage2LabelProvider extends LabelProvider {
 			return PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
 		} else if (element instanceof IFile) {
 			String generatorID = FileExtensions.getGeneratorForFileExtension(((IFile) element).getFileExtension());
-			GeneratorDescriptor genDesc = GeneratorExtensions.getGeneratorDescriptorForId(generatorID);
+			IGeneratorDescriptor genDesc = GeneratorExtensions.getGeneratorDescriptor(generatorID);
 			return genDesc.getImage();
 		}
 		return super.getImage(element);

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

@@ -25,9 +25,9 @@ import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
 import org.eclipse.xtext.scoping.impl.FilteringScope;
 import org.eclipse.xtext.scoping.impl.SimpleScope;
 import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
 import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
-import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
 import org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription;
 import org.yakindu.sct.model.sgen.FeatureConfiguration;
 import org.yakindu.sct.model.sgen.GeneratorModel;
@@ -71,8 +71,8 @@ public class SGenScopeProvider extends AbstractDeclarativeScopeProvider {
 		GeneratorModel generatorModel = (GeneratorModel) EcoreUtil2
 				.getRootContainer(context);
 		String id = generatorModel.getGeneratorId();
-		final GeneratorDescriptor desc = GeneratorExtensions
-				.getGeneratorDescriptorForId(id);
+		final IGeneratorDescriptor desc = GeneratorExtensions
+				.getGeneratorDescriptor(id);
 		if (desc == null)
 			return IScope.NULLSCOPE;
 		final String elementRefType = desc.getElementRefType();
@@ -138,16 +138,16 @@ public class SGenScopeProvider extends AbstractDeclarativeScopeProvider {
 		Assert.isNotNull(generatorModel);
 		String generatorId = generatorModel.getGeneratorId();
 
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorId);
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(generatorId);
 
 		Iterable<IEObjectDescription> allElements = Lists.newArrayList();
 
 		if (generatorDescriptor != null) {
-			Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
+			Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions
 					.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
 
-			for (LibraryDescriptor desc : libraryDescriptor) {
+			for (ILibraryDescriptor desc : libraryDescriptor) {
 				Resource library = resourceSet.getResource(desc.getURI(), true);
 				FeatureResourceDescription description = new FeatureResourceDescription(
 						library);

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

@@ -1,369 +1,369 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.generator.genmodel.validation;
-
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.xtext.EcoreUtil2;
-import org.eclipse.xtext.validation.Check;
-import org.yakindu.base.base.NamedElement;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
-import org.yakindu.sct.generator.core.extensions.GeneratorExtensions.GeneratorDescriptor;
-import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
-import org.yakindu.sct.generator.core.extensions.LibraryExtensions.LibraryDescriptor;
-import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
-import org.yakindu.sct.model.sgen.BoolLiteral;
-import org.yakindu.sct.model.sgen.DeprecatableElement;
-import org.yakindu.sct.model.sgen.FeatureConfiguration;
-import org.yakindu.sct.model.sgen.FeatureParameter;
-import org.yakindu.sct.model.sgen.FeatureParameterValue;
-import org.yakindu.sct.model.sgen.FeatureType;
-import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
-import org.yakindu.sct.model.sgen.GeneratorEntry;
-import org.yakindu.sct.model.sgen.GeneratorModel;
-import org.yakindu.sct.model.sgen.IntLiteral;
-import org.yakindu.sct.model.sgen.Literal;
-import org.yakindu.sct.model.sgen.ParameterTypes;
-import org.yakindu.sct.model.sgen.RealLiteral;
-import org.yakindu.sct.model.sgen.SGenPackage;
-import org.yakindu.sct.model.sgen.StringLiteral;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SGenJavaValidator extends AbstractSGenJavaValidator {
-
-	// Error messages
-	public static final String MISSING_REQUIRED_PARAMETER = "Missing required Parameter";
-	public static final String MISSING_REQUIRED_FEATURE = "Missing required feature";
-	public static final String DUPLICATE_PARAMETER = "Duplicate parameter!";
-	public static final String DUPLICATE_FEATURE = "Duplicate feature!";
-	public static final String UNKOWN_GENERATOR = "Unkown Generator";
-	public static final String INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED = "Incompatible type, Boolean expected";
-	public static final String INCOMPATIBLE_TYPE_INTEGER_EXPECTED = "Incompatible type, Integer expected";
-	public static final String INCOMPATIBLE_TYPE_FLOAT_EXPECTED = "Incompatible type, Float expected";
-	public static final String INCOMPATIBLE_TYPE_STRING_EXPECTED = "Incompatible type, String expected";
-	public static final String UNKNOWN_CONTENT_TYPE = "Unknown content type '";
-	public static final String DEPRECATED = "Element is depricated";
-	// Failure codes
-	public static final String CODE_REQUIRED_FEATURE = "code_req_feature";
-
-	@Check
-	public void checkContentType(GeneratorEntry entry) {
-		GeneratorModel generatorModel = EcoreUtil2.getContainerOfType(entry,
-				GeneratorModel.class);
-		GeneratorDescriptor descriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorModel.getGeneratorId());
-		if (descriptor == null)
-			return;
-		String contentType = entry.getContentType();
-		if (contentType == null || contentType.trim().length() == 0) {
-			return;
-		}
-		if (!contentType.equals(descriptor.getContentType())) {
-			error(UNKNOWN_CONTENT_TYPE + contentType + "'",
-					SGenPackage.Literals.GENERATOR_ENTRY__CONTENT_TYPE);
-		}
-	}
-
-	@Check
-	public void checkParameterValueType(
-			final FeatureParameterValue parameterValue) {
-		if (parameterValue == null || parameterValue.getExpression() == null)
-			return;
-		Literal value = parameterValue.getExpression();
-		ParameterTypes parameterType = parameterValue.getParameter()
-				.getParameterType();
-		switch (parameterType) {
-		case BOOLEAN:
-			if (!(value instanceof BoolLiteral))
-				error(INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED,
-						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-			break;
-		case INTEGER:
-			if (!(value instanceof IntLiteral))
-				error(INCOMPATIBLE_TYPE_INTEGER_EXPECTED,
-						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-			break;
-		case FLOAT:
-			if (!(value instanceof RealLiteral))
-				error(INCOMPATIBLE_TYPE_FLOAT_EXPECTED,
-						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-			break;
-		case STRING:
-			if (!(value instanceof StringLiteral))
-				error(INCOMPATIBLE_TYPE_STRING_EXPECTED,
-						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-			break;
-		}
-	}
-
-	@Check
-	public void checkParameterValue(final FeatureParameterValue value) {
-		if (value.getExpression() == null || value.getExpression() == null)
-			return;
-		GeneratorModel model = (GeneratorModel) EcoreUtil2
-				.getRootContainer(value);
-
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
-
-		IDefaultFeatureValueProvider provider = LibraryExtensions
-				.getDefaultFeatureValueProvider(
-						generatorDescriptor.getLibraryIDs(), value
-								.getParameter().getFeatureType().getLibrary());
-		IStatus status = provider.validateParameterValue(value);
-		createMarker(status);
-	}
-
-	private void createMarker(IStatus status) {
-		switch (status.getSeverity()) {
-		case IStatus.ERROR:
-			super.error(status.getMessage(),
-					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-			break;
-		case IStatus.WARNING:
-			super.warning(status.getMessage(),
-					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
-		}
-	}
-
-	@Check
-	public void checkGeneratorExists(GeneratorModel model) {
-		GeneratorDescriptor descriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
-		if (descriptor == null) {
-			error(String.format(UNKOWN_GENERATOR + " %s!",
-					model.getGeneratorId()),
-					SGenPackage.Literals.GENERATOR_MODEL__GENERATOR_ID);
-		}
-	}
-
-	@Check
-	public void checkDuplicateGeneratorEntryFeature(
-			final FeatureConfiguration config) {
-		GeneratorEntry entry = (GeneratorEntry) config.eContainer();
-		Iterable<FeatureConfiguration> filter = Iterables.filter(
-				entry.getFeatures(), new Predicate<FeatureConfiguration>() {
-					public boolean apply(FeatureConfiguration input) {
-						return (input.getType().getName().equals(config
-								.getType().getName()));
-					}
-				});
-		if (Iterables.size(filter) > 1) {
-			error(DUPLICATE_FEATURE,
-					SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
-		}
-
-	}
-
-	@Check
-	public void checkDuplicateFeatureParameter(final FeatureParameterValue value) {
-		FeatureConfiguration entry = (FeatureConfiguration) value.eContainer();
-		Iterable<FeatureParameterValue> filter = Iterables.filter(
-				entry.getParameterValues(),
-				new Predicate<FeatureParameterValue>() {
-					public boolean apply(FeatureParameterValue input) {
-						return (input.getParameter().getName().equals(value
-								.getParameter().getName()));
-					}
-				});
-		if (Iterables.size(filter) > 1) {
-			error(DUPLICATE_PARAMETER,
-					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__PARAMETER);
-		}
-	}
-
-	@Check
-	public void checkRequiredFeatures(GeneratorEntry entry) {
-		GeneratorModel model = (GeneratorModel) EcoreUtil2
-				.getRootContainer(entry);
-
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
-
-		Iterable<LibraryDescriptor> libraryDescriptors = LibraryExtensions
-				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
-
-		Iterable<FeatureType> requiredFeatures = filter(
-				concat(transform(
-						transform(libraryDescriptors, getFeatureTypeLibrary()),
-						getFeatureTypes())), isRequired());
-		List<String> configuredTypes = Lists.newArrayList();
-		for (FeatureConfiguration featureConfiguration : entry.getFeatures()) {
-			configuredTypes.add(featureConfiguration.getType().getName());
-		}
-		for (FeatureType featureType : requiredFeatures) {
-			if (!configuredTypes.contains(featureType.getName()))
-				error(String.format(MISSING_REQUIRED_FEATURE + " %s",
-						featureType.getName()),
-						SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
-						CODE_REQUIRED_FEATURE, featureType.getName());
-		}
-	}
-
-	@Check
-	public void checkDeprecatedFeatures(GeneratorEntry entry) {
-		Iterable<FeatureConfiguration> features = entry.getFeatures();
-		Iterable<FeatureType> deprecatedFeatures = filter(
-				transform(features, getFeatureType()), isDeprecated());
-		for (FeatureType feature : deprecatedFeatures) {
-			warning(String.format(DEPRECATED + " %s : %s", feature.getName(),
-					feature.getComment()),
-					SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
-					feature.getName());
-		}
-	}
-
-	@Check
-	public void checkRequiredParameters(FeatureConfiguration configuration) {
-		GeneratorModel model = (GeneratorModel) EcoreUtil2
-				.getRootContainer(configuration);
-
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(model.getGeneratorId());
-
-		Iterable<LibraryDescriptor> libraryDescriptors = LibraryExtensions
-				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
-
-		Iterable<String> requiredParameters = transform(
-				filter(concat(transform(
-						filter(concat(transform(
-								transform(libraryDescriptors,
-										getFeatureTypeLibrary()),
-								getFeatureTypes())), hasName(configuration
-								.getType().getName())), getParmeter())),
-						isRequiredParamter()), getName());
-
-		List<String> configuredParameters = Lists.newArrayList();
-
-		for (FeatureParameterValue featureParameterValue : configuration
-				.getParameterValues()) {
-			configuredParameters.add(featureParameterValue.getParameter()
-					.getName());
-		}
-		for (String string : requiredParameters) {
-			if (!configuredParameters.contains(string))
-				error(String.format(MISSING_REQUIRED_PARAMETER + " %s", string),
-						SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
-		}
-	}
-
-	@Check
-	public void checkDeprecatedParameters(GeneratorEntry entry) {
-		Iterable<FeatureParameter> deprecatedParameters = filter(
-				concat(transform(
-						transform(entry.getFeatures(), getFeatureType()),
-						getParmeter())), isDeprecated());
-		for (FeatureParameter parameter : deprecatedParameters) {
-			warning(String.format(DEPRECATED + " %s : %s", parameter.getName(),
-					parameter.getComment()),
-					SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
-					parameter.getName());
-		}
-	}
-
-	private Function<NamedElement, String> getName() {
-		return new Function<NamedElement, String>() {
-
-			public String apply(NamedElement from) {
-				return from.getName();
-			}
-		};
-	}
-
-	private Predicate<FeatureParameter> isRequiredParamter() {
-		return new Predicate<FeatureParameter>() {
-
-			public boolean apply(FeatureParameter input) {
-				return !input.isOptional();
-			}
-		};
-	}
-
-	private Predicate<DeprecatableElement> isDeprecated() {
-		return new Predicate<DeprecatableElement>() {
-			public boolean apply(DeprecatableElement input) {
-				return input.isDeprecated();
-			}
-		};
-	}
-
-	private Function<FeatureType, Iterable<FeatureParameter>> getParmeter() {
-		return new Function<FeatureType, Iterable<FeatureParameter>>() {
-
-			public Iterable<FeatureParameter> apply(FeatureType from) {
-				return from.getParameters();
-			}
-		};
-	}
-
-	private Predicate<NamedElement> hasName(final String name) {
-		return new Predicate<NamedElement>() {
-
-			public boolean apply(NamedElement input) {
-				if (name == null) {
-					return (input == null);
-				}
-				return name.equals(input.getName());
-			}
-		};
-	}
-
-	private static Predicate<FeatureType> isRequired() {
-		return new Predicate<FeatureType>() {
-
-			public boolean apply(FeatureType input) {
-				return !input.isOptional();
-			}
-		};
-	}
-
-	private static Function<FeatureTypeLibrary, Iterable<FeatureType>> getFeatureTypes() {
-		return new Function<FeatureTypeLibrary, Iterable<FeatureType>>() {
-
-			public Iterable<FeatureType> apply(FeatureTypeLibrary from) {
-				return from.getTypes();
-			}
-		};
-	}
-
-	private static Function<LibraryDescriptor, FeatureTypeLibrary> getFeatureTypeLibrary() {
-		return new Function<LibraryExtensions.LibraryDescriptor, FeatureTypeLibrary>() {
-
-			public FeatureTypeLibrary apply(LibraryDescriptor from) {
-				return (FeatureTypeLibrary) new ResourceSetImpl()
-						.getResource(from.getURI(), true).getContents().get(0);
-			}
-		};
-	}
-
-	private static Function<FeatureConfiguration, FeatureType> getFeatureType() {
-		return new Function<FeatureConfiguration, FeatureType>() {
-			public FeatureType apply(FeatureConfiguration input) {
-				return input.getType();
-			}
-		};
-	}
-}
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.generator.genmodel.validation;
+
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.xtext.EcoreUtil2;
+import org.eclipse.xtext.validation.Check;
+import org.yakindu.base.base.NamedElement;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
+import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.core.features.IDefaultFeatureValueProvider;
+import org.yakindu.sct.model.sgen.BoolLiteral;
+import org.yakindu.sct.model.sgen.DeprecatableElement;
+import org.yakindu.sct.model.sgen.FeatureConfiguration;
+import org.yakindu.sct.model.sgen.FeatureParameter;
+import org.yakindu.sct.model.sgen.FeatureParameterValue;
+import org.yakindu.sct.model.sgen.FeatureType;
+import org.yakindu.sct.model.sgen.FeatureTypeLibrary;
+import org.yakindu.sct.model.sgen.GeneratorEntry;
+import org.yakindu.sct.model.sgen.GeneratorModel;
+import org.yakindu.sct.model.sgen.IntLiteral;
+import org.yakindu.sct.model.sgen.Literal;
+import org.yakindu.sct.model.sgen.ParameterTypes;
+import org.yakindu.sct.model.sgen.RealLiteral;
+import org.yakindu.sct.model.sgen.SGenPackage;
+import org.yakindu.sct.model.sgen.StringLiteral;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SGenJavaValidator extends AbstractSGenJavaValidator {
+
+	// Error messages
+	public static final String MISSING_REQUIRED_PARAMETER = "Missing required Parameter";
+	public static final String MISSING_REQUIRED_FEATURE = "Missing required feature";
+	public static final String DUPLICATE_PARAMETER = "Duplicate parameter!";
+	public static final String DUPLICATE_FEATURE = "Duplicate feature!";
+	public static final String UNKOWN_GENERATOR = "Unkown Generator";
+	public static final String INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED = "Incompatible type, Boolean expected";
+	public static final String INCOMPATIBLE_TYPE_INTEGER_EXPECTED = "Incompatible type, Integer expected";
+	public static final String INCOMPATIBLE_TYPE_FLOAT_EXPECTED = "Incompatible type, Float expected";
+	public static final String INCOMPATIBLE_TYPE_STRING_EXPECTED = "Incompatible type, String expected";
+	public static final String UNKNOWN_CONTENT_TYPE = "Unknown content type '";
+	public static final String DEPRECATED = "Element is depricated";
+	// Failure codes
+	public static final String CODE_REQUIRED_FEATURE = "code_req_feature";
+
+	@Check
+	public void checkContentType(GeneratorEntry entry) {
+		GeneratorModel generatorModel = EcoreUtil2.getContainerOfType(entry,
+				GeneratorModel.class);
+		IGeneratorDescriptor descriptor = GeneratorExtensions
+				.getGeneratorDescriptor(generatorModel.getGeneratorId());
+		if (descriptor == null)
+			return;
+		String contentType = entry.getContentType();
+		if (contentType == null || contentType.trim().length() == 0) {
+			return;
+		}
+		if (!contentType.equals(descriptor.getContentType())) {
+			error(UNKNOWN_CONTENT_TYPE + contentType + "'",
+					SGenPackage.Literals.GENERATOR_ENTRY__CONTENT_TYPE);
+		}
+	}
+
+	@Check
+	public void checkParameterValueType(
+			final FeatureParameterValue parameterValue) {
+		if (parameterValue == null || parameterValue.getExpression() == null)
+			return;
+		Literal value = parameterValue.getExpression();
+		ParameterTypes parameterType = parameterValue.getParameter()
+				.getParameterType();
+		switch (parameterType) {
+		case BOOLEAN:
+			if (!(value instanceof BoolLiteral))
+				error(INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED,
+						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+			break;
+		case INTEGER:
+			if (!(value instanceof IntLiteral))
+				error(INCOMPATIBLE_TYPE_INTEGER_EXPECTED,
+						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+			break;
+		case FLOAT:
+			if (!(value instanceof RealLiteral))
+				error(INCOMPATIBLE_TYPE_FLOAT_EXPECTED,
+						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+			break;
+		case STRING:
+			if (!(value instanceof StringLiteral))
+				error(INCOMPATIBLE_TYPE_STRING_EXPECTED,
+						SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+			break;
+		}
+	}
+
+	@Check
+	public void checkParameterValue(final FeatureParameterValue value) {
+		if (value.getExpression() == null || value.getExpression() == null)
+			return;
+		GeneratorModel model = (GeneratorModel) EcoreUtil2
+				.getRootContainer(value);
+
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
+
+		IDefaultFeatureValueProvider provider = LibraryExtensions
+				.getDefaultFeatureValueProvider(
+						generatorDescriptor.getLibraryIDs(), value
+								.getParameter().getFeatureType().getLibrary());
+		IStatus status = provider.validateParameterValue(value);
+		createMarker(status);
+	}
+
+	private void createMarker(IStatus status) {
+		switch (status.getSeverity()) {
+		case IStatus.ERROR:
+			super.error(status.getMessage(),
+					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+			break;
+		case IStatus.WARNING:
+			super.warning(status.getMessage(),
+					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__EXPRESSION);
+		}
+	}
+
+	@Check
+	public void checkGeneratorExists(GeneratorModel model) {
+		IGeneratorDescriptor descriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
+		if (descriptor == null) {
+			error(String.format(UNKOWN_GENERATOR + " %s!",
+					model.getGeneratorId()),
+					SGenPackage.Literals.GENERATOR_MODEL__GENERATOR_ID);
+		}
+	}
+
+	@Check
+	public void checkDuplicateGeneratorEntryFeature(
+			final FeatureConfiguration config) {
+		GeneratorEntry entry = (GeneratorEntry) config.eContainer();
+		Iterable<FeatureConfiguration> filter = Iterables.filter(
+				entry.getFeatures(), new Predicate<FeatureConfiguration>() {
+					public boolean apply(FeatureConfiguration input) {
+						return (input.getType().getName().equals(config
+								.getType().getName()));
+					}
+				});
+		if (Iterables.size(filter) > 1) {
+			error(DUPLICATE_FEATURE,
+					SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
+		}
+
+	}
+
+	@Check
+	public void checkDuplicateFeatureParameter(final FeatureParameterValue value) {
+		FeatureConfiguration entry = (FeatureConfiguration) value.eContainer();
+		Iterable<FeatureParameterValue> filter = Iterables.filter(
+				entry.getParameterValues(),
+				new Predicate<FeatureParameterValue>() {
+					public boolean apply(FeatureParameterValue input) {
+						return (input.getParameter().getName().equals(value
+								.getParameter().getName()));
+					}
+				});
+		if (Iterables.size(filter) > 1) {
+			error(DUPLICATE_PARAMETER,
+					SGenPackage.Literals.FEATURE_PARAMETER_VALUE__PARAMETER);
+		}
+	}
+
+	@Check
+	public void checkRequiredFeatures(GeneratorEntry entry) {
+		GeneratorModel model = (GeneratorModel) EcoreUtil2
+				.getRootContainer(entry);
+
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
+
+		Iterable<ILibraryDescriptor> libraryDescriptors = LibraryExtensions
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+
+		Iterable<FeatureType> requiredFeatures = filter(
+				concat(transform(
+						transform(libraryDescriptors, getFeatureTypeLibrary()),
+						getFeatureTypes())), isRequired());
+		List<String> configuredTypes = Lists.newArrayList();
+		for (FeatureConfiguration featureConfiguration : entry.getFeatures()) {
+			configuredTypes.add(featureConfiguration.getType().getName());
+		}
+		for (FeatureType featureType : requiredFeatures) {
+			if (!configuredTypes.contains(featureType.getName()))
+				error(String.format(MISSING_REQUIRED_FEATURE + " %s",
+						featureType.getName()),
+						SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
+						CODE_REQUIRED_FEATURE, featureType.getName());
+		}
+	}
+
+	@Check
+	public void checkDeprecatedFeatures(GeneratorEntry entry) {
+		Iterable<FeatureConfiguration> features = entry.getFeatures();
+		Iterable<FeatureType> deprecatedFeatures = filter(
+				transform(features, getFeatureType()), isDeprecated());
+		for (FeatureType feature : deprecatedFeatures) {
+			warning(String.format(DEPRECATED + " %s : %s", feature.getName(),
+					feature.getComment()),
+					SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
+					feature.getName());
+		}
+	}
+
+	@Check
+	public void checkRequiredParameters(FeatureConfiguration configuration) {
+		GeneratorModel model = (GeneratorModel) EcoreUtil2
+				.getRootContainer(configuration);
+
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(model.getGeneratorId());
+
+		Iterable<ILibraryDescriptor> libraryDescriptors = LibraryExtensions
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+
+		Iterable<String> requiredParameters = transform(
+				filter(concat(transform(
+						filter(concat(transform(
+								transform(libraryDescriptors,
+										getFeatureTypeLibrary()),
+								getFeatureTypes())), hasName(configuration
+								.getType().getName())), getParmeter())),
+						isRequiredParamter()), getName());
+
+		List<String> configuredParameters = Lists.newArrayList();
+
+		for (FeatureParameterValue featureParameterValue : configuration
+				.getParameterValues()) {
+			configuredParameters.add(featureParameterValue.getParameter()
+					.getName());
+		}
+		for (String string : requiredParameters) {
+			if (!configuredParameters.contains(string))
+				error(String.format(MISSING_REQUIRED_PARAMETER + " %s", string),
+						SGenPackage.Literals.FEATURE_CONFIGURATION__TYPE);
+		}
+	}
+
+	@Check
+	public void checkDeprecatedParameters(GeneratorEntry entry) {
+		Iterable<FeatureParameter> deprecatedParameters = filter(
+				concat(transform(
+						transform(entry.getFeatures(), getFeatureType()),
+						getParmeter())), isDeprecated());
+		for (FeatureParameter parameter : deprecatedParameters) {
+			warning(String.format(DEPRECATED + " %s : %s", parameter.getName(),
+					parameter.getComment()),
+					SGenPackage.Literals.GENERATOR_ENTRY__ELEMENT_REF,
+					parameter.getName());
+		}
+	}
+
+	private Function<NamedElement, String> getName() {
+		return new Function<NamedElement, String>() {
+
+			public String apply(NamedElement from) {
+				return from.getName();
+			}
+		};
+	}
+
+	private Predicate<FeatureParameter> isRequiredParamter() {
+		return new Predicate<FeatureParameter>() {
+
+			public boolean apply(FeatureParameter input) {
+				return !input.isOptional();
+			}
+		};
+	}
+
+	private Predicate<DeprecatableElement> isDeprecated() {
+		return new Predicate<DeprecatableElement>() {
+			public boolean apply(DeprecatableElement input) {
+				return input.isDeprecated();
+			}
+		};
+	}
+
+	private Function<FeatureType, Iterable<FeatureParameter>> getParmeter() {
+		return new Function<FeatureType, Iterable<FeatureParameter>>() {
+
+			public Iterable<FeatureParameter> apply(FeatureType from) {
+				return from.getParameters();
+			}
+		};
+	}
+
+	private Predicate<NamedElement> hasName(final String name) {
+		return new Predicate<NamedElement>() {
+
+			public boolean apply(NamedElement input) {
+				if (name == null) {
+					return (input == null);
+				}
+				return name.equals(input.getName());
+			}
+		};
+	}
+
+	private static Predicate<FeatureType> isRequired() {
+		return new Predicate<FeatureType>() {
+
+			public boolean apply(FeatureType input) {
+				return !input.isOptional();
+			}
+		};
+	}
+
+	private static Function<FeatureTypeLibrary, Iterable<FeatureType>> getFeatureTypes() {
+		return new Function<FeatureTypeLibrary, Iterable<FeatureType>>() {
+
+			public Iterable<FeatureType> apply(FeatureTypeLibrary from) {
+				return from.getTypes();
+			}
+		};
+	}
+
+	private static Function<ILibraryDescriptor, FeatureTypeLibrary> getFeatureTypeLibrary() {
+		return new Function<ILibraryDescriptor, FeatureTypeLibrary>() {
+
+			public FeatureTypeLibrary apply(ILibraryDescriptor from) {
+				return (FeatureTypeLibrary) new ResourceSetImpl()
+						.getResource(from.getURI(), true).getContents().get(0);
+			}
+		};
+	}
+
+	private static Function<FeatureConfiguration, FeatureType> getFeatureType() {
+		return new Function<FeatureConfiguration, FeatureType>() {
+			public FeatureType apply(FeatureConfiguration input) {
+				return input.getType();
+			}
+		};
+	}
+}

+ 67 - 67
plugins/org.yakindu.sct.model.resource/src/org/yakindu/sct/model/resource/SCTResourceFactory.java

@@ -1,67 +1,67 @@
-/**
- * Copyright (c) 2015 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.model.resource;
-
-import java.io.IOException;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.yakindu.sct.domain.extension.DomainRegistry;
-import org.yakindu.sct.domain.extension.DomainRegistry.DomainDescriptor;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.sgraph.Statechart;
-
-import com.google.inject.Injector;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class SCTResourceFactory extends XMIResourceFactoryImpl {
-
-	@Override
-	public Resource createResource(URI uri) {
-		String domainID = determineDomainID(uri);
-		DomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(domainID);
-		Injector injector = domainDescriptor.getDomainInjectorProvider().getResourceInjector();
-		Resource resource = injector.getInstance(Resource.class);
-		ResourceSet set = new ResourceSetImpl();
-		set.getResources().add(resource);
-		resource.setURI(uri);
-		return resource;
-	}
-
-	protected String determineDomainID(URI uri) {
-		String result = SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral();
-		if (URIConverter.INSTANCE.exists(uri, null)) {
-			XMIResource resource = new XMIResourceImpl(uri);
-			try {
-				resource.load(null);
-				Statechart statechart = (Statechart) EcoreUtil.getObjectByType(resource.getContents(),
-						SGraphPackage.Literals.STATECHART);
-				result = statechart.getDomainID();
-			} catch (IOException e) {
-				e.printStackTrace();
-			} finally {
-				resource.unload();
-			}
-		}
-		return result;
-	}
-}
+/**
+ * Copyright (c) 2015 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.model.resource;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.yakindu.sct.domain.extension.DomainRegistry;
+import org.yakindu.sct.domain.extension.IDomainDescriptor;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.model.sgraph.Statechart;
+
+import com.google.inject.Injector;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SCTResourceFactory extends XMIResourceFactoryImpl {
+
+	@Override
+	public Resource createResource(URI uri) {
+		String domainID = determineDomainID(uri);
+		IDomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(domainID);
+		Injector injector = domainDescriptor.getDomainInjectorProvider().getResourceInjector();
+		Resource resource = injector.getInstance(Resource.class);
+		ResourceSet set = new ResourceSetImpl();
+		set.getResources().add(resource);
+		resource.setURI(uri);
+		return resource;
+	}
+
+	protected String determineDomainID(URI uri) {
+		String result = SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral();
+		if (URIConverter.INSTANCE.exists(uri, null)) {
+			XMIResource resource = new XMIResourceImpl(uri);
+			try {
+				resource.load(null);
+				Statechart statechart = (Statechart) EcoreUtil.getObjectByType(resource.getContents(),
+						SGraphPackage.Literals.STATECHART);
+				result = statechart.getDomainID();
+			} catch (IOException e) {
+				e.printStackTrace();
+			} finally {
+				resource.unload();
+			}
+		}
+		return result;
+	}
+}

+ 2 - 2
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/AbstractEditorPropertySection.java

@@ -53,7 +53,7 @@ import org.yakindu.base.xtext.utils.jface.viewers.StyledTextXtextAdapter;
 import org.yakindu.base.xtext.utils.jface.viewers.ContextElementAdapter.IContextElementProvider;
 import org.yakindu.base.xtext.utils.jface.viewers.util.ActiveEditorTracker;
 import org.yakindu.sct.domain.extension.DomainRegistry;
-import org.yakindu.sct.domain.extension.DomainRegistry.DomainDescriptor;
+import org.yakindu.sct.domain.extension.IDomainDescriptor;
 import org.yakindu.sct.domain.extension.IDomainInjectorProvider;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Statechart;
@@ -163,7 +163,7 @@ public abstract class AbstractEditorPropertySection extends AbstractModelerPrope
 			domainId = statechart.getDomainID();
 			resource.unload();
 		}
-		DomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(domainId);
+		IDomainDescriptor domainDescriptor = DomainRegistry.getDomainDescriptor(domainId);
 		IDomainInjectorProvider injectorProvider = domainDescriptor.getDomainInjectorProvider();
 		return injectorProvider.getEmbeddedEditorInjector(semanticTarget);
 	}

+ 219 - 219
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/propertysheets/StatechartPropertySection.java

@@ -1,219 +1,219 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.propertysheets;
-
-import java.util.List;
-
-import org.eclipse.core.databinding.UpdateValueStrategy;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.databinding.EMFDataBindingContext;
-import org.eclipse.emf.databinding.IEMFValueProperty;
-import org.eclipse.emf.databinding.edit.EMFEditProperties;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.jface.databinding.swt.ISWTObservableValue;
-import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.databinding.viewers.IViewerObservableValue;
-import org.eclipse.jface.databinding.viewers.ViewersObservables;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Text;
-import org.yakindu.base.base.BasePackage;
-import org.yakindu.sct.domain.extension.DomainRegistry;
-import org.yakindu.sct.domain.extension.DomainRegistry.DomainDescriptor;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.ui.editor.propertysheets.OrderElementControl.ISourceObjectCallback;
-import org.yakindu.sct.ui.editor.utils.HelpContextIds;
-
-import com.google.inject.Injector;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StatechartPropertySection extends AbstractTwoColumnEditorPropertySection implements ISourceObjectCallback {
-
-	private Control textControl;
-	private Text txtName;
-	private OrderElementControl orderElementControl;
-	private Text documentation;
-	private ComboViewer domainCombo;
-
-	@Override
-	protected Layout createLeftColumnLayout() {
-		return new GridLayout(2, false);
-	}
-
-	@Override
-	protected void createLeftColumnControls(Composite leftColumn) {
-		createNameControl(leftColumn);
-		createDomainCombo(leftColumn);
-		createSpecificationControl(leftColumn);
-	}
-
-	protected void createDomainCombo(Composite leftColumn) {
-		Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
-		GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
-		domainCombo = new ComboViewer(leftColumn);
-		GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
-		Label spacer = getToolkit().createLabel(leftColumn, "");
-		GridDataFactory.fillDefaults().applyTo(spacer);
-		domainCombo.setContentProvider(new ArrayContentProvider());
-		domainCombo.setLabelProvider(new LabelProvider() {
-			@Override
-			public String getText(Object element) {
-				return ((DomainDescriptor) element).getName();
-			}
-		});
-
-		List<DomainDescriptor> domains = DomainRegistry.getDomainDescriptors();
-		for (DomainDescriptor domainDescriptor : domains) {
-			domainCombo.add(domainDescriptor);
-		}
-		domainCombo.setSelection(new StructuredSelection(DomainRegistry
-				.getDomainDescriptor(SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral())));
-
-	}
-
-	@Override
-	protected void createRightColumnControls(Composite rightColumn) {
-		createDocumentationControl(rightColumn);
-		createRegionsControl(rightColumn);
-
-	}
-
-	protected void createNameControl(Composite parent) {
-		Label lblName = getToolkit().createLabel(parent, "Statechart Name: ");
-		txtName = getToolkit().createText(parent, "");
-		GridDataFactory.fillDefaults().span(2, 1).applyTo(lblName);
-		new Label(parent, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, false).applyTo(txtName);
-	}
-
-	protected void createRegionsControl(Composite rightColumn) {
-		Label label = getToolkit().createLabel(rightColumn, "Region Priority:");
-		GridDataFactory.fillDefaults().applyTo(label);
-		orderElementControl = new OrderElementControl(rightColumn, SGraphPackage.Literals.COMPOSITE_ELEMENT__REGIONS,
-				this, "Statechart contains no regions");
-		GridDataFactory.fillDefaults().span(2, 0).grab(true, false).applyTo(orderElementControl);
-	}
-
-	protected void createDocumentationControl(Composite rightColumn) {
-		Label lblDocumentation = getToolkit().createLabel(rightColumn, "Documentation: ");
-		documentation = getToolkit().createText(rightColumn, "", SWT.MULTI);
-		GridDataFactory.fillDefaults().applyTo(lblDocumentation);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(documentation);
-
-	}
-
-	protected void createSpecificationControl(final Composite parent) {
-		Label lblDocumentation = getToolkit().createLabel(parent, "Statechart Behavior: ");
-		Injector injector = getInjector(Statechart.class.getName());
-		if (injector != null) {
-			textControl = new StyledText(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
-			((StyledText) textControl).setAlwaysShowScrollBars(false);
-			enableXtext(textControl, injector);
-			createHelpWidget(parent, textControl, HelpContextIds.SC_PROPERTIES_STATECHART_EXPRESSION);
-		} else {
-			textControl = getToolkit().createText(parent, "", SWT.MULTI);
-		}
-		GridDataFactory.fillDefaults().span(2, 1).applyTo(lblDocumentation);
-		GridDataFactory.fillDefaults().grab(true, true).hint(parent.getSize()).applyTo(textControl);
-	}
-
-	@Override
-	public void bindModel(EMFDataBindingContext context) {
-		bindNameControl(context);
-		bindDomainCombo(context);
-		bindSpecificationControl(context);
-		bindDocumentationControl(context);
-		orderElementControl.refreshInput();
-	}
-
-	private void bindDomainCombo(EMFDataBindingContext context) {
-		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
-				SGraphPackage.Literals.STATECHART__DOMAIN_ID);
-
-		IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(domainCombo);
-		UpdateValueStrategy modelToTarget = new UpdateValueStrategy() {
-			@Override
-			public Object convert(Object value) {
-				return ((DomainDescriptor) value).getDomainID();
-			}
-		};
-		UpdateValueStrategy targetToModel = new UpdateValueStrategy() {
-			@Override
-			public Object convert(Object value) {
-				return DomainRegistry.getDomainDescriptor((String) value);
-			}
-		};
-		context.bindValue(observeSingleSelection, property.observe(eObject), modelToTarget, targetToModel);
-	}
-
-	private void bindDocumentationControl(EMFDataBindingContext context) {
-		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
-				BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION);
-		ISWTObservableValue observe = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection }).observe(
-				documentation);
-		context.bindValue(observe, property.observe(eObject));
-	}
-
-	protected void bindSpecificationControl(EMFDataBindingContext context) {
-		IEMFValueProperty modelProperty = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
-				SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION);
-		ISWTObservableValue uiProperty = WidgetProperties.text(SWT.FocusOut).observe(textControl);
-		context.bindValue(uiProperty, modelProperty.observe(eObject), null, new UpdateValueStrategy() {
-			@Override
-			protected IStatus doSet(IObservableValue observableValue, Object value) {
-				if (getCompletionProposalAdapter() != null && !getCompletionProposalAdapter().isProposalPopupOpen())
-					return super.doSet(observableValue, value);
-				return Status.OK_STATUS;
-			}
-		});
-
-	}
-
-	protected void bindNameControl(EMFDataBindingContext context) {
-		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
-				BasePackage.Literals.NAMED_ELEMENT__NAME);
-		ISWTObservableValue observe = WidgetProperties.text(new int[] { SWT.FocusOut, SWT.DefaultSelection }).observe(
-				txtName);
-		context.bindValue(observe, property.observe(eObject));
-	}
-
-	@Override
-	public EObject getEObject() {
-		return super.getEObject();
-	}
-
-	@Override
-	public void dispose() {
-		if (orderElementControl != null) {
-			orderElementControl.dispose();
-		}
-		super.dispose();
-	}
-
-}
+/**
+ * Copyright (c) 2011 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.ui.editor.propertysheets;
+
+import java.util.List;
+
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.databinding.EMFDataBindingContext;
+import org.eclipse.emf.databinding.IEMFValueProperty;
+import org.eclipse.emf.databinding.edit.EMFEditProperties;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.jface.databinding.swt.ISWTObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.viewers.IViewerObservableValue;
+import org.eclipse.jface.databinding.viewers.ViewersObservables;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Text;
+import org.yakindu.base.base.BasePackage;
+import org.yakindu.sct.domain.extension.DomainRegistry;
+import org.yakindu.sct.domain.extension.IDomainDescriptor;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.model.sgraph.Statechart;
+import org.yakindu.sct.ui.editor.propertysheets.OrderElementControl.ISourceObjectCallback;
+import org.yakindu.sct.ui.editor.utils.HelpContextIds;
+
+import com.google.inject.Injector;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class StatechartPropertySection extends AbstractTwoColumnEditorPropertySection implements ISourceObjectCallback {
+
+	private Control textControl;
+	private Text txtName;
+	private OrderElementControl orderElementControl;
+	private Text documentation;
+	private ComboViewer domainCombo;
+
+	@Override
+	protected Layout createLeftColumnLayout() {
+		return new GridLayout(2, false);
+	}
+
+	@Override
+	protected void createLeftColumnControls(Composite leftColumn) {
+		createNameControl(leftColumn);
+		createDomainCombo(leftColumn);
+		createSpecificationControl(leftColumn);
+	}
+
+	protected void createDomainCombo(Composite leftColumn) {
+		Label label = getToolkit().createLabel(leftColumn, "Statechart domain");
+		GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(label);
+		domainCombo = new ComboViewer(leftColumn);
+		GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
+		Label spacer = getToolkit().createLabel(leftColumn, "");
+		GridDataFactory.fillDefaults().applyTo(spacer);
+		domainCombo.setContentProvider(new ArrayContentProvider());
+		domainCombo.setLabelProvider(new LabelProvider() {
+			@Override
+			public String getText(Object element) {
+				return ((IDomainDescriptor) element).getName();
+			}
+		});
+
+		List<IDomainDescriptor> domains = DomainRegistry.getDomainDescriptors();
+		for (IDomainDescriptor domainDescriptor : domains) {
+			domainCombo.add(domainDescriptor);
+		}
+		domainCombo.setSelection(new StructuredSelection(DomainRegistry
+				.getDomainDescriptor(SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral())));
+
+	}
+
+	@Override
+	protected void createRightColumnControls(Composite rightColumn) {
+		createDocumentationControl(rightColumn);
+		createRegionsControl(rightColumn);
+
+	}
+
+	protected void createNameControl(Composite parent) {
+		Label lblName = getToolkit().createLabel(parent, "Statechart Name: ");
+		txtName = getToolkit().createText(parent, "");
+		GridDataFactory.fillDefaults().span(2, 1).applyTo(lblName);
+		new Label(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, false).applyTo(txtName);
+	}
+
+	protected void createRegionsControl(Composite rightColumn) {
+		Label label = getToolkit().createLabel(rightColumn, "Region Priority:");
+		GridDataFactory.fillDefaults().applyTo(label);
+		orderElementControl = new OrderElementControl(rightColumn, SGraphPackage.Literals.COMPOSITE_ELEMENT__REGIONS,
+				this, "Statechart contains no regions");
+		GridDataFactory.fillDefaults().span(2, 0).grab(true, false).applyTo(orderElementControl);
+	}
+
+	protected void createDocumentationControl(Composite rightColumn) {
+		Label lblDocumentation = getToolkit().createLabel(rightColumn, "Documentation: ");
+		documentation = getToolkit().createText(rightColumn, "", SWT.MULTI);
+		GridDataFactory.fillDefaults().applyTo(lblDocumentation);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(documentation);
+
+	}
+
+	protected void createSpecificationControl(final Composite parent) {
+		Label lblDocumentation = getToolkit().createLabel(parent, "Statechart Behavior: ");
+		Injector injector = getInjector(Statechart.class.getName());
+		if (injector != null) {
+			textControl = new StyledText(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
+			((StyledText) textControl).setAlwaysShowScrollBars(false);
+			enableXtext(textControl, injector);
+			createHelpWidget(parent, textControl, HelpContextIds.SC_PROPERTIES_STATECHART_EXPRESSION);
+		} else {
+			textControl = getToolkit().createText(parent, "", SWT.MULTI);
+		}
+		GridDataFactory.fillDefaults().span(2, 1).applyTo(lblDocumentation);
+		GridDataFactory.fillDefaults().grab(true, true).hint(parent.getSize()).applyTo(textControl);
+	}
+
+	@Override
+	public void bindModel(EMFDataBindingContext context) {
+		bindNameControl(context);
+		bindDomainCombo(context);
+		bindSpecificationControl(context);
+		bindDocumentationControl(context);
+		orderElementControl.refreshInput();
+	}
+
+	private void bindDomainCombo(EMFDataBindingContext context) {
+		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
+				SGraphPackage.Literals.STATECHART__DOMAIN_ID);
+
+		IViewerObservableValue observeSingleSelection = ViewersObservables.observeSingleSelection(domainCombo);
+		UpdateValueStrategy modelToTarget = new UpdateValueStrategy() {
+			@Override
+			public Object convert(Object value) {
+				return ((IDomainDescriptor) value).getDomainID();
+			}
+		};
+		UpdateValueStrategy targetToModel = new UpdateValueStrategy() {
+			@Override
+			public Object convert(Object value) {
+				return DomainRegistry.getDomainDescriptor((String) value);
+			}
+		};
+		context.bindValue(observeSingleSelection, property.observe(eObject), modelToTarget, targetToModel);
+	}
+
+	private void bindDocumentationControl(EMFDataBindingContext context) {
+		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
+				BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION);
+		ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
+				.observe(documentation);
+		context.bindValue(observe, property.observe(eObject));
+	}
+
+	protected void bindSpecificationControl(EMFDataBindingContext context) {
+		IEMFValueProperty modelProperty = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
+				SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION);
+		ISWTObservableValue uiProperty = WidgetProperties.text(SWT.FocusOut).observe(textControl);
+		context.bindValue(uiProperty, modelProperty.observe(eObject), null, new UpdateValueStrategy() {
+			@Override
+			protected IStatus doSet(IObservableValue observableValue, Object value) {
+				if (getCompletionProposalAdapter() != null && !getCompletionProposalAdapter().isProposalPopupOpen())
+					return super.doSet(observableValue, value);
+				return Status.OK_STATUS;
+			}
+		});
+
+	}
+
+	protected void bindNameControl(EMFDataBindingContext context) {
+		IEMFValueProperty property = EMFEditProperties.value(TransactionUtil.getEditingDomain(eObject),
+				BasePackage.Literals.NAMED_ELEMENT__NAME);
+		ISWTObservableValue observe = WidgetProperties.text(new int[]{SWT.FocusOut, SWT.DefaultSelection})
+				.observe(txtName);
+		context.bindValue(observe, property.observe(eObject));
+	}
+
+	@Override
+	public EObject getEObject() {
+		return super.getEObject();
+	}
+
+	@Override
+	public void dispose() {
+		if (orderElementControl != null) {
+			orderElementControl.dispose();
+		}
+		super.dispose();
+	}
+
+}

+ 118 - 118
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/DomainWizardPage.java

@@ -1,118 +1,118 @@
-/**
- * Copyright (c) 2015 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.wizards;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.yakindu.sct.domain.extension.DomainRegistry;
-import org.yakindu.sct.domain.extension.DomainRegistry.DomainDescriptor;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class DomainWizardPage extends WizardPage {
-
-	private ComboViewer domainCombo;
-
-	private Label description;
-
-	private Label image;
-
-	protected DomainWizardPage(String pageName) {
-		super(pageName);
-	}
-
-	public void createControl(Composite parent) {
-		final Composite composite = new Composite(parent, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
-		GridLayoutFactory.fillDefaults().applyTo(composite);
-		final Group domainSelectionGroup = new Group(composite, SWT.NONE);
-		domainSelectionGroup.setText("Select the Statechart domain:");
-
-		GridLayoutFactory.fillDefaults().numColumns(2).applyTo(domainSelectionGroup);
-		GridDataFactory.fillDefaults().grab(true, true).applyTo(domainSelectionGroup);
-
-		Label spacer = new Label(domainSelectionGroup, SWT.NONE);
-		GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer);
-
-		image = new Label(domainSelectionGroup, SWT.NONE);
-		GridDataFactory.fillDefaults().grab(false, false).applyTo(image);
-		domainCombo = new ComboViewer(domainSelectionGroup, SWT.READ_ONLY);
-		GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
-		domainCombo.setContentProvider(new ArrayContentProvider());
-		domainCombo.setLabelProvider(new LabelProvider() {
-			@Override
-			public String getText(Object element) {
-				return ((DomainDescriptor) element).getName();
-			}
-		});
-		domainCombo.setInput(DomainRegistry.getDomainDescriptors());
-
-		Label spacer2 = new Label(domainSelectionGroup, SWT.NONE);
-		GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer2);
-
-		description = new Label(domainSelectionGroup, SWT.WRAP);
-		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(description);
-		setControl(composite);
-		domainCombo.addSelectionChangedListener(new ISelectionChangedListener() {
-
-			public void selectionChanged(SelectionChangedEvent event) {
-				DomainDescriptor domain = unwrap(event.getSelection());
-				description.setText(domain.getDescription());
-				image.setImage(domain.getImage());
-				domainSelectionGroup.layout();
-
-			}
-
-		});
-		domainCombo.setSelection(new StructuredSelection(DomainRegistry
-				.getDomainDescriptor(SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral())));
-
-		Link sctLink = new Link(composite, SWT.NONE);
-		sctLink.setText("<a>Get additional Statechart Domain Extensions</a>");
-		sctLink.addSelectionListener(new SelectionListener() {
-			public void widgetSelected(SelectionEvent e) {
-				org.eclipse.swt.program.Program.launch("http://statecharts.org/");
-			}
-
-			public void widgetDefaultSelected(SelectionEvent e) {
-			}
-		});
-	}
-
-	public String getDomainID() {
-		return unwrap(domainCombo.getSelection()).getDomainID();
-	}
-
-	private DomainDescriptor unwrap(ISelection selection) {
-		DomainDescriptor domain = (DomainDescriptor) ((StructuredSelection) selection).getFirstElement();
-		return domain;
-	}
-
-}
+/**
+ * Copyright (c) 2015 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * Contributors:
+ * 	committers of YAKINDU - initial API and implementation
+ * 
+ */
+package org.yakindu.sct.ui.editor.wizards;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.yakindu.sct.domain.extension.DomainRegistry;
+import org.yakindu.sct.domain.extension.IDomainDescriptor;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class DomainWizardPage extends WizardPage {
+
+	private ComboViewer domainCombo;
+
+	private Label description;
+
+	private Label image;
+
+	protected DomainWizardPage(String pageName) {
+		super(pageName);
+	}
+
+	public void createControl(Composite parent) {
+		final Composite composite = new Composite(parent, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
+		GridLayoutFactory.fillDefaults().applyTo(composite);
+		final Group domainSelectionGroup = new Group(composite, SWT.NONE);
+		domainSelectionGroup.setText("Select the Statechart domain:");
+
+		GridLayoutFactory.fillDefaults().numColumns(2).applyTo(domainSelectionGroup);
+		GridDataFactory.fillDefaults().grab(true, true).applyTo(domainSelectionGroup);
+
+		Label spacer = new Label(domainSelectionGroup, SWT.NONE);
+		GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer);
+
+		image = new Label(domainSelectionGroup, SWT.NONE);
+		GridDataFactory.fillDefaults().grab(false, false).applyTo(image);
+		domainCombo = new ComboViewer(domainSelectionGroup, SWT.READ_ONLY);
+		GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
+		domainCombo.setContentProvider(new ArrayContentProvider());
+		domainCombo.setLabelProvider(new LabelProvider() {
+			@Override
+			public String getText(Object element) {
+				return ((IDomainDescriptor) element).getName();
+			}
+		});
+		domainCombo.setInput(DomainRegistry.getDomainDescriptors());
+
+		Label spacer2 = new Label(domainSelectionGroup, SWT.NONE);
+		GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer2);
+
+		description = new Label(domainSelectionGroup, SWT.WRAP);
+		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(description);
+		setControl(composite);
+		domainCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+
+			public void selectionChanged(SelectionChangedEvent event) {
+				IDomainDescriptor domain = unwrap(event.getSelection());
+				description.setText(domain.getDescription());
+				image.setImage(domain.getImage());
+				domainSelectionGroup.layout();
+
+			}
+
+		});
+		domainCombo.setSelection(new StructuredSelection(DomainRegistry
+				.getDomainDescriptor(SGraphPackage.Literals.STATECHART__DOMAIN_ID.getDefaultValueLiteral())));
+
+		Link sctLink = new Link(composite, SWT.NONE);
+		sctLink.setText("<a>Get additional Statechart Domain Extensions</a>");
+		sctLink.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				org.eclipse.swt.program.Program.launch("http://statecharts.org/");
+			}
+
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+	}
+
+	public String getDomainID() {
+		return unwrap(domainCombo.getSelection()).getDomainID();
+	}
+
+	private IDomainDescriptor unwrap(ISelection selection) {
+		IDomainDescriptor domain = (IDomainDescriptor) ((StructuredSelection) selection).getFirstElement();
+		return domain;
+	}
+
+}

+ 145 - 146
test-plugins/org.yakindu.sct.generator.genmodel.test/src/org/yakindu/sct/generator/genmodel/test/HelpIntegrationTest.java

@@ -1,146 +1,145 @@
-/**
- * Copyright (c) 2012 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     committers of YAKINDU - initial API and implementation
- */
-package org.yakindu.sct.generator.genmodel.test;
-
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
-import org.eclipse.xtext.junit4.InjectWith;
-import org.eclipse.xtext.junit4.XtextRunner;
-import org.eclipse.xtext.resource.IEObjectDescription;
-import org.eclipse.xtext.resource.XtextResourceSet;
-import org.junit.Ignore;
-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;
-import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
-import org.yakindu.sct.model.sgen.SGenPackage;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-
-/**
- * Checks if all Generator Features have a corresponding documentation section
- * in the user guide.
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-@RunWith(XtextRunner.class)
-@InjectWith(SGenInjectorProvider.class)
-public class HelpIntegrationTest {
-
-	private static final String YAKINDU_JAVA = "yakindu::java";
-	private static final String YAKINDU_C = "yakindu::c";
-	private static final String YAKINDU_CPP = "yakindu::cpp";
-	private static final String YAKINDU_GENERIC = "yakindu::generic";
-	private static final String YAKINDU_XPAND = "yakindu::xpand";
-	@Inject
-	private IEObjectDocumentationProvider documentationProvider;
-	@Inject
-	private XtextResourceSet resourceSet;
-	@Inject
-	private Injector injector;
-
-	@Test
-	public void checkJavaGeneratorFeatureDocumentation() {
-		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_JAVA);
-		if (missingDocumentation.size() > 0) {
-			fail("Missing generator feature(s) documentation for generator "
-					+ YAKINDU_JAVA + ": " + missingDocumentation);
-		}
-	}
-
-	@Test
-	public void checkCGeneratorFeatureDocumentation() {
-		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_C);
-		if (missingDocumentation.size() > 0) {
-			fail("Missing generator feature(s) documentation for generator "
-					+ YAKINDU_C + ": " + missingDocumentation);
-		}
-	}
-
-	@Test
-	@Ignore
-	public void checkCppGeneratorFeatureDocumentation() {
-		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_CPP);
-		if (missingDocumentation.size() > 0) {
-			fail("Missing generator feature(s) documentation for generator "
-					+ YAKINDU_CPP + ": " + missingDocumentation);
-		}
-
-	}
-
-	@Test
-	public void checkGenericGeneratorFeatureDocumentation() {
-		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_GENERIC);
-		if (missingDocumentation.size() > 0) {
-			fail("Missing generator feature(s) documentation for generator "
-					+ YAKINDU_GENERIC + ": " + missingDocumentation);
-		}
-
-	}
-
-	@Test
-	public void checkXpandGeneratorFeatureDocumentation() {
-		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_XPAND);
-		if (missingDocumentation.size() > 0) {
-			fail("Missing generator feature(s) documentation for generator "
-					+ YAKINDU_XPAND + ": " + missingDocumentation);
-		}
-
-	}
-
-	private List<String> getFeaturesWithoutDocumentation(String generatorId) {
-		
-		GeneratorDescriptor generatorDescriptor = GeneratorExtensions
-				.getGeneratorDescriptorForId(generatorId);
-		
-		Iterable<LibraryDescriptor> libraryDescriptor = LibraryExtensions
-				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
-		
-		Iterable<IEObjectDescription> allElements = Lists.newArrayList();
-		for (LibraryDescriptor desc : libraryDescriptor) {
-			Resource library = resourceSet.getResource(desc.getURI(), true);
-			FeatureResourceDescription description = new FeatureResourceDescription(
-					library);
-			injector.injectMembers(description);
-			allElements = Iterables.concat(allElements,
-					description.getExportedObjects());
-		}
-		List<String> missingDocumentation = Lists.newArrayList();
-		for (IEObjectDescription desc : allElements) {
-			if (desc.getEClass() != SGenPackage.Literals.FEATURE_TYPE)
-				continue;
-			EObject eObjectOrProxy = desc.getEObjectOrProxy();
-			String documentation = documentationProvider
-					.getDocumentation(eObjectOrProxy);
-			if (documentation == null
-					|| SGenUserHelpDocumentationProvider.EMPTY_DOCUMENTATION
-							.equals(documentation)) {
-				missingDocumentation.add(desc.getName().toString());
-			}
-		}
-		return missingDocumentation;
-	}
-
-}
+/**
+ * Copyright (c) 2012 committers of YAKINDU and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.generator.genmodel.test;
+
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
+import org.eclipse.xtext.junit4.InjectWith;
+import org.eclipse.xtext.junit4.XtextRunner;
+import org.eclipse.xtext.resource.IEObjectDescription;
+import org.eclipse.xtext.resource.XtextResourceSet;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.generator.core.extensions.GeneratorExtensions;
+import org.yakindu.sct.generator.core.extensions.IGeneratorDescriptor;
+import org.yakindu.sct.generator.core.extensions.ILibraryDescriptor;
+import org.yakindu.sct.generator.core.extensions.LibraryExtensions;
+import org.yakindu.sct.generator.genmodel.resource.FeatureResourceDescription;
+import org.yakindu.sct.generator.genmodel.test.util.SGenInjectorProvider;
+import org.yakindu.sct.generator.genmodel.ui.help.SGenUserHelpDocumentationProvider;
+import org.yakindu.sct.model.sgen.SGenPackage;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+/**
+ * Checks if all Generator Features have a corresponding documentation section
+ * in the user guide.
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+@RunWith(XtextRunner.class)
+@InjectWith(SGenInjectorProvider.class)
+public class HelpIntegrationTest {
+
+	private static final String YAKINDU_JAVA = "yakindu::java";
+	private static final String YAKINDU_C = "yakindu::c";
+	private static final String YAKINDU_CPP = "yakindu::cpp";
+	private static final String YAKINDU_GENERIC = "yakindu::generic";
+	private static final String YAKINDU_XPAND = "yakindu::xpand";
+	@Inject
+	private IEObjectDocumentationProvider documentationProvider;
+	@Inject
+	private XtextResourceSet resourceSet;
+	@Inject
+	private Injector injector;
+
+	@Test
+	public void checkJavaGeneratorFeatureDocumentation() {
+		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_JAVA);
+		if (missingDocumentation.size() > 0) {
+			fail("Missing generator feature(s) documentation for generator "
+					+ YAKINDU_JAVA + ": " + missingDocumentation);
+		}
+	}
+
+	@Test
+	public void checkCGeneratorFeatureDocumentation() {
+		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_C);
+		if (missingDocumentation.size() > 0) {
+			fail("Missing generator feature(s) documentation for generator "
+					+ YAKINDU_C + ": " + missingDocumentation);
+		}
+	}
+
+	@Test
+	@Ignore
+	public void checkCppGeneratorFeatureDocumentation() {
+		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_CPP);
+		if (missingDocumentation.size() > 0) {
+			fail("Missing generator feature(s) documentation for generator "
+					+ YAKINDU_CPP + ": " + missingDocumentation);
+		}
+
+	}
+
+	@Test
+	public void checkGenericGeneratorFeatureDocumentation() {
+		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_GENERIC);
+		if (missingDocumentation.size() > 0) {
+			fail("Missing generator feature(s) documentation for generator "
+					+ YAKINDU_GENERIC + ": " + missingDocumentation);
+		}
+
+	}
+
+	@Test
+	public void checkXpandGeneratorFeatureDocumentation() {
+		List<String> missingDocumentation = getFeaturesWithoutDocumentation(YAKINDU_XPAND);
+		if (missingDocumentation.size() > 0) {
+			fail("Missing generator feature(s) documentation for generator "
+					+ YAKINDU_XPAND + ": " + missingDocumentation);
+		}
+	}
+
+	private List<String> getFeaturesWithoutDocumentation(String generatorId) {
+		
+		IGeneratorDescriptor generatorDescriptor = GeneratorExtensions
+				.getGeneratorDescriptor(generatorId);
+		
+		Iterable<ILibraryDescriptor> libraryDescriptor = LibraryExtensions
+				.getLibraryDescriptors(generatorDescriptor.getLibraryIDs());
+		
+		Iterable<IEObjectDescription> allElements = Lists.newArrayList();
+		for (ILibraryDescriptor desc : libraryDescriptor) {
+			Resource library = resourceSet.getResource(desc.getURI(), true);
+			FeatureResourceDescription description = new FeatureResourceDescription(
+					library);
+			injector.injectMembers(description);
+			allElements = Iterables.concat(allElements,
+					description.getExportedObjects());
+		}
+		List<String> missingDocumentation = Lists.newArrayList();
+		for (IEObjectDescription desc : allElements) {
+			if (desc.getEClass() != SGenPackage.Literals.FEATURE_TYPE)
+				continue;
+			EObject eObjectOrProxy = desc.getEObjectOrProxy();
+			String documentation = documentationProvider
+					.getDocumentation(eObjectOrProxy);
+			if (documentation == null
+					|| SGenUserHelpDocumentationProvider.EMPTY_DOCUMENTATION
+							.equals(documentation)) {
+				missingDocumentation.add(desc.getName().toString());
+			}
+		}
+		return missingDocumentation;
+	}
+
+}