Iterator selectedObjects =
((IStructuredSelection) viewer.getSelection()).iterator();
while (selectedObjects.hasNext())
{
EditPart childEditPart = (EditPart) selectedObjects.next();
// if selected one is a node or compound delete is called
if (childEditPart instanceof ChsCompoundEditPart)
{
RemoveCompoundCommand command = new RemoveCompoundCommand();
command.setCompound((CompoundModel) childEditPart.getModel());
command.execute();
}
}
}