public class DeleteComponentEditPolicy extends ComponentEditPolicy {
@Override
protected Command createDeleteCommand(GroupRequest deleteRequest) {
if (getHost() instanceof VertexEditPart) {
VertexEditPart part = (VertexEditPart) getHost();
List<?> incoming = part.getSourceConnections();
List<?> outgoing = part.getTargetConnections();
if (!incoming.isEmpty() || !outgoing.isEmpty()) {
CompoundCommand compound = new CompoundCommand();
for (Object obj : incoming) {
DeleteCommand command = new DeleteCommand(
((EdgeEditPart) obj).getModel());