2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.actions
.cdm
;
17 import org
.apache
.log4j
.Logger
;
18 import org
.eclipse
.core
.commands
.ExecutionException
;
19 import org
.eclipse
.core
.commands
.operations
.IOperationHistory
;
20 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
21 import org
.eclipse
.core
.commands
.operations
.IUndoableOperation
;
22 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
23 import org
.eclipse
.core
.runtime
.IStatus
;
24 import org
.eclipse
.jface
.action
.Action
;
25 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
28 import eu
.etaxonomy
.taxeditor
.ITaxEditorConstants
;
29 import eu
.etaxonomy
.taxeditor
.TaxEditorPlugin
;
30 import eu
.etaxonomy
.taxeditor
.controller
.GlobalController
;
31 import eu
.etaxonomy
.taxeditor
.operations
.DeleteTaxonOperation
;
34 * Delete this taxon from the CDM
39 public class DeleteTaxonAction
extends Action
{
40 private static final Logger logger
= Logger
41 .getLogger(DeleteTaxonAction
.class);
43 private static String text
= "Delete taxon from tree";
44 private ImageDescriptor image
= TaxEditorPlugin
.getDefault()
45 .getImageDescriptor(ITaxEditorConstants
.ACTIVE_DELETE_ICON
);
47 private IUndoContext undoContext
;
51 public DeleteTaxonAction() {
53 setImageDescriptor(image
);
55 undoContext
= GlobalController
.getWorkbenchUndoContext();
58 public DeleteTaxonAction(Taxon taxon
) {
65 IUndoableOperation operation
= new DeleteTaxonOperation
66 (this.getText(), undoContext
, taxon
);
68 GlobalController
.executeOperation(operation
);