/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
package eu.etaxonomy.taxeditor.navigation.navigator.handler;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import java.util.UUID;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.ITreeNode;
-import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionNaturalOrderDialog;
/**
* <p>MoveTaxonHandler class.</p>
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
TaxonNavigator taxonNavigator = (TaxonNavigator)NavigationUtil.showView(TaxonNavigator.ID);
-
+
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
-
+
Iterator selectionIterator = selection.iterator();
TaxonNode taxonNode = null;
UUID taxonNodeUUID = null;
// do not show the current selection
List<UUID> excludeTaxa = new ArrayList<UUID>();
-
+
+
if (selection.size() == 1){
Object object = selectionIterator.next();
if(object instanceof TaxonNode){
return null;
}
}
-
-
+
+
+
// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
if (taxonNode != null){
- boolean moveToNewParent = true;
+ boolean moveToNewParent = true;
if (PreferencesUtil.getSortNodesNaturally()){
if(!MessageDialog.openQuestion(null, "Target node", "The choosen target node should be the parent?")){
moveToNewParent = false;
"changes in the parent taxon. Please save first.");
return null;
}
-
+
AbstractPostOperation operation = new MoveTaxonOperation
("Move taxon to new parent", NavigationUtil.getUndoContext(),
taxonNode, parentTaxonNode, taxonNavigator, taxonNavigator, moveToNewParent); //$NON-NLS-1$
NavigationUtil.executeOperation(operation);
taxonNavigator.refresh();
-
+
}
}
+
return null;
}
* @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
*/
/** {@inheritDoc} */
- public boolean postOperation(CdmBase objectAffectedByOperation) {
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
return true;
}
*
* @return a boolean.
*/
- public boolean onComplete() {
+ @Override
+ public boolean onComplete() {
return false;
}
-
-
-
+
}