Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-05-04 11:35:32 +0000
committerHenrik Rentz-Reichert2012-05-04 11:35:32 +0000
commit6a9688f5111a152d129cef15d91035ca861671d9 (patch)
tree5713659d7d363e2514c1eafe75bd89e41f313ea1 /plugins/org.eclipse.etrice.ui.behavior
parent2517669d84adaa0161e2be33eed228c76dc77a8b (diff)
downloadorg.eclipse.etrice-6a9688f5111a152d129cef15d91035ca861671d9.tar.gz
org.eclipse.etrice-6a9688f5111a152d129cef15d91035ca861671d9.tar.xz
org.eclipse.etrice-6a9688f5111a152d129cef15d91035ca861671d9.zip
[ui.behavior] bug fixes for inheritance
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.behavior')
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ProviderDispatcher.java1
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java3
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java38
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java2
5 files changed, 33 insertions, 13 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ProviderDispatcher.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ProviderDispatcher.java
index c5aa4e3a6..2edf8aaff 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ProviderDispatcher.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/ProviderDispatcher.java
@@ -29,7 +29,6 @@ import org.eclipse.etrice.ui.behavior.support.StateGraphSupport;
import org.eclipse.etrice.ui.behavior.support.StateSupport;
import org.eclipse.etrice.ui.behavior.support.TrPointSupport;
import org.eclipse.etrice.ui.behavior.support.TransitionSupport;
-import org.eclipse.etrice.ui.common.support.AutoUpdateFeature;
import org.eclipse.graphiti.dt.IDiagramTypeProvider;
import org.eclipse.graphiti.features.IAddFeature;
import org.eclipse.graphiti.features.ICreateConnectionFeature;
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
index 644cb5d0c..512cf0bf1 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/ChoicePointSupport.java
@@ -375,7 +375,7 @@ public class ChoicePointSupport {
}
ChoicePoint cp = (ChoicePoint) bo;
- boolean inherited = SupportUtil.isInherited(cp, containerShape);
+ boolean inherited = SupportUtil.isInherited(cp, (ContainerShape)containerShape.eContainer());
Color dark = manageColor(inherited? INHERITED_COLOR:DARK_COLOR);
updateFigure(cp, containerShape, dark, manageColor(BRIGHT_COLOR));
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
index b8a6ec5bb..dd9586003 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/DiagramUpdateFeature.java
@@ -96,7 +96,8 @@ public class DiagramUpdateFeature extends AbstractUpdateFeature {
boolean changed = update(tree);
// remove unused state graph shapes
- for (Shape sgshape : getDiagram().getChildren()) {
+ ArrayList<Shape> children = new ArrayList<Shape>(getDiagram().getChildren());
+ for (Shape sgshape : children) {
if (!usedShapes.contains(sgshape)) {
IRemoveContext rc = new RemoveContext(sgshape);
IRemoveFeature removeFeature = getFeatureProvider().getRemoveFeature(rc);
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
index 47d350aa8..0350bb450 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/StateSupport.java
@@ -12,6 +12,8 @@
package org.eclipse.etrice.ui.behavior.support;
+import java.util.HashMap;
+
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -500,22 +502,40 @@ public class StateSupport {
boolean inherited = SupportUtil.isInherited(getDiagram(), s);
if (inherited) {
ActorClass ac = SupportUtil.getActorClass(getDiagram());
- RefinedState rs = null;
- // do we already have a RefinedState pointing to s?
+ HashMap<State, RefinedState> target2rs = new HashMap<State, RefinedState>();
for (State st : ac.getStateMachine().getStates()) {
if (st instanceof RefinedState)
- if (((RefinedState) st).getTarget()==s) {
- rs = (RefinedState) st;
- break;
- }
+ target2rs.put(((RefinedState) st).getTarget(), (RefinedState) st);
}
- // if not so create one
- if (rs==null) {
+ RefinedState rs = null;
+
+ // do we already have a RefinedState pointing to s?
+ if (target2rs.containsKey(s)) {
+ rs = target2rs.get(s);
+ }
+ else {
+ // we have to create one and place it in the best fitting context
+ StateGraph sg = null;
+ State parent = s;
+ while (s.eContainer().eContainer() instanceof State) {
+ parent = (State) s.eContainer().eContainer();
+ if (target2rs.containsKey(parent)) {
+ RefinedState bestFitting = target2rs.get(parent);
+ if (bestFitting.getSubgraph()==null)
+ bestFitting.setSubgraph(RoomFactory.eINSTANCE.createStateGraph());
+ sg = bestFitting.getSubgraph();
+ break;
+ }
+ }
+
+ if (sg==null)
+ sg = ac.getStateMachine();
+
rs = RoomFactory.eINSTANCE.createRefinedState();
rs.setTarget(s);
- ac.getStateMachine().getStates().add(rs);
+ sg.getStates().add(rs);
}
s = rs;
}
diff --git a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
index 03b7a349b..39c508acd 100644
--- a/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
+++ b/plugins/org.eclipse.etrice.ui.behavior/src/org/eclipse/etrice/ui/behavior/support/TrPointSupport.java
@@ -622,7 +622,7 @@ public class TrPointSupport {
}
TrPoint tp = (TrPoint) bo;
- boolean inherited = SupportUtil.isInherited(tp, containerShape);
+ boolean inherited = SupportUtil.isInherited(tp, (ContainerShape)containerShape.eContainer());
Color dark = manageColor(inherited? INHERITED_COLOR:DARK_COLOR);
updateTrPointFigure(tp, containerShape, dark, manageColor(BRIGHT_COLOR));

Back to the top