Revision 5354f693
Added by U-BGBM\k.luther over 8 years ago
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