had to rename the packages to make them compliant with buckminster
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / media / handler / MoveImageDownInListHandler.java
diff --git a/taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java b/taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java
deleted file mode 100644 (file)
index 67726fd..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* 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.editor.view.media.handler;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.media.operation.MoveMediaInListOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>MoveImageDownInListHandler class.</p>
- *
- * @author p.ciardelli
- * @created 11.08.2009
- * @version 1.0
- */
-public class MoveImageDownInListHandler extends AbstractHandler {
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-               IWorkbenchPart part = HandlerUtil.getActivePart(event);
-               IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
-                               
-               IEditorPart editor = HandlerUtil.getActiveEditor(event);
-               if (editor instanceof FormEditor) {
-                       editor = ((FormEditor) editor).getActiveEditor();
-               }
-               IEditorInput input = editor.getEditorInput();
-               if (input instanceof TaxonEditorInput) {
-                       Taxon taxon = ((TaxonEditorInput) input).getTaxon();
-                       
-                       ISelection selection = HandlerUtil.getCurrentSelection(event);
-                                               
-                       if (selection instanceof TreeSelection) {
-                               TreePath[] paths = ((TreeSelection) selection).getPaths();
-                               int count = paths[0].getSegmentCount();
-                               DescriptionBase description = null;
-                               for (int i = 0; i < count; i++ ) {
-                                       if (paths[0].getSegment(i) instanceof DescriptionBase) {
-                                               description = (DescriptionBase) paths[0].getSegment(i);
-                                               break;
-                                       }
-                               }                               
-                               Media media = (Media) paths[0].getLastSegment();
-                               AbstractPostOperation operation = null;
-                               try {
-                                       // TODO use undo context specific to editor
-                                       operation = new MoveMediaInListOperation(event.getCommand().getName(), 
-                                                       EditorUtil.getUndoContext(), taxon, description, media, MoveMediaInListOperation.DOWN, postOperationEnabled);
-                                       EditorUtil.executeOperation(operation);
-                               } catch (NotDefinedException e) {
-                                       EditorUtil.warn(getClass(), "Command name not set.");
-                               }
-                       }
-               } 
-               return null;
-       }
-
-}