Browse Source

enhance domain selection wizard (#2098)

Andreas Mülder 7 years ago
parent
commit
46566141a2
18 changed files with 579 additions and 544 deletions
  1. 8 7
      plugins/org.yakindu.sct.domain.generic/build.properties
  2. 79 0
      plugins/org.yakindu.sct.domain.generic/docu/default_domain.html
  3. 2 1
      plugins/org.yakindu.sct.domain.generic/plugin.xml
  4. 1 1
      plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/GenericDomainActivator.java
  5. 44 0
      plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/GenericDomainDocumentationProvider.java
  6. 146 133
      plugins/org.yakindu.sct.domain/schema/domain.exsd
  7. 14 3
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainRegistry.java
  8. 3 0
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomain.java
  9. 31 0
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainDocumentationProvider.java
  10. 185 175
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/impl/DomainImpl.java
  11. 8 9
      plugins/org.yakindu.sct.ui.editor/build.properties
  12. BIN
      plugins/org.yakindu.sct.ui.editor/images/pro.png
  13. 0 2
      plugins/org.yakindu.sct.ui.editor/plugin.xml
  14. 0 102
      plugins/org.yakindu.sct.ui.editor/schema/org.yakindu.sct.ui.wizard.create.contribution.exsd
  15. 13 28
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizard.java
  16. 0 23
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizardContribution.java
  17. 44 59
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/DomainWizardPage.java
  18. 1 1
      plugins/org.yakindu.sct.ui/src/org/yakindu/sct/ui/wizards/ModelCreationWizardPage.java

+ 8 - 7
plugins/org.yakindu.sct.domain.generic/build.properties

@@ -1,7 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .,\
-               plugin.xml,\
-               icons/,\
-               OSGI-INF/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               OSGI-INF/,\
+               docu/

+ 79 - 0
plugins/org.yakindu.sct.domain.generic/docu/default_domain.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<title>YAKINDU Statechart Tools Default Domain</title>
+<style media="screen" type="text/css">
+html {
+  font-family: sans-serif;
+  font-size: 10px;
+  -webkit-text-size-adjust: 100%;
+      -ms-text-size-adjust: 100%;
+}
+body {
+  margin: 20;
+  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+  font-size: 14px;
+  line-height: 1.42857143;
+  color: #333;
+  background-color: #fff;
+}
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+.h1,
+.h2,
+.h3,
+.h4,
+.h5,
+.h6 {
+  font-family: inherit;
+  font-weight: 500;
+  line-height: 1.1;
+  color: inherit;
+}
+h1,
+.h1,
+h2,
+.h2,
+h3,
+.h3 {
+  margin-top: 20px;
+  margin-bottom: 10px;
+}
+h2,
+.h2 {
+  font-size: 30px;
+}
+</style>
+</head>
+<body class="body-container">
+  <div class="primary">
+
+    <h2>YAKINDU Statechart Tools - Default Domain</h2>
+    <div>
+      <p>
+      YAKINDU Statechart Tools 'Default Domain' is a platform independent domain with a basic type system.
+      Choose this domain if you are new to YAKINDU Statechart Tools or you want to develop a generic statemachine, for for example to generate C, C++ or Java code.
+      <br />
+      </p>
+      
+  <h3>Default Type System</h3>
+    The 'Default Domain' integrated type system consists of the following simple types:
+    <ul>
+	<li>integer</li>
+	<li>real</li>
+	<li>boolean</li>
+	<li>string</li>
+	<li>void</li>
+	</ul>
+    <p>
+  	Depending on the code generator, these types will be mapped to language specific types.
+  	For C and C++, this is configurable via the generated sc_types.h. For exmaple, the type integer will be mapped to an int32_t.
+    </p>
+    </div>
+</body>
+</html>

+ 2 - 1
plugins/org.yakindu.sct.domain.generic/plugin.xml

@@ -7,8 +7,9 @@
             description="The default domain for YAKINDU Statechart Tools."
             domainID="org.yakindu.domain.default"
             domainStatusProvider="org.yakindu.sct.domain.generic.GenericDomainStatusProvider"
+            documentationProvider="org.yakindu.sct.domain.generic.GenericDomainDocumentationProvider"
             image="icons/logo_small.png"
-            name="Default">
+            name="Default Domain">
       </Domain>
    </extension>
 </plugin>

+ 1 - 1
plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/GenericDomainActivator.java

@@ -1,5 +1,5 @@
 /** 
- * Copyright (c) 2015 committers of YAKINDU and others. 
+ * Copyright (c) 2018 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 

+ 44 - 0
plugins/org.yakindu.sct.domain.generic/src/org/yakindu/sct/domain/generic/GenericDomainDocumentationProvider.java

@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2018 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.generic;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.osgi.framework.Bundle;
+import org.yakindu.sct.domain.extension.IDomainDocumentationProvider;
+
+public class GenericDomainDocumentationProvider implements IDomainDocumentationProvider {
+
+	@Override
+	public URL getDocumentationURL() {
+		IPath relativePagePath = new Path(getDocPathString());
+		URL fileInPlugin = FileLocator.find(getBundle(), relativePagePath, null);
+		try {
+			return FileLocator.toFileURL(fileInPlugin);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	protected String getDocPathString() {
+		return "docu/default_domain.html";
+	}
+
+	protected Bundle getBundle() {
+		return GenericDomainActivator.getContext().getBundle();
+	}
+
+}

+ 146 - 133
plugins/org.yakindu.sct.domain/schema/domain.exsd

@@ -1,133 +1,146 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.domain" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.domain" id="domain" name="org.yakindu.sct.domain"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence minOccurs="1" maxOccurs="unbounded">
-            <element ref="Domain"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="Domain">
-      <complexType>
-         <attribute name="domainID" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="description" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="image" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="resource"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="domainStatusProvider" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.domain.extension.IDomainStatusProvider"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.yakindu.sct.domain" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.yakindu.sct.domain" id="domain" name="org.yakindu.sct.domain"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <sequence minOccurs="1" maxOccurs="unbounded">
+            <element ref="Domain"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="Domain">
+      <complexType>
+         <attribute name="domainID" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="description" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute deprecated="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="image" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="resource"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="domainStatusProvider" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.domain.extension.IDomainStatusProvider"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="documentationProvider" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.domain.extension.IDomainDocumentationProvider"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

+ 14 - 3
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainRegistry.java

@@ -57,6 +57,7 @@ public class DomainRegistry {
 	private static final String IMAGE = "image";
 	private static final String NAME = "name";
 	private static final String DOMAIN_STATUS_PROVIDER = "domainStatusProvider";
+	private static final String DOCU_PROVIDER = "documentationProvider";
 
 	private static final String FEATURE = "feature";
 	private static final String MODULE_PROVIDER = "moduleProvider";
@@ -158,14 +159,24 @@ public class DomainRegistry {
 			Bundle extensionBundle = Platform.getBundle(element.getContributor().getName());
 			image = extensionBundle.getEntry(path);
 		}
-		IDomainStatusProvider provider = new IDomainStatusProvider.DefaultDomainStatusProvider();
+		IDomainStatusProvider statusProvider = new IDomainStatusProvider.DefaultDomainStatusProvider();
 		if (element.getAttribute(DOMAIN_STATUS_PROVIDER) != null) {
 			try {
-				provider = (IDomainStatusProvider) element.createExecutableExtension(DOMAIN_STATUS_PROVIDER);
+				statusProvider = (IDomainStatusProvider) element.createExecutableExtension(DOMAIN_STATUS_PROVIDER);
 			} catch (CoreException e) {
 				e.printStackTrace();
 			}
 		}
+
+		IDomainDocumentationProvider docuProvider = new IDomainDocumentationProvider.NullImpl();
+		if (element.getAttribute(DOCU_PROVIDER) != null) {
+			try {
+				docuProvider = (IDomainDocumentationProvider) element.createExecutableExtension(DOCU_PROVIDER);
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+		}
+
 		return new DomainImpl(element.getAttribute(DOMAIN_ID), element.getAttribute(NAME),
 				element.getAttribute(DESCRIPTION), image,
 				Iterables.filter(allModules, new Predicate<ModuleContribution>() {
@@ -173,7 +184,7 @@ public class DomainRegistry {
 					public boolean apply(ModuleContribution input) {
 						return input.getDomainID().equals(element.getAttribute(DOMAIN_ID));
 					}
-				}), provider);
+				}), statusProvider, docuProvider);
 	}
 
 	/**

+ 3 - 0
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomain.java

@@ -32,7 +32,10 @@ public interface IDomain {
 
 	String getName();
 
+	@Deprecated()
 	String getDescription();
+	
+	IDomainDocumentationProvider getDocumentationProvider();
 
 	/**
 	 * Injector instances are cached for the features and the specified options

+ 31 - 0
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/IDomainDocumentationProvider.java

@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2018 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;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public interface IDomainDocumentationProvider {
+
+	public URL getDocumentationURL();
+
+	class NullImpl implements IDomainDocumentationProvider {
+
+		@Override
+		public URL getDocumentationURL() {
+			return null;
+		}
+
+	}
+}

+ 185 - 175
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/impl/DomainImpl.java

@@ -1,175 +1,185 @@
-/**
- * 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.domain.extension.impl;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import org.yakindu.sct.domain.extension.DomainStatus;
-import org.yakindu.sct.domain.extension.IDomain;
-import org.yakindu.sct.domain.extension.IDomainStatusProvider;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Module;
-
-/**
- * @author andreas muelder - Initial contribution and API
- *
- */
-public class DomainImpl implements IDomain {
-
-	private String domainID;
-	private String name;
-	private String description;
-	private URL imagePath;
-	private IDomainStatusProvider statusProvider;
-	private Iterable<ModuleContribution> modules;
-	private LoadingCache<CacheKey, Injector> injectorCache;
-
-	protected static class CacheKey {
-		private String feature;
-		private String[] options;
-
-		public CacheKey(String feature, String[] options) {
-			this.feature = feature;
-			this.options = options;
-		}
-
-		@Override
-		public int hashCode() {
-			final int prime = 31;
-			int result = 1;
-			result = prime * result + ((feature == null) ? 0 : feature.hashCode());
-			result = prime * result + Arrays.hashCode(options);
-			return result;
-		}
-
-		@Override
-		public boolean equals(Object obj) {
-			if (this == obj)
-				return true;
-			if (obj == null)
-				return false;
-			if (getClass() != obj.getClass())
-				return false;
-			CacheKey other = (CacheKey) obj;
-			if (feature == null) {
-				if (other.feature != null)
-					return false;
-			} else if (!feature.equals(other.feature))
-				return false;
-			if (!Arrays.equals(options, other.options))
-				return false;
-			return true;
-		}
-
-		public String getFeature() {
-			return feature;
-		}
-
-		public String[] getOptions() {
-			return options;
-		}
-
-	}
-
-	public DomainImpl(String domainID, String name, String description, URL imagePath,
-			Iterable<ModuleContribution> modules) {
-		this(domainID, name, description, imagePath, modules, new IDomainStatusProvider.DefaultDomainStatusProvider());
-	}
-
-	public DomainImpl(String domainID, String name, String description, URL imagePath,
-			Iterable<ModuleContribution> modules, IDomainStatusProvider provider) {
-		this.domainID = domainID;
-		this.name = name;
-		this.description = description;
-		this.imagePath = imagePath;
-		this.modules = modules;
-		this.statusProvider = provider;
-		initializeCache();
-	}
-
-	protected void initializeCache() {
-		injectorCache = CacheBuilder.newBuilder().build(new CacheLoader<CacheKey, Injector>() {
-			@Override
-			public Injector load(CacheKey key) throws Exception {
-				return createInjector(key.getFeature(), key.getOptions());
-			}
-		});
-	}
-
-	@Override
-	public String getDomainID() {
-		return domainID;
-	}
-
-	@Override
-	public String getName() {
-		return name;
-	}
-
-	@Override
-	public String getDescription() {
-		return description;
-	}
-
-	@Override
-	public URL getImagePath() {
-		return imagePath;
-	}
-
-	@Override
-	public Injector getInjector(String feature, boolean useCache, String... options) {
-		if (useCache) {
-			try {
-				return injectorCache.get(new CacheKey(feature, options));
-			} catch (ExecutionException e) {
-				e.printStackTrace();
-			}
-		}
-		return createInjector(feature, options);
-	}
-
-	@Override
-	public Injector getInjector(String feature, String... options) {
-		return getInjector(feature, true, options);
-	}
-
-	public Injector createInjector(String feature, String... options) {
-		return Guice.createInjector(getModule(feature, options));
-	}
-
-	@Override
-	public Module getModule(String feature, String... options) {
-		List<Module> modules = new ArrayList<>();
-		for (ModuleContribution module : this.modules) {
-			if (feature.equals(module.getFeature())) {
-				modules.add(module.getModuleProvider().getModule(options));
-			}
-		}
-		Module result = new LazyCombiningModule(modules);
-		return result;
-
-	}
-
-	@Override
-	public DomainStatus getAvailabilityStatus() {
-		return statusProvider.getDomainStatus();
-	}
-
-}
+/**
+ * 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.domain.extension.impl;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+
+import org.yakindu.sct.domain.extension.DomainStatus;
+import org.yakindu.sct.domain.extension.IDomain;
+import org.yakindu.sct.domain.extension.IDomainDocumentationProvider;
+import org.yakindu.sct.domain.extension.IDomainStatusProvider;
+
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ *
+ */
+public class DomainImpl implements IDomain {
+
+	private String domainID;
+	private String name;
+	private String description;
+	private URL imagePath;
+	private IDomainStatusProvider statusProvider;
+	private IDomainDocumentationProvider documentationProvider;
+	private Iterable<ModuleContribution> modules;
+	private LoadingCache<CacheKey, Injector> injectorCache;
+
+	protected static class CacheKey {
+		private String feature;
+		private String[] options;
+
+		public CacheKey(String feature, String[] options) {
+			this.feature = feature;
+			this.options = options;
+		}
+
+		@Override
+		public int hashCode() {
+			final int prime = 31;
+			int result = 1;
+			result = prime * result + ((feature == null) ? 0 : feature.hashCode());
+			result = prime * result + Arrays.hashCode(options);
+			return result;
+		}
+
+		@Override
+		public boolean equals(Object obj) {
+			if (this == obj)
+				return true;
+			if (obj == null)
+				return false;
+			if (getClass() != obj.getClass())
+				return false;
+			CacheKey other = (CacheKey) obj;
+			if (feature == null) {
+				if (other.feature != null)
+					return false;
+			} else if (!feature.equals(other.feature))
+				return false;
+			if (!Arrays.equals(options, other.options))
+				return false;
+			return true;
+		}
+
+		public String getFeature() {
+			return feature;
+		}
+
+		public String[] getOptions() {
+			return options;
+		}
+
+	}
+
+	public DomainImpl(String domainID, String name, String description, URL imagePath,
+			Iterable<ModuleContribution> modules) {
+		this(domainID, name, description, imagePath, modules, new IDomainStatusProvider.DefaultDomainStatusProvider(),
+				new IDomainDocumentationProvider.NullImpl());
+	}
+
+	public DomainImpl(String domainID, String name, String description, URL imagePath,
+			Iterable<ModuleContribution> modules, IDomainStatusProvider provider,
+			IDomainDocumentationProvider docuProvider) {
+		this.domainID = domainID;
+		this.name = name;
+		this.description = description;
+		this.imagePath = imagePath;
+		this.modules = modules;
+		this.statusProvider = provider;
+		this.documentationProvider = docuProvider;
+		initializeCache();
+	}
+
+	protected void initializeCache() {
+		injectorCache = CacheBuilder.newBuilder().build(new CacheLoader<CacheKey, Injector>() {
+			@Override
+			public Injector load(CacheKey key) throws Exception {
+				return createInjector(key.getFeature(), key.getOptions());
+			}
+		});
+	}
+
+	@Override
+	public String getDomainID() {
+		return domainID;
+	}
+
+	@Override
+	public String getName() {
+		return name;
+	}
+
+	@Override
+	public String getDescription() {
+		return description;
+	}
+
+	@Override
+	public URL getImagePath() {
+		return imagePath;
+	}
+
+	@Override
+	public Injector getInjector(String feature, boolean useCache, String... options) {
+		if (useCache) {
+			try {
+				return injectorCache.get(new CacheKey(feature, options));
+			} catch (ExecutionException e) {
+				e.printStackTrace();
+			}
+		}
+		return createInjector(feature, options);
+	}
+
+	@Override
+	public Injector getInjector(String feature, String... options) {
+		return getInjector(feature, true, options);
+	}
+
+	public Injector createInjector(String feature, String... options) {
+		return Guice.createInjector(getModule(feature, options));
+	}
+
+	@Override
+	public Module getModule(String feature, String... options) {
+		List<Module> modules = new ArrayList<>();
+		for (ModuleContribution module : this.modules) {
+			if (feature.equals(module.getFeature())) {
+				modules.add(module.getModuleProvider().getModule(options));
+			}
+		}
+		Module result = new LazyCombiningModule(modules);
+		return result;
+
+	}
+
+	@Override
+	public DomainStatus getAvailabilityStatus() {
+		return statusProvider.getDomainStatus();
+	}
+
+	@Override
+	public IDomainDocumentationProvider getDocumentationProvider() {
+		return documentationProvider;
+	}
+
+}

+ 8 - 9
plugins/org.yakindu.sct.ui.editor/build.properties

@@ -1,9 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .,\
-               plugin.xml,\
-               icons/,\
-               templates/,\
-               images/
-src.includes = icons/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               templates/
+src.includes = icons/

BIN
plugins/org.yakindu.sct.ui.editor/images/pro.png


+ 0 - 2
plugins/org.yakindu.sct.ui.editor/plugin.xml

@@ -1,9 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
-   <extension-point id="org.yakindu.sct.ui.wizard.create.contribution" name="SCT CReate Wizard Contribution" schema="schema/org.yakindu.sct.ui.wizard.create.contribution.exsd"/>
     <!-- Editor -->
-  
    <extension
          point="org.eclipse.ui.editors">
       <editor

+ 0 - 102
plugins/org.yakindu.sct.ui.editor/schema/org.yakindu.sct.ui.wizard.create.contribution.exsd

@@ -1,102 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.ui.editor" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.ui.editor" id="org.yakindu.sct.ui.wizard.create.contribution" name="SCT CReate Wizard Contribution"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence minOccurs="0" maxOccurs="1">
-            <element ref="class"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="class">
-      <complexType>
-         <attribute name="class" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.ui.editor.wizards.CreationWizardContribution"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>

+ 13 - 28
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizard.java

@@ -98,7 +98,6 @@ public class CreationWizard extends Wizard implements INewWizard {
 	@Override
 	public void addPages() {
 		initModelCreationPage();
-		
 		initDomainWizardPage();
 
 	}
@@ -116,11 +115,12 @@ public class CreationWizard extends Wizard implements INewWizard {
 		domainWizardPage.setTitle("Select Statechart Domain");
 		domainWizardPage.setDescription("Select the domain you want to create a statechart for.");
 		domainWizardPage.setImageDescriptor(StatechartImages.LOGO.imageDescriptor());
-		addPage(domainWizardPage);
+		if (DomainRegistry.getDomains().size() > 1)
+			addPage(domainWizardPage);
 	}
 
-	public static class DiagramCreationDesccription{
- 
+	public static class DiagramCreationDesccription {
+
 		private URI uri;
 		private String domainID;
 
@@ -136,17 +136,17 @@ public class CreationWizard extends Wizard implements INewWizard {
 		public String getDomainID() {
 			return domainID;
 		}
-		
+
 	}
 	
 	@Override
 	public boolean performFinish() {
 		final DiagramCreationDesccription create = getDiagramDescription();
-		
+
 		IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
 			@Override
 			protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
-				
+
 				diagram = createDiagram(create, monitor);
 				if (isOpenOnCreate() && diagram != null) {
 					try {
@@ -171,13 +171,11 @@ public class CreationWizard extends Wizard implements INewWizard {
 		URI uri = modelCreationPage.getURI();
 		final String domainID = domainWizardPage != null ? domainWizardPage.getDomainID()
 				: BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID.getDefaultValueLiteral();
-		
-		final DiagramCreationDesccription create = new DiagramCreationDesccription(uri,domainID);
+
+		final DiagramCreationDesccription create = new DiagramCreationDesccription(uri, domainID);
 		return create;
 	}
 
-	
-
 	protected boolean openDiagram(Resource diagram) throws PartInitException {
 		String path = diagram.getURI().toPlatformString(true);
 		IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
@@ -206,12 +204,6 @@ public class CreationWizard extends Wizard implements INewWizard {
 		return false;
 	}
 
-	/**
-	 * Returns the Editor ID of the editor to open, after a new diagram was
-	 * created Override for subclasses with custom editors.
-	 * 
-	 * @return the ID of the editor.
-	 */
 	protected String getEditorID() {
 		return StatechartDiagramEditor.ID;
 	}
@@ -219,15 +211,16 @@ public class CreationWizard extends Wizard implements INewWizard {
 	protected Resource createDiagram(final DiagramCreationDesccription create, IProgressMonitor progressMonitor) {
 		TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
 		progressMonitor.beginTask("Creating diagram file ...", 3);
-		
+
 		final Resource resource = editingDomain.getResourceSet().createResource(create.getModelURI());
-		
+
 		AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain,
 				"Creating diagram file ...", Collections.EMPTY_LIST) {
 			@Override
 			protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
 					throws ExecutionException {
-				IModelCreator creator = DomainRegistry.getDomain(create.getDomainID()).getInjector(IDomain.FEATURE_EDITOR).getInstance(IModelCreator.class);
+				IModelCreator creator = DomainRegistry.getDomain(create.getDomainID())
+						.getInjector(IDomain.FEATURE_EDITOR).getInstance(IModelCreator.class);
 				creator.createStatechartModel(resource, preferencesHint);
 				Statechart statechart = (Statechart) EcoreUtil.getObjectByType(resource.getContents(),
 						SGraphPackage.Literals.STATECHART);
@@ -286,15 +279,7 @@ public class CreationWizard extends Wizard implements INewWizard {
 		this.openOnCreate = openOnCreate;
 	}
 
-	/**
-	 * Set the preference hint for preferences of new created diagrams
-	 * 
-	 * @param hint
-	 *            the PreferenceHint for the PreferenceStore (mostly from
-	 *            Activator)
-	 */
 	protected void setPreferenceHint(PreferencesHint hint) {
 		preferencesHint = hint;
 	}
-
 }

+ 0 - 23
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizardContribution.java

@@ -1,23 +0,0 @@
-/**
- * Copyright (c) 2010 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.swt.widgets.Composite;
-/**
- * 
- * @author Johannes Dicks - Initial contribution and API
- * 
- */
-public interface CreationWizardContribution {
-
-	void toDomainWizardPage(Composite composite);
-
-}

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

@@ -10,11 +10,9 @@
  */
 package org.yakindu.sct.ui.editor.wizards;
 
+import java.net.URL;
 import java.util.List;
 
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -28,10 +26,11 @@ 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.browser.Browser;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
 import org.yakindu.base.base.BasePackage;
 import org.yakindu.sct.domain.extension.DomainRegistry;
 import org.yakindu.sct.domain.extension.IDomain;
@@ -45,16 +44,13 @@ import org.yakindu.sct.ui.editor.DiagramActivator;
 public class DomainWizardPage extends WizardPage {
 
 	private ComboViewer domainCombo;
-
-	private Label description;
-
-	private Label image;
-
 	private Object domainDescriptors;
+	private Browser browser;
 
 	protected DomainWizardPage(String pageName) {
 		this(pageName, DomainRegistry.getDomains());
 	}
+
 	protected DomainWizardPage(String pageName, List<IDomain> domainDescriptors) {
 		super(pageName);
 		this.domainDescriptors = domainDescriptors;
@@ -64,18 +60,7 @@ public class DomainWizardPage extends WizardPage {
 		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);
+		domainCombo = new ComboViewer(composite, SWT.READ_ONLY);
 		GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(domainCombo.getCombo());
 		domainCombo.setContentProvider(new ArrayContentProvider());
 		domainCombo.setLabelProvider(new LabelProvider() {
@@ -83,23 +68,10 @@ public class DomainWizardPage extends WizardPage {
 			public String getText(Object element) {
 				return ((IDomain) element).getName();
 			}
-		});
-		domainCombo.setInput(domainDescriptors);
-
-		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) {
-				IDomain domain = unwrap(event.getSelection());
-				description.setText(domain.getDescription());
-				image.setImage(asImage(domain));
-				domainSelectionGroup.layout();
-
-			}
 
-			private Image asImage(IDomain domain) {
+			@Override
+			public Image getImage(Object element) {
+				IDomain domain = unwrap(domainCombo.getSelection());
 				ImageRegistry imageRegistry = DiagramActivator.getDefault().getImageRegistry();
 				Image image = imageRegistry.get(domain.getImagePath().toString());
 				if (image == null)
@@ -107,29 +79,24 @@ public class DomainWizardPage extends WizardPage {
 							ImageDescriptor.createFromURL(domain.getImagePath()).createImage());
 				return imageRegistry.get(domain.getImagePath().toString());
 			}
-
 		});
-		
-		trySelectDefaultDomain();
 
-		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry()
-				.getConfigurationElementsFor("org.yakindu.sct.ui.wizard.create.contribution");
-		if (configurationElements.length > 0) {
-
-			Label spacer2 = new Label(domainSelectionGroup, SWT.NONE);
-			GridDataFactory.fillDefaults().span(2, 1).applyTo(spacer2);
-			for (IConfigurationElement iConfigurationElement : configurationElements) {
-				try {
-					CreationWizardContribution contribution = (CreationWizardContribution) iConfigurationElement
-							.createExecutableExtension("class");
-					contribution.toDomainWizardPage(composite);
-				} catch (CoreException e) {
-					e.printStackTrace();
-				}
+		domainCombo.setInput(domainDescriptors);
+		final Composite composite2 = new Composite(composite, SWT.BORDER);
+		composite2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+		composite2.setLayout(new FillLayout());
+		browser = new Browser(composite2, SWT.NONE);
+		domainCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+			public void selectionChanged(SelectionChangedEvent event) {
+				URL url = unwrap(domainCombo.getSelection()).getDocumentationProvider().getDocumentationURL();
+				if (url != null)
+					browser.setUrl(url.toString());
 			}
-		}
+		});
+		setControl(composite);
+		trySelectDefaultDomain();
 	}
-	
+
 	private void trySelectDefaultDomain() {
 		try {
 			domainCombo.setSelection(new StructuredSelection(
@@ -141,14 +108,32 @@ public class DomainWizardPage extends WizardPage {
 		}
 	}
 
+	private boolean visible = false;
+
+	@Override
+	public void setVisible(boolean visible) {
+		this.visible = true;
+		super.setVisible(visible);
+		if (!visible) {
+			browser.setUrl("about:blank");
+		}
+	}
+
+	public boolean domainSelected() {
+		return visible;
+	}
+
+	public boolean isPageComplete() {
+		return super.isPageComplete() && visible;
+	}
+
 	public String getDomainID() {
 		return unwrap(domainCombo.getSelection()).getDomainID();
 	}
 
-	private IDomain unwrap(ISelection selection) {
+	protected IDomain unwrap(ISelection selection) {
 		IDomain domain = (IDomain) ((StructuredSelection) selection).getFirstElement();
 		return domain;
 	}
 
 }
-

+ 1 - 1
plugins/org.yakindu.sct.ui/src/org/yakindu/sct/ui/wizards/ModelCreationWizardPage.java

@@ -36,7 +36,7 @@ public class ModelCreationWizardPage extends WizardNewFileCreationPage {
 	protected String getExtension() {
 		return fileExtension;
 	}
-
+	
 	public URI getURI() {
 		return URI.createPlatformResourceURI(URI.encodeFragment(getFilePath().toString(),true), false);
 	}