Search in sources :

Example 1 with DestroyElementCommand

use of org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand in project statecharts by Yakindu.

the class VertexEditHelper method getDestroyDependentsCommand.

@Override
protected ICommand getDestroyDependentsCommand(DestroyDependentsRequest req) {
    Vertex elementToDestroy = (Vertex) req.getElementToDestroy();
    EList<Transition> incomingTransitions = elementToDestroy.getIncomingTransitions();
    if (incomingTransitions.size() != 0) {
        CompositeCommand compoundCommand = new CompositeCommand("Delete vertex");
        for (Transition transition : incomingTransitions) {
            DestroyElementCommand destroyCommand = new DestroyElementCommand(new DestroyElementRequest(transition, false));
            compoundCommand.add(destroyCommand);
        }
        return compoundCommand;
    }
    return super.getDestroyDependentsCommand(req);
}
Also used : Vertex(org.yakindu.sct.model.sgraph.Vertex) DestroyElementRequest(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) Transition(org.yakindu.sct.model.sgraph.Transition) DestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand) CompositeCommand(org.eclipse.gmf.runtime.common.core.command.CompositeCommand)

Aggregations

CompositeCommand (org.eclipse.gmf.runtime.common.core.command.CompositeCommand)1 DestroyElementCommand (org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand)1 DestroyElementRequest (org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest)1 Transition (org.yakindu.sct.model.sgraph.Transition)1 Vertex (org.yakindu.sct.model.sgraph.Vertex)1