Revision cedc4ff1
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/DeleteHandlerE4.java | ||
---|---|---|
28 | 28 |
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling; |
29 | 29 |
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator; |
30 | 30 |
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; |
31 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
|
32 | 31 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
33 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
|
32 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
|
|
34 | 33 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
35 | 34 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
36 | 35 |
import eu.etaxonomy.taxeditor.navigation.NavigationUtil; |
... | ... | |
70 | 69 |
TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject(); |
71 | 70 |
|
72 | 71 |
Iterator selectionIterator = selection.iterator(); |
73 |
Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
|
|
72 |
Set<TaxonNodeDto> treeNodes = new HashSet();
|
|
74 | 73 |
|
75 | 74 |
while (selectionIterator.hasNext()){ |
76 | 75 |
Object object = selectionIterator.next(); |
77 |
if(object instanceof ITaxonTreeNode) {
|
|
78 |
treeNodes.add((ITaxonTreeNode) object);
|
|
76 |
if(object instanceof TaxonNodeDto) {
|
|
77 |
treeNodes.add((TaxonNodeDto) object);
|
|
79 | 78 |
} |
80 | 79 |
} |
81 | 80 |
boolean allEditorsClosed = true; |
82 |
for (ITaxonTreeNode treeNode : treeNodes){ |
|
83 |
if(treeNode instanceof TaxonNode) { |
|
84 |
allEditorsClosed &= closeObsoleteEditor((TaxonNode) treeNode); |
|
85 |
} |
|
81 |
for (TaxonNodeDto treeNode : treeNodes){ |
|
82 |
allEditorsClosed &= closeObsoleteEditor(treeNode); |
|
86 | 83 |
} |
87 | 84 |
AbstractPostOperation operation = null; |
88 | 85 |
TaxonDeletionConfigurator config = new TaxonDeletionConfigurator(); |
... | ... | |
91 | 88 |
if (treeNodes.size() == 1 ){ |
92 | 89 |
try { |
93 | 90 |
|
94 |
ITaxonTreeNode treeNode = treeNodes.iterator().next();
|
|
95 |
ITaxonTreeNode taxonNode =treeNode;
|
|
91 |
TaxonNodeDto taxonNode = treeNodes.iterator().next();
|
|
92 |
// TaxonNodeDto taxonNode = treeNode;
|
|
96 | 93 |
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator(); |
97 | 94 |
|
98 | 95 |
//configNodes.setDeleteTaxon(false); |
99 |
if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon() && taxonNode.hasChildNodes()){
|
|
96 |
if (taxonNode.getTaxonUuid() == null && taxonNode.getTaxonomicChildrenCount()>0){
|
|
100 | 97 |
if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO)){ |
101 | 98 |
return; |
102 | 99 |
} |
103 |
} else if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon() && !taxonNode.hasChildNodes()){
|
|
100 |
} else if (taxonNode.getTaxonUuid() != null && taxonNode.getTaxonomicChildrenCount()==0){
|
|
104 | 101 |
if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION)){ |
105 | 102 |
return; |
106 | 103 |
} |
107 | 104 |
} else { |
108 | 105 |
|
109 |
if (taxonNode.hasChildNodes()){
|
|
106 |
if (taxonNode.getTaxonomicChildrenCount()>0){
|
|
110 | 107 |
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog( |
111 | 108 |
config, |
112 | 109 |
shell, |
... | ... | |
194 | 191 |
return canExecute; |
195 | 192 |
} |
196 | 193 |
|
197 |
protected boolean closeObsoleteEditor(TaxonNode taxonNode){ |
|
194 |
protected boolean closeObsoleteEditor(TaxonNodeDto taxonNode){
|
|
198 | 195 |
//FIXME E4 migrate |
199 | 196 |
boolean result = true; |
200 | 197 |
// for (IEditorReference ref : activePage.getEditorReferences()) { |
Also available in: Unified diff
ref #2380: implement usage of Dto for taxon navigator