Search in sources :

Example 86 with 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, Statechart sc) {
    Region region = SGraphFactory.eINSTANCE.createRegion();
    region.setName(name);
    if (sc != null)
        sc.getRegions().add(region);
    return region;
}
Also used : Region(org.yakindu.sct.model.sgraph.Region)

Example 87 with 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;
}
Also used : Region(org.yakindu.sct.model.sgraph.Region)

Example 88 with 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)));
}
Also used : SetRequest(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) SetValueCommand(org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand) Region(org.yakindu.sct.model.sgraph.Region)

Example 89 with Region

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);
}
Also used : Vertex(org.yakindu.sct.model.sgraph.Vertex) Node(org.eclipse.gmf.runtime.notation.Node) Transition(org.yakindu.sct.model.sgraph.Transition) Region(org.yakindu.sct.model.sgraph.Region) View(org.eclipse.gmf.runtime.notation.View) Exit(org.yakindu.sct.model.sgraph.Exit)

Example 90 with Region

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;
}
Also used : State(org.yakindu.sct.model.sgraph.State) EObject(org.eclipse.emf.ecore.EObject) Statechart(org.yakindu.sct.model.sgraph.Statechart) Region(org.yakindu.sct.model.sgraph.Region)

Aggregations

Region (org.yakindu.sct.model.sgraph.Region)93 Test (org.junit.Test)71 State (org.yakindu.sct.model.sgraph.State)63 Statechart (org.yakindu.sct.model.sgraph.Statechart)59 SGraphTestFactory._createRegion (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createRegion)57 SGraphTestFactory._createStatechart (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createStatechart)57 ExecutionFlow (org.yakindu.sct.model.sexec.ExecutionFlow)53 SGraphTestFactory._createState (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createState)51 ExecutionState (org.yakindu.sct.model.sexec.ExecutionState)48 StextTestFactory._createInterfaceScope (org.yakindu.sct.model.stext.test.util.StextTestFactory._createInterfaceScope)48 VariableDefinition (org.yakindu.sct.model.stext.stext.VariableDefinition)47 StextTestFactory._createVariableDefinition (org.yakindu.sct.model.stext.test.util.StextTestFactory._createVariableDefinition)47 InterfaceScope (org.yakindu.sct.model.stext.stext.InterfaceScope)41 Entry (org.yakindu.sct.model.sgraph.Entry)38 Sequence (org.yakindu.sct.model.sexec.Sequence)36 SCTTestUtil.findState (org.yakindu.sct.model.sexec.transformation.test.SCTTestUtil.findState)29 SGraphTestFactory._createEntry (org.yakindu.sct.model.sgraph.test.util.SGraphTestFactory._createEntry)29 Transition (org.yakindu.sct.model.sgraph.Transition)26 FinalState (org.yakindu.sct.model.sgraph.FinalState)25 Reaction (org.yakindu.sct.model.sexec.Reaction)22