Revision 0a534d09
Added by Patrick Plitzner over 10 years ago
- adapted sub classes of AbstractPostOperation
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java | ||
---|---|---|
17 | 17 |
import org.eclipse.core.runtime.IAdaptable; |
18 | 18 |
import org.eclipse.core.runtime.IProgressMonitor; |
19 | 19 |
import org.eclipse.core.runtime.IStatus; |
20 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
21 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
22 | 20 |
|
23 |
import eu.etaxonomy.cdm.api.application.CdmApplicationController; |
|
24 | 21 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
25 | 22 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
26 | 23 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
27 | 24 |
import eu.etaxonomy.cdm.api.service.ITaxonNodeService; |
28 |
import eu.etaxonomy.cdm.api.service.ITaxonService; |
|
29 | 25 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
30 | 26 |
import eu.etaxonomy.cdm.api.service.exception.DataChangeNoRollbackException; |
31 | 27 |
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException; |
32 | 28 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
33 |
import eu.etaxonomy.cdm.model.common.ITreeNode; |
|
34 | 29 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
35 | 30 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
36 | 31 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
37 | 32 |
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation; |
38 | 33 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
39 | 34 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
40 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
41 | 35 |
|
42 | 36 |
/** |
43 | 37 |
* <p>DeleteTreeNodeOperation class.</p> |
... | ... | |
49 | 43 |
public class DeleteOperation extends AbstractPersistentPostOperation{ |
50 | 44 |
|
51 | 45 |
private Set<ITaxonTreeNode> treeNodes; |
52 |
private TaxonDeletionConfigurator config; |
|
46 |
private final TaxonDeletionConfigurator config;
|
|
53 | 47 |
|
54 | 48 |
|
55 | 49 |
/** |
... | ... | |
87 | 81 |
this.treeNodes = treeNodes; |
88 | 82 |
this.config = config; |
89 | 83 |
} |
90 |
|
|
84 |
|
|
91 | 85 |
|
92 | 86 |
/* (non-Javadoc) |
93 | 87 |
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) |
... | ... | |
104 | 98 |
if(taxonNode != null && taxonNode instanceof TaxonNode){ |
105 | 99 |
//((TaxonNode) treeNode).delete(); |
106 | 100 |
|
107 |
taxon = ((TaxonNode)taxonNode).getTaxon();
|
|
101 |
element = ((TaxonNode)taxonNode).getTaxon();
|
|
108 | 102 |
try { |
109 | 103 |
service.deleteTaxonNode((TaxonNode)taxonNode, config); |
110 | 104 |
} catch (DataChangeNoRollbackException e) { |
111 |
|
|
105 |
|
|
112 | 106 |
throw new ExecutionException(e.getMessage()); |
113 |
|
|
107 |
|
|
114 | 108 |
} |
115 |
|
|
109 |
|
|
116 | 110 |
}else if(taxonNode != null && taxonNode instanceof Classification){ |
117 | 111 |
Classification taxonomicTree = (Classification) taxonNode; |
118 | 112 |
/*if(taxonomicTree.hasChildNodes()){ |
... | ... | |
125 | 119 |
}catch(ReferencedObjectUndeletableException e){ |
126 | 120 |
throw new ExecutionException(e.getMessage()); |
127 | 121 |
} |
128 |
|
|
129 |
|
|
122 |
|
|
123 |
|
|
130 | 124 |
/*}else{ |
131 | 125 |
try{ |
132 | 126 |
CdmStore.getService(IClassificationService.class).delete(taxonomicTree); |
... | ... | |
141 | 135 |
throw new ExecutionException(e.getMessage()); |
142 | 136 |
} |
143 | 137 |
} |
144 |
|
|
138 |
|
|
145 | 139 |
monitor.worked(40); |
146 | 140 |
return postExecute(null); |
147 | 141 |
} |
Also available in: Unified diff