Revision 0a534d09
Added by Patrick Plitzner over 10 years ago
- adapted sub classes of AbstractPostOperation
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java | ||
---|---|---|
3 | 3 |
import java.util.Iterator; |
4 | 4 |
import java.util.Set; |
5 | 5 |
|
6 |
import org.eclipse.core.commands.ExecutionEvent; |
|
7 | 6 |
import org.eclipse.core.commands.ExecutionException; |
8 | 7 |
import org.eclipse.core.commands.operations.IUndoContext; |
9 | 8 |
import org.eclipse.core.runtime.IAdaptable; |
10 | 9 |
import org.eclipse.core.runtime.IProgressMonitor; |
11 | 10 |
import org.eclipse.core.runtime.IStatus; |
12 |
import org.eclipse.core.runtime.Status; |
|
13 |
import org.eclipse.ui.IEditorInput; |
|
14 |
import org.eclipse.ui.IEditorReference; |
|
15 |
import org.eclipse.ui.IPerspectiveDescriptor; |
|
16 |
import org.eclipse.ui.IViewPart; |
|
17 |
import org.eclipse.ui.IViewReference; |
|
18 | 11 |
import org.eclipse.ui.IWorkbenchPage; |
19 |
import org.eclipse.ui.PartInitException; |
|
20 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
21 | 12 |
|
22 | 13 |
import eu.etaxonomy.cdm.api.application.CdmApplicationController; |
23 | 14 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
25 | 16 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
26 | 17 |
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException; |
27 | 18 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
28 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
29 | 19 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
30 | 20 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
31 |
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput; |
|
32 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
|
33 | 21 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
34 | 22 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
35 | 23 |
|
36 | 24 |
public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{ |
37 | 25 |
//private Taxon taxon; |
38 |
private Classification classification; |
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
26 |
private final Classification classification;
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
43 | 31 |
public DeleteTaxonOperation(String label, IUndoContext undoContext, |
44 | 32 |
Taxon taxon, Classification classification, IWorkbenchPage activePage, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) { |
45 | 33 |
super(label, undoContext, taxon, activePage, postOperationEnabled, conversationEnabled); |
46 |
this.taxon = taxon;
|
|
47 |
|
|
34 |
this.element = taxon;
|
|
35 |
|
|
48 | 36 |
Set<TaxonNode> nodes = taxon.getTaxonNodes(); |
49 | 37 |
if (nodes.size() == 1 && classification == null){ |
50 | 38 |
this.taxonNode = nodes.iterator().next(); |
... | ... | |
60 | 48 |
//TODO |
61 | 49 |
} |
62 | 50 |
this.classification = classification; |
63 |
|
|
51 |
|
|
64 | 52 |
} |
65 | 53 |
|
66 |
|
|
54 |
|
|
67 | 55 |
|
68 | 56 |
@Override |
69 | 57 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
70 | 58 |
throws ExecutionException { |
71 |
|
|
59 |
|
|
72 | 60 |
monitor.worked(20); |
73 | 61 |
bind(); |
74 |
|
|
75 |
|
|
62 |
|
|
63 |
|
|
76 | 64 |
CdmApplicationController controller; |
77 |
|
|
65 |
|
|
78 | 66 |
controller = (CdmApplicationController) CdmStore.getCurrentApplicationConfiguration(); |
79 |
|
|
67 |
|
|
80 | 68 |
ITaxonService service = controller.getTaxonService(); |
81 | 69 |
try { |
82 |
|
|
83 |
service.deleteTaxon(taxon, new TaxonDeletionConfigurator(), classification);
|
|
84 |
|
|
70 |
|
|
71 |
service.deleteTaxon(element, new TaxonDeletionConfigurator(), classification);
|
|
72 |
|
|
85 | 73 |
} catch (DataChangeNoRollbackException e) { |
86 | 74 |
// TODO Auto-generated catch block |
87 | 75 |
e.printStackTrace(); |
88 |
|
|
76 |
|
|
89 | 77 |
} |
90 |
|
|
78 |
|
|
91 | 79 |
//closeObsoleteEditor(taxon); |
92 | 80 |
monitor.worked(40); |
93 |
|
|
94 |
|
|
81 |
|
|
82 |
|
|
95 | 83 |
return postExecute(null); |
96 | 84 |
} |
97 | 85 |
|
... | ... | |
108 | 96 |
// TODO Auto-generated method stub |
109 | 97 |
return null; |
110 | 98 |
} |
111 |
|
|
112 |
|
|
99 |
|
|
100 |
|
|
113 | 101 |
} |
Also available in: Unified diff