Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2019-09-06 01:32:29 -0400
committerHenrik Rentz-Reichert2019-09-06 01:46:11 -0400
commit46c91c2ca3c8478169fe099963ad7def57d3939a (patch)
tree1353f2a2b5703bf32e20cc27fbcc43fd9af0ae87
parentbc4a294298a95dd99b2bcd608874ed1a7ac04040 (diff)
downloadorg.eclipse.etrice-46c91c2ca3c8478169fe099963ad7def57d3939a.tar.gz
org.eclipse.etrice-46c91c2ca3c8478169fe099963ad7def57d3939a.tar.xz
org.eclipse.etrice-46c91c2ca3c8478169fe099963ad7def57d3939a.zip
Bug 550613 - [ui] Add initial transition in diagrams automatically
Adding an initial state and an initial transition. Change-Id: Ifa237a515e4885ebad3c13a35b910bac55f7fe00
-rw-r--r--features/org.eclipse.etrice.cdt-integration.feature/feature.xml2
-rw-r--r--features/org.eclipse.etrice.feature/feature.xml2
-rw-r--r--features/org.eclipse.etrice.fsm.feature/feature.xml2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/StateSupport.java20
4 files changed, 23 insertions, 3 deletions
diff --git a/features/org.eclipse.etrice.cdt-integration.feature/feature.xml b/features/org.eclipse.etrice.cdt-integration.feature/feature.xml
index f1473deef..48a18b66e 100644
--- a/features/org.eclipse.etrice.cdt-integration.feature/feature.xml
+++ b/features/org.eclipse.etrice.cdt-integration.feature/feature.xml
@@ -21,7 +21,7 @@
provider-name="%providerName"
plugin="org.eclipse.etrice.core.room.ui"
license-feature="org.eclipse.license"
- license-feature-version="2.0.1.v20180423-1114">
+ license-feature-version="2.0.2.v20181016-2210">
<description>
%description
diff --git a/features/org.eclipse.etrice.feature/feature.xml b/features/org.eclipse.etrice.feature/feature.xml
index 321a51fb6..8f1f90a1a 100644
--- a/features/org.eclipse.etrice.feature/feature.xml
+++ b/features/org.eclipse.etrice.feature/feature.xml
@@ -21,7 +21,7 @@
provider-name="%providerName"
plugin="org.eclipse.etrice.core.room.ui"
license-feature="org.eclipse.license"
- license-feature-version="2.0.1.v20180423-1114">
+ license-feature-version="2.0.2.v20181016-2210">
<description url="http://www.eclipse.org/etrice">
%description
diff --git a/features/org.eclipse.etrice.fsm.feature/feature.xml b/features/org.eclipse.etrice.fsm.feature/feature.xml
index ae471008d..24c738e31 100644
--- a/features/org.eclipse.etrice.fsm.feature/feature.xml
+++ b/features/org.eclipse.etrice.fsm.feature/feature.xml
@@ -20,7 +20,7 @@
version="2.0.0.qualifier"
provider-name="eTrice"
license-feature="org.eclipse.license"
- license-feature-version="2.0.1.v20180423-1114">
+ license-feature-version="2.0.2.v20181016-2210">
<description url="http://www.example.com/description">
%description
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/StateSupport.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/StateSupport.java
index 3134f8849..769021dea 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/StateSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/support/StateSupport.java
@@ -20,11 +20,13 @@ import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.etrice.core.fsm.fSM.FSMFactory;
+import org.eclipse.etrice.core.fsm.fSM.InitialTransition;
import org.eclipse.etrice.core.fsm.fSM.ModelComponent;
import org.eclipse.etrice.core.fsm.fSM.RefinedState;
import org.eclipse.etrice.core.fsm.fSM.SimpleState;
import org.eclipse.etrice.core.fsm.fSM.State;
import org.eclipse.etrice.core.fsm.fSM.StateGraph;
+import org.eclipse.etrice.core.fsm.fSM.StateTerminal;
import org.eclipse.etrice.core.fsm.fSM.TrPoint;
import org.eclipse.etrice.ui.behavior.fsm.dialogs.IFSMDialogFactory;
import org.eclipse.etrice.ui.behavior.fsm.dialogs.IStatePropertyDialog;
@@ -66,6 +68,7 @@ import org.eclipse.graphiti.features.context.IUpdateContext;
import org.eclipse.graphiti.features.context.impl.AddContext;
import org.eclipse.graphiti.features.context.impl.CreateConnectionContext;
import org.eclipse.graphiti.features.context.impl.RemoveContext;
+import org.eclipse.graphiti.features.context.impl.UpdateContext;
import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
import org.eclipse.graphiti.features.custom.ICustomFeature;
import org.eclipse.graphiti.features.impl.AbstractAddFeature;
@@ -548,6 +551,23 @@ public class StateSupport {
if (subGraphShape!=null) {
RoundedRectangle borderRect = (RoundedRectangle) container.getGraphicsAlgorithm().getGraphicsAlgorithmChildren().get(0);
updateHints(s, borderRect);
+
+ // also add an initial state
+ SimpleState initialState = FSMFactory.eINSTANCE.createSimpleState();
+ initialState.setName("InitialState");
+ newSG.getStates().add(initialState);
+
+ // add an initial transition
+ InitialTransition initialTransition = FSMFactory.eINSTANCE.createInitialTransition();
+ initialTransition.setName("init");
+ StateTerminal stateTerminal = FSMFactory.eINSTANCE.createStateTerminal();
+ stateTerminal.setState(initialState);
+ initialTransition.setTo(stateTerminal);
+ newSG.getTransitions().add(initialTransition);
+
+ // let update create the diagram elements
+ UpdateContext ctx = new UpdateContext(getDiagram());
+ getFeatureProvider().getUpdateFeature(ctx).update(ctx);
}
ContextSwitcher.switchTo(getDiagram(), s.getSubgraph());

Back to the top