Search in sources :

Example 1 with DeleteNoteCommand

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;
}
Also used : ArrayList(java.util.ArrayList) Process(org.talend.designer.core.ui.editor.process.Process) DeleteNoteCommand(org.talend.designer.core.ui.editor.cmd.DeleteNoteCommand)

Aggregations

ArrayList (java.util.ArrayList)1 DeleteNoteCommand (org.talend.designer.core.ui.editor.cmd.DeleteNoteCommand)1 Process (org.talend.designer.core.ui.editor.process.Process)1