-// $Id$
/**
* Copyright (C) 2015 EDIT
* European Distributed Institute of Taxonomy
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation;
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
-import eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator.DeleteConfiguratorDialog;
+import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
/**
* @author cmathew
}
if(!allEditorsClosed) {
return new Status(IStatus.WARNING,
- "unknown",
+ "unknown", //$NON-NLS-1$
TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
}
if (treeNodes.size() == 1 ){
ITaxonTreeNode treeNode = treeNodes.iterator().next();
ITaxonTreeNode taxonNode = treeNode;
- if (taxonNode instanceof Classification){
- taxonNode = CdmApplicationState.getCurrentAppConfig().getClassificationService().load(taxonNode.getUuid());
+ if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon()){
+ taxonNode = CdmApplicationState.getCurrentAppConfig().getClassificationService().load(((TaxonNode)taxonNode).getClassification().getUuid());
}else{
taxonNode = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(taxonNode.getUuid());
}
+ treeNodes = new HashSet<ITaxonTreeNode>();
+ treeNodes.add(taxonNode);
if (taxonNode == null){
- MessagingUtils.informationDialog("Node already deleted", "The taxon node was already deleted. Please reopen the taxon navigator to refresh the view.");
+ MessagingUtils.informationDialog(Messages.RemotingDeleteTaxonNodeHandler_NODE_DELETED, Messages.RemotingDeleteTaxonNodeHandler_NODE_DELETED_MESSAGE);
return Status.CANCEL_STATUS;
}
if (taxonNode instanceof Classification) {
String message;
if (taxonNode.hasChildNodes()) {
- message = "Do you really want to delete the classification? The tree has children, they will be deleted, too.";
+ message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+DeleteHandler.THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO;
} else {
- message = "Do you really want to delete the classification?";
+ message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION;
}
if (!DeleteConfiguratorDialog.openConfirm(
- HandlerUtil.getActiveShell(event), "Confirm Deletion",
+ HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION,
message)) {
return Status.CANCEL_STATUS;
}
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
config,
HandlerUtil.getActiveShell(event),
- "Confirm Deletion",
+ DeleteHandler.CONFIRM_DELETION,
null,
- "Do you really want to delete the selected node? It has childnodes, they will be deleted, too.",
- MessageDialog.WARNING, new String[] { "Delete all children",
- "Move children to parent node", "Skip" }, 0);
+ DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+DeleteHandler.THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO,
+ MessageDialog.WARNING, new String[] { DeleteHandler.DELETE_ALL_CHILDREN,
+ DeleteHandler.MOVE_CHILDREN_TO_PARENT_NODE, DeleteHandler.SKIP }, 0);
int result = dialog.open();
if (result == 0){
return Status.CANCEL_STATUS;
}
} else{
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION, DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
return Status.CANCEL_STATUS;
}
config.setTaxonNodeConfig(configNodes);