</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
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;
}
}
- 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>
*
+++ /dev/null
-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;
- }
-}