import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
-import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
private TaxonDeletionConfigurator config;
private Set<ITaxonTreeNode> treeNodes;
- /**
- * @param label
- */
public RemotingDeleteTaxonNodeHandler() {
super(TaxonNavigatorLabels.DELETE_TAXON_NODE_LABEL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
public IStatus allowOperations(ExecutionEvent event) {
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
- Iterator selectionIterator = selection.iterator();
+ Iterator<?> selectionIterator = selection.iterator();
treeNodes = new HashSet<ITaxonTreeNode>();
while (selectionIterator.hasNext()){
}
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
- if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
- 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.")){
- return Status.CANCEL_STATUS;
- }
- } else if (taxonNode instanceof Classification && !taxonNode.hasChildNodes()){
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification?")){
- return Status.CANCEL_STATUS;
- }
- } else {
+ 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.";
+ } else {
+ message = "Do you really want to delete the classification?";
+ }
+ if (!DeleteConfiguratorDialog.openConfirm(
+ HandlerUtil.getActiveShell(event), "Confirm Deletion",
+ message)) {
+ return Status.CANCEL_STATUS;
+ }
+ }
+ else {
if (taxonNode.hasChildNodes()){
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
return Status.OK_STATUS;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
public AbstractOperation prepareOperation(ExecutionEvent event) {
return new RemotingDeleteTaxonNodeOperation(event.getTrigger(),
config);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
- */
@Override
public void onComplete() {
- // TODO Auto-generated method stub
-
}
}