import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog;
/**
* @author n.hoffmann
IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
// synonym
if(selectedElement instanceof Synonym){
- if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
- return ;
+ SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator();
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
+ return ;
}
- operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), new SynonymDeletionConfigurator(), activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
+ operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
}
// misapplication
else if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){
- operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), editor
- .getTaxon(), (Taxon) selectedElement, editor);
- }
- else {
+ TaxonDeletionConfigurator deleteConfig = new TaxonDeletionConfigurator();
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){
+ return ;
+ }
+ operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Taxon) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
+ } else {
throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT);
}
DeleteResult result = ((DeleteTaxonBaseOperation)operation).getResult();
if (result.isError()){
DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteDerivateOperation_DELETE_FAILED, TaxeditorEditorPlugin.PLUGIN_ID);
- } else if (selectedElement instanceof Synonym){
+ } else {
this.editor.redraw();
if (!result.getUpdatedObjects().isEmpty()){
DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_SYNONYM_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
}
- }else {
+ }
if (!result.getUpdatedObjects().isEmpty()){
DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
}
- }
+
}