use of org.yakindu.sct.model.sgraph.Region in project statecharts by Yakindu.
the class SGraphTestFactory method _createRegion.
public static Region _createRegion(String name, Statechart sc) {
Region region = SGraphFactory.eINSTANCE.createRegion();
region.setName(name);
if (sc != null)
sc.getRegions().add(region);
return region;
}
use of org.yakindu.sct.model.sgraph.Region in project statecharts by Yakindu.
the class SGraphTestFactory method _createRegion.
public static Region _createRegion(String name, State state) {
Region region = SGraphFactory.eINSTANCE.createRegion();
region.setName(name);
if (state != null)
state.getRegions().add(region);
return region;
}
use of org.yakindu.sct.model.sgraph.Region in project statecharts by Yakindu.
the class StateEditHelper method createOrthogonalState.
private ICommand createOrthogonalState(ConfigureRequest req) {
Region region = SGraphFactory.eINSTANCE.createRegion();
region.setName("r1");
Region region2 = SGraphFactory.eINSTANCE.createRegion();
region2.setName("r2");
return new SetValueCommand(new SetRequest(req.getElementToConfigure(), SGraphPackage.Literals.COMPOSITE_ELEMENT__REGIONS, com.google.common.collect.Lists.newArrayList(region, region2)));
}
use of org.yakindu.sct.model.sgraph.Region in project statecharts by Yakindu.
the class ExtractSubdiagramRefactoring method createExitPoint.
protected void createExitPoint(Edge edge, Diagram subdiagram) {
Transition transition = (Transition) edge.getElement();
// create semantic exit point
Region exitPointContainer = getExitPointContainer(transition);
Exit exitPoint = createSemanticExitPoint(transition);
// create node for exit point
View exitPointContainerView = helper.getViewForSemanticElement(exitPointContainer, subdiagram);
View exitPointRegionCompartment = ViewUtil.getChildBySemanticHint(exitPointContainerView, SemanticHints.REGION_COMPARTMENT);
Node exitNode = ViewService.createNode(exitPointRegionCompartment, exitPoint, SemanticHints.EXIT, preferencesHint);
// re-wire existing transition to new exit point
Vertex oldTransitionTarget = transition.getTarget();
transition.setTarget(exitPoint);
View oldEdgeTarget = edge.getTarget();
edge.setTarget(exitNode);
// create transition from selected state to former transition target
Transition exitPointTransition = SGraphFactory.eINSTANCE.createTransition();
exitPointTransition.setSource((State) subdiagram.getElement());
exitPointTransition.setTarget(oldTransitionTarget);
ViewService.createEdge(getContextObject(), oldEdgeTarget, exitPointTransition, SemanticHints.TRANSITION, preferencesHint);
addExitPointSpec(exitPointTransition, exitPoint);
}
use of org.yakindu.sct.model.sgraph.Region in project statecharts by Yakindu.
the class ExtractSubdiagramRefactoring method getOutermostParentRegion.
private Region getOutermostParentRegion(EObject element) {
while (!(element.eContainer() instanceof Statechart)) {
EObject container = element.eContainer();
if (container instanceof State) {
State parentState = (State) container;
if (parentState.equals(subdiagram.getElement())) {
return (Region) element;
}
element = parentState.getParentRegion();
} else {
element = element.eContainer();
}
}
return null;
}
Aggregations