Remove "edit" commands which are replaced by generic cdmViewer framework
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 15 Dec 2015 07:37:55 +0000 (08:37 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 15 Dec 2015 07:37:55 +0000 (08:37 +0100)
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java [deleted file]

index 24fc80404cebb37b7fe004b72301720f5fa1336f..a329fe597e178592737edd3ee8a5cc1023cec424 100644 (file)
       </menuContribution>
       <menuContribution
             locationURI="popup:#BulkEditorContext">
-         <command
-               commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
-               label="%command.label"
-               style="push">
-            <visibleWhen>
-               <reference
-                     definitionId="isTaxonBulkEditorInput">
-               </reference>
-            </visibleWhen>
-         </command>
+         <dynamic
+               class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+               id="eu.etaxonomy.taxeditor.bulkeditor.cdmViewerContextMenu">
+         </dynamic>
          <separator
                name="taxeditor-bulkeditor.separator1"
                visible="true">
                </reference>
             </visibleWhen>
          </command>
-         <dynamic
-               class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
-               id="eu.etaxonomy.taxeditor.bulkeditor.cdmViewerContextMenu">
-         </dynamic>
       </menuContribution>
    </extension>
    <extension
index d67d603004d4c094e513666174f5ab568ab08d0f..d625a694d91964e70e038f1c07f15648bdd9059a 100644 (file)
                name="taxeditor-navigation.separator1"
                visible="true">
          </separator>
-         <command
-               commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
-               label="%command.label.5"
-               style="push">       
-            <visibleWhen
-                  checkEnabled="true">
-               <or>
-                  <reference
-                        definitionId="isTaxonNode">
-                  </reference>
-                  <reference
-                        definitionId="isTaxonomicTree">
-                  </reference>
-               </or>
-            </visibleWhen>
-         </command>
          <dynamic
                class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
                id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
index a266c8d9249de70341c8ddebb3d14107d3c44dd8..613dbabb33885f5a9207f5df1f4dcefd966b63c6 100644 (file)
@@ -35,7 +35,6 @@ import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
@@ -108,23 +107,6 @@ public class NavigationUtil extends AbstractUtility{
                }
        }
 
-       public static void openEditor(Object selectedObject){
-               if (selectedObject instanceof UuidAndTitleCache){
-                       Class type = ((UuidAndTitleCache) selectedObject).getType();
-                       if(type == Taxon.class || type == Synonym.class){
-                               try {
-                                       EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid());
-                               } catch (PartInitException e) {
-                                       MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
-                               }
-                       }
-               }else if(selectedObject instanceof ICdmBase){
-                       openEditor((ICdmBase) selectedObject);
-               }else{
-                       MessagingUtils.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
-               }
-       }
-
        /**
         * <p>openEmpty</p>
         *
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java
deleted file mode 100644 (file)
index e4876d3..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-// $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.
-*/
-
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-
-/**
- * <p>EditHandler class.</p>
- *
- * @author n.hoffmann
- * @created May 12, 2010
- * @version 1.0
- */
-public class EditHandler extends AbstractHandler implements IHandler{
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-
-               ISelection selection = HandlerUtil.getCurrentSelection(event);
-
-               if(selection instanceof IStructuredSelection){
-                       final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
-                       if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
-                               Classification classification = (Classification) structuredSelection.getFirstElement();
-
-                               NewClassificationWizard classificationWizard = new NewClassificationWizard();
-                               classificationWizard.init(null, null);
-                               classificationWizard.setEntity(classification);
-                               WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
-                               dialog.open();
-
-                       }
-                       else{
-
-                               Job job = new Job("Opening editor") {
-
-                                       @Override
-                                       protected IStatus run(IProgressMonitor monitor) {
-                                               for(final Object selectedObject : structuredSelection.toArray()){
-
-                                                       Display.getDefault().asyncExec(new Runnable(){
-
-                                                               @Override
-                                public void run() {
-                                                                       NavigationUtil.openEditor(selectedObject);
-                                                               }
-
-                                                       });
-                                               }
-                                               return Status.OK_STATUS;
-                                       }
-                               };
-
-                               job.schedule();
-                       }
-               }
-
-               return null;
-       }
-}