Browse Source

Change initial statechart decl to use eventdriven and childfirst (#2076)

* Change initial statechart decl to use eventdriven and childfirst

* Remove project specific settings

* Remove JavaDoc
Rene Beckmann 7 years ago
parent
commit
d00d76219d

+ 2 - 1
plugins/org.yakindu.sct.ui.editor/META-INF/MANIFEST.MF

@@ -46,7 +46,8 @@ Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.gmf.runtime.emf.type.ui,
  org.eclipse.gmf.runtime.emf.type.ui,
  org.eclipse.xtend.lib,
  org.eclipse.xtend.lib,
  com.google.guava,
  com.google.guava,
- org.yakindu.sct.domain
+ org.yakindu.sct.domain,
+ org.yakindu.sct.model.stext.lib
 Bundle-ActivationPolicy: lazy
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Export-Package: org.yakindu.sct.ui.editor,
 Export-Package: org.yakindu.sct.ui.editor,

+ 4 - 3
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/factories/FactoryUtils.java

@@ -6,7 +6,7 @@
  * http://www.eclipse.org/legal/epl-v10.html
  * http://www.eclipse.org/legal/epl-v10.html
  * Contributors:
  * Contributors:
  * 	committers of YAKINDU - initial API and implementation
  * 	committers of YAKINDU - initial API and implementation
- * 
+ *
  */
  */
 package org.yakindu.sct.ui.editor.factories;
 package org.yakindu.sct.ui.editor.factories;
 
 
@@ -21,9 +21,9 @@ import org.eclipse.gmf.runtime.notation.View;
 
 
 /**
 /**
  * Convenience methods for semantic and notation model element creation.
  * Convenience methods for semantic and notation model element creation.
- * 
+ *
  * @author muelder
  * @author muelder
- * 
+ *
  */
  */
 public final class FactoryUtils {
 public final class FactoryUtils {
 
 
@@ -43,4 +43,5 @@ public final class FactoryUtils {
 		nameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
 		nameLabel.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
 		return nameLabel;
 		return nameLabel;
 	}
 	}
+
 }
 }

+ 25 - 6
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/DefaultModelCreator.java

@@ -6,7 +6,7 @@
  * http://www.eclipse.org/legal/epl-v10.html
  * http://www.eclipse.org/legal/epl-v10.html
  * Contributors:
  * Contributors:
  * 	committers of YAKINDU - initial API and implementation
  * 	committers of YAKINDU - initial API and implementation
- * 
+ *
  */
  */
 package org.yakindu.sct.ui.editor.wizards;
 package org.yakindu.sct.ui.editor.wizards;
 
 
@@ -25,18 +25,35 @@ import org.yakindu.sct.model.sgraph.SGraphFactory;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.Statechart;
 import org.yakindu.sct.model.sgraph.Transition;
 import org.yakindu.sct.model.sgraph.Transition;
+import org.yakindu.sct.model.stext.lib.StatechartAnnotations;
 import org.yakindu.sct.ui.editor.DiagramActivator;
 import org.yakindu.sct.ui.editor.DiagramActivator;
 import org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor;
 import org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor;
 import org.yakindu.sct.ui.editor.providers.SemanticHints;
 import org.yakindu.sct.ui.editor.providers.SemanticHints;
 
 
 /**
 /**
- * 
+ *
  * @author andreas muelder - Initial contribution and API
  * @author andreas muelder - Initial contribution and API
- * 
+ *
  */
  */
 public class DefaultModelCreator implements IModelCreator {
 public class DefaultModelCreator implements IModelCreator {
 
 
-	protected static final String INITIAL_SPECIFICATION = "@CycleBased(200)\n\ninterface:\n// Define events and\n// and variables here. \n//Use CTRL + Space for content assist.";
+	/* @formatter:off */
+	protected static final String INITIAL_SPECIFICATION = ""
+			+ "@" + StatechartAnnotations.EVENT_DRIVEN_ANNOTATION + "\n"
+			+ "// Use the event driven execution model.\n"
+			+ "// Runs a run-to-completion step\n" + "// each time an event is raised.\n"
+			+ "// Switch to cycle based behavior\n" + "// by specifying '@CycleBased(200)'\n"
+			+ "// instead.\n"
+			+ "\n"
+			+ "@" + StatechartAnnotations.CHILD_FIRST_ANNOTATION + "\n"
+			+ "// In composite states, execute\n" + "// child states first.\n"
+			+ "// @" + StatechartAnnotations.PARENT_FIRST_ANNOTATION + " does the opposite.\n"
+			+ "\n"
+			+ "interface:\n"
+			+ "// Define events\n"
+			+ "// and variables here. \n"
+			+ "// Use CTRL + Space for content assist.";
+	/* @formatter:on */
 	protected static final String INITIAL_REGION_NAME = "main region";
 	protected static final String INITIAL_REGION_NAME = "main region";
 	protected static final int INITIAL_REGION_WIDTH = 400;
 	protected static final int INITIAL_REGION_WIDTH = 400;
 	protected static final int INITIAL_REGION_HEIGHT = 400;
 	protected static final int INITIAL_REGION_HEIGHT = 400;
@@ -50,18 +67,20 @@ public class DefaultModelCreator implements IModelCreator {
 
 
 	/**
 	/**
 	 * Creates a Statechart with an initial Region and an initial State
 	 * Creates a Statechart with an initial Region and an initial State
-	 * 
+	 *
 	 * @return instanceof {@link Statechart}
 	 * @return instanceof {@link Statechart}
 	 */
 	 */
+	@Override
 	public void createStatechartModel(Resource resource) {
 	public void createStatechartModel(Resource resource) {
 		createStatechartModel(resource, DiagramActivator.DIAGRAM_PREFERENCES_HINT);
 		createStatechartModel(resource, DiagramActivator.DIAGRAM_PREFERENCES_HINT);
 	}
 	}
 
 
 	/**
 	/**
 	 * Creates a Statechart with an initial Region and an initial State
 	 * Creates a Statechart with an initial Region and an initial State
-	 * 
+	 *
 	 * @return instanceof {@link Statechart}
 	 * @return instanceof {@link Statechart}
 	 */
 	 */
+	@Override
 	public void createStatechartModel(Resource resource, PreferencesHint preferencesHint) {
 	public void createStatechartModel(Resource resource, PreferencesHint preferencesHint) {
 		// Create a statechart
 		// Create a statechart
 		Statechart statechart = SGraphFactory.eINSTANCE.createStatechart();
 		Statechart statechart = SGraphFactory.eINSTANCE.createStatechart();