EditPart childEditPart = (EditPart) selectedObjects.next();
// if selected one is a node or compound DeleteCommand is called
if (childEditPart instanceof ChsNodeEditPart)
{
NodeModel node = (NodeModel) childEditPart.getModel();
DeleteCommand command = new DeleteCommand();
command.setChild(node);
EditPart parent = childEditPart.getParent();
command.setParent((CompoundModel) parent.getModel());
command.execute();
}
// else if it is an edge, DeleteConnectionCommand is called
else if (childEditPart instanceof ChsEdgeEditPart)
{
{
DeleteConnectionCommand command
= new DeleteConnectionCommand();
command.setConnectionModel(childEditPart.getModel());
command.execute();
}
}
}
}