import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
monitor.worked(20);
bind();
- Taxon oldTaxon = (Taxon) HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon());
- try {
+ Taxon oldTaxon = HibernateProxyHelper.deproxy(((TaxonNode) taxonNode).getTaxon(), Taxon.class);
+ Taxon newAcceptedTaxon = HibernateProxyHelper.deproxy(newAcceptedTaxonNode.getTaxon(), Taxon.class);
+ try {
UpdateResult result = CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(taxonNode.getUuid(), newAcceptedTaxonNode.getUuid(), null, null, null);
-
+
+
if (!result.getExceptions().isEmpty() && result.isOk()){
String separator = ", ";
String exceptionString = "";
for (Exception exception : result.getExceptions()) {
exceptionString += exception.getLocalizedMessage()+separator;
}
-
- MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);
+
+ MessagingUtils.informationDialog("Synonym created but taxon is not deleted.", exceptionString);
} else if (result.isAbort() || result.isError()){
MessagingUtils.errorDialog("Synonym could not created", null, result.toString(), TaxeditorNavigationPlugin.PLUGIN_ID, null, true);
}
MessagingUtils.errorDialog("Operation failed", this, e.getMessage(), TaxeditorNavigationPlugin.PLUGIN_ID, e, false);
return Status.CANCEL_STATUS;
}
-
+
monitor.worked(40);
return postExecute(oldTaxon);