use of org.talend.designer.core.ui.editor.cmd.DeleteNoteCommand in project tdi-studio-se by Talend.
the class NoteEditPolicy method createDeleteCommand.
@Override
protected Command createDeleteCommand(GroupRequest request) {
Object parent = getHost().getParent().getModel();
if (!(parent instanceof Process)) {
return null;
}
Note note = (Note) getHost().getModel();
if (note.isReadOnly()) {
return null;
}
List<Note> noteList = new ArrayList<Note>();
for (int i = 0; i < request.getEditParts().size(); i++) {
if (request.getEditParts().get(i) instanceof NoteEditPart) {
noteList.add(((Note) ((NoteEditPart) request.getEditParts().get(i)).getModel()));
}
}
DeleteNoteCommand deleteCommand = new DeleteNoteCommand((Process) parent, noteList);
return deleteCommand;
}
Aggregations