|
@@ -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();
|