Revision 91333bc6
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/DeleteNodeHandlerE4.java | ||
---|---|---|
30 | 30 |
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.DeleteNodeOperation; |
31 | 31 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
32 | 32 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
33 |
import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4; |
|
33 | 34 |
|
34 | 35 |
/** |
35 | 36 |
* @author n.hoffmann |
36 | 37 |
* @created Dec 6, 2010 |
37 | 38 |
* @version 1.0 |
38 | 39 |
*/ |
39 |
public class DeleteNodeHandlerE4 extends AbstractPolytomousKeyNodeHandlerE4 {
|
|
40 |
public class DeleteNodeHandlerE4 extends RemotingCdmHandlerE4 {
|
|
40 | 41 |
|
41 | 42 |
|
42 | 43 |
private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE = Messages.DeleteNodeHandler_REALLY_DELETE; |
... | ... | |
117 | 118 |
if (!proceed) { |
118 | 119 |
return null; |
119 | 120 |
}else{ |
120 |
editor.doSave(AbstractUtility.getMonitor());
|
|
121 |
editor.save(AbstractUtility.getMonitor());
|
|
121 | 122 |
} |
122 | 123 |
} |
123 | 124 |
|
124 | 125 |
label = menuItem.getLocalizedLabel(); |
125 | 126 |
DeleteNodeOperation operation ; |
126 | 127 |
if (deleteChildren){ |
127 |
operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, true);
|
|
128 |
operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, true); |
|
128 | 129 |
}else{ |
129 |
operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editorPage, false);
|
|
130 |
operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, false); |
|
130 | 131 |
} |
131 | 132 |
|
132 | 133 |
return operation; |
... | ... | |
145 | 146 |
} |
146 | 147 |
|
147 | 148 |
@CanExecute |
148 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
|
|
149 |
public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
|
|
149 | 150 |
MHandledMenuItem menuItem){ |
150 | 151 |
boolean canExecute = false; |
151 |
canExecute = selection instanceof PolytomousKeyNode;
|
|
152 |
canExecute = selection!=null && !selection.isEmpty();
|
|
152 | 153 |
menuItem.setVisible(canExecute); |
153 | 154 |
return canExecute; |
154 | 155 |
} |
155 | 156 |
|
156 |
} |
|
157 |
} |
Also available in: Unified diff
ref #6908 Migrate remaining polytomous context menus and handlers