use of org.yakindu.sct.model.sgraph.Exit in project statecharts by Yakindu.
the class SGraphJavaValidationTest method exitWithoutIncomingTransition.
/**
* An exit node should have at leat one incoming transition.
*/
@Test
public void exitWithoutIncomingTransition() {
prepareStateTest();
Region subRegion = factory.createRegion();
state.getRegions().add(subRegion);
Exit exit = factory.createExit();
subRegion.getVertices().add(exit);
assertFalse(validate(exit));
assertWarning(diagnostics, ISSUE_EXIT_WITHOUT_IN_TRANS);
}
use of org.yakindu.sct.model.sgraph.Exit 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);
}
Aggregations