Revision 5354f693
Added by U-BGBM\k.luther over 7 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java | ||
---|---|---|
81 | 81 |
} |
82 | 82 |
AbstractPostOperation operation = null; |
83 | 83 |
TaxonDeletionConfigurator config = new TaxonDeletionConfigurator(); |
84 |
config.setDeleteInAllClassifications(false); |
|
85 |
|
|
84 | 86 |
if (treeNodes.size() == 1 ){ |
85 | 87 |
try { |
86 | 88 |
|
87 | 89 |
ITaxonTreeNode treeNode = treeNodes.iterator().next(); |
88 | 90 |
ITaxonTreeNode taxonNode =treeNode; |
89 | 91 |
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator(); |
92 |
|
|
90 | 93 |
//configNodes.setDeleteTaxon(false); |
91 | 94 |
if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){ |
92 | 95 |
if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){ |
... | ... | |
107 | 110 |
"Do you really want to delete the selected node? It has childnodes, they will be deleted, too.", |
108 | 111 |
MessageDialog.WARNING, new String[] { "Delete all children", |
109 | 112 |
"Move children to parent node", "Skip" }, 0); |
110 |
int result = dialog.open(); |
|
113 |
int dialog_result = dialog.open();
|
|
111 | 114 |
|
112 |
if (result == 0){ |
|
115 |
if (dialog_result == 0){
|
|
113 | 116 |
//delete all children |
114 | 117 |
configNodes.setChildHandling(ChildHandling.DELETE); |
115 | 118 |
config.setTaxonNodeConfig(configNodes); |
116 |
} else if (result == 1){ |
|
119 |
} else if (dialog_result == 1){
|
|
117 | 120 |
//move children |
118 | 121 |
configNodes.setChildHandling(ChildHandling.MOVE_TO_PARENT); |
119 | 122 |
config.setTaxonNodeConfig(configNodes); |
120 |
} else if (result == 2){ |
|
123 |
} else if (dialog_result == 2){
|
|
121 | 124 |
//skip |
122 | 125 |
return null; |
123 | 126 |
|
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java | ||
---|---|---|
16 | 16 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 | 17 |
import org.eclipse.core.runtime.IStatus; |
18 | 18 |
import org.eclipse.core.runtime.Status; |
19 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
20 | 19 |
|
21 | 20 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
22 | 21 |
import eu.etaxonomy.cdm.api.service.DeleteResult; |
... | ... | |
73 | 72 |
|
74 | 73 |
monitor.worked(20); |
75 | 74 |
bind(); |
76 |
Taxon oldTaxon = (Taxon) HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon()); |
|
75 |
Taxon oldTaxon = HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon(), Taxon.class); |
|
76 |
Taxon newAcceptedTaxon = HibernateProxyHelper.deproxy(newAcceptedTaxonNode.getTaxon(), Taxon.class); |
|
77 |
|
|
77 | 78 |
try { |
78 | 79 |
DeleteResult result = CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode((TaxonNode) taxonNode, newAcceptedTaxonNode, null, null, null); |
79 |
|
|
80 |
|
|
80 | 81 |
if (!result.getExceptions().isEmpty() && result.isOk()){ |
81 | 82 |
String separator = ", "; |
82 | 83 |
String exceptionString = ""; |
83 | 84 |
for (Exception exception : result.getExceptions()) { |
84 | 85 |
exceptionString += exception.getLocalizedMessage()+separator; |
85 | 86 |
} |
86 |
|
|
87 |
MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);
|
|
87 |
|
|
88 |
MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString); |
|
88 | 89 |
} else if (result.isAbort() || result.isError()){ |
89 | 90 |
MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true); |
90 | 91 |
} |
... | ... | |
92 | 93 |
MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false); |
93 | 94 |
return Status.CANCEL_STATUS; |
94 | 95 |
} |
95 |
|
|
96 |
|
|
96 | 97 |
monitor.worked(40); |
97 | 98 |
|
98 | 99 |
return postExecute(oldTaxon); |
Also available in: Unified diff
fix delete of taxon which is in two classifications and has children