import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.model.common.ITreeNode;
+import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
}
Iterator selectionIterator = selection.iterator();
- Set<ITreeNode> treeNodes = new HashSet<ITreeNode>();
+ Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
while (selectionIterator.hasNext()){
Object object = selectionIterator.next();
- if(object instanceof ITreeNode) {
- treeNodes.add((ITreeNode) object);
+ if(object instanceof ITaxonTreeNode) {
+ treeNodes.add((ITaxonTreeNode) object);
}
}
boolean allEditorsClosed = true;
- for (ITreeNode treeNode : treeNodes){
+ for (ITaxonTreeNode treeNode : treeNodes){
if(treeNode instanceof TaxonNode) {
allEditorsClosed &= closeObsoleteEditor((TaxonNode) treeNode);
}
if (allEditorsClosed){
- TaxonNode taxonNode = (TaxonNode)treeNodes.iterator().next();
- operation = new DeleteOperation(
- event.getCommand().getName(), NavigationUtil.getUndoContext(),
- taxonNode, new TaxonDeletionConfigurator(), taxonNavigator, taxonNavigator);
-
- NavigationUtil.executeOperation(operation);
+ ITaxonTreeNode treeNode = treeNodes.iterator().next();
+ if (treeNode instanceof Classification){
+ operation = new DeleteOperation(
+ event.getCommand().getName(), NavigationUtil.getUndoContext(),
+ treeNodes, new TaxonDeletionConfigurator(), taxonNavigator, taxonNavigator);
+
+ NavigationUtil.executeOperation(operation);
+ }else {
+ TaxonNode taxonNode = (TaxonNode)treeNode;
+ operation = new DeleteOperation(
+ event.getCommand().getName(), NavigationUtil.getUndoContext(),
+ taxonNode, new TaxonDeletionConfigurator(), taxonNavigator, taxonNavigator);
+
+ NavigationUtil.executeOperation(operation);
+ }
}
*/
public class DeleteOperation extends AbstractPersistentPostOperation{
- private Set<ITreeNode> treeNodes;
+ private Set<ITaxonTreeNode> treeNodes;
private TaxonDeletionConfigurator config;
* @param treeNodes a {@link java.util.Set} object.
*/
public DeleteOperation(String label, IUndoContext undoContext,
- ITreeNode taxonNode, TaxonDeletionConfigurator config,
+ ITaxonTreeNode taxonNode, TaxonDeletionConfigurator config,
IPostOperationEnabled postOperationEnabled,
IConversationEnabled conversationEnabled) {
super(label, undoContext, postOperationEnabled, conversationEnabled);
* @param treeNodes a {@link java.util.Set} object.
*/
public DeleteOperation(String label, IUndoContext undoContext,
- Set<ITreeNode> treeNodes, TaxonDeletionConfigurator config,
+ Set<ITaxonTreeNode> treeNodes, TaxonDeletionConfigurator config,
IPostOperationEnabled postOperationEnabled,
IConversationEnabled conversationEnabled) {
super(label, undoContext, postOperationEnabled, conversationEnabled);