1 package eu
.etaxonomy
.taxeditor
.editor
.name
.operation
;
3 import org
.eclipse
.core
.commands
.ExecutionException
;
4 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
5 import org
.eclipse
.core
.runtime
.IAdaptable
;
6 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
7 import org
.eclipse
.core
.runtime
.IStatus
;
8 import org
.eclipse
.ui
.IEditorInput
;
9 import org
.eclipse
.ui
.IEditorReference
;
10 import org
.eclipse
.ui
.IPerspectiveDescriptor
;
11 import org
.eclipse
.ui
.IViewPart
;
12 import org
.eclipse
.ui
.IWorkbenchPage
;
13 import org
.eclipse
.ui
.PartInitException
;
15 import eu
.etaxonomy
.cdm
.api
.conversation
.IConversationEnabled
;
16 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
17 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
18 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
19 import eu
.etaxonomy
.taxeditor
.editor
.TaxonEditorInput
;
20 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPersistentPostOperation
;
21 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
23 public class DeleteTaxonBaseOperation
extends AbstractPersistentPostOperation
{
25 private IWorkbenchPage activePage
;
27 public DeleteTaxonBaseOperation(String label
, IUndoContext undoContext
,
28 Taxon taxon
, IWorkbenchPage activePage
, IPostOperationEnabled postOperationEnabled
, IConversationEnabled conversationEnabled
) {
29 super(label
, undoContext
, postOperationEnabled
,
31 this.activePage
= activePage
;
36 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
37 throws ExecutionException
{
38 // TODO Auto-generated method stub
43 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
44 throws ExecutionException
{
45 // TODO Auto-generated method stub
50 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
51 throws ExecutionException
{
52 // TODO Auto-generated method stub
56 protected void closeObsoleteEditor(Taxon taxon
){
57 for (IEditorReference ref
: activePage
.getEditorReferences()) {
59 IViewPart view
= activePage
.findView("eu.etaxonomy.taxeditor.navigation.navigator");
62 IEditorInput input
= ref
.getEditorInput();
63 if (input
instanceof TaxonEditorInput
) {
64 TaxonNode node
= ((TaxonEditorInput
) input
).getTaxonNode();
65 if (taxonNode
.equals(node
)) {
66 activePage
.closeEditor(ref
.getEditor(false), false);
69 } catch (PartInitException e
) {