From 609a2409502b2d51c60c5f077036b924f2f2dd52 Mon Sep 17 00:00:00 2001 From: "n.hoffmann" Date: Fri, 11 Mar 2011 14:56:12 +0000 Subject: [PATCH] Solves an issue with opening taxa from navigator. Improving BulkEditor context menu. --- .gitattributes | 1 + taxeditor-bulkeditor/plugin.xml | 84 +++++++++++++------ .../taxeditor/bulkeditor/BulkEditor.java | 12 +++ .../bulkeditor/handler/DeleteHandler.java | 33 ++++++++ .../ReferencingObjectsView.java | 2 +- .../taxeditor/navigation/NavigationUtil.java | 4 + 6 files changed, 109 insertions(+), 27 deletions(-) create mode 100644 taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java diff --git a/.gitattributes b/.gitattributes index 7078b5e67..5d3a0dd98 100644 --- a/.gitattributes +++ b/.gitattributes @@ -93,6 +93,7 @@ taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddDerivedUnitMediaHandler.java -text taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/handler/AddFieldObjectMediaHandler.java -text taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/derivedunit/operation/AddDerivedUnitFacadeMediaOperation.java -text +taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java -text taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/MergeGroupHandler.java -text taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/OpenBulkEditorHandler.java -text taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/RemoveMergeCandidateHandler.java -text diff --git a/taxeditor-bulkeditor/plugin.xml b/taxeditor-bulkeditor/plugin.xml index 807fedb28..21004cd3d 100644 --- a/taxeditor-bulkeditor/plugin.xml +++ b/taxeditor-bulkeditor/plugin.xml @@ -55,10 +55,35 @@ + + + + + + + + + + + + - - - - - - - - - - - - + + + + @@ -317,6 +326,18 @@ + + + + + + + + @@ -372,6 +393,17 @@ properties="isDerivedUnitEditor" type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"> + + + + + + + diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java index 9b9d20001..3f543dcbd 100644 --- a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java +++ b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java @@ -10,6 +10,7 @@ package eu.etaxonomy.taxeditor.bulkeditor; +import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.jface.preference.IPreferenceStore; @@ -31,6 +32,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.PartInitException; +import org.eclipse.ui.texteditor.ITextEditorActionConstants; import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineDocumentProvider; import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor; @@ -290,4 +292,14 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe public AbstractBulkEditorInput getEditorInput() { return (AbstractBulkEditorInput) super.getEditorInput(); } + + protected void editorContextMenuAboutToShow(IMenuManager menu) { + super.editorContextMenuAboutToShow(menu); + menu.remove(ITextEditorActionConstants.SHIFT_RIGHT); + menu.remove(ITextEditorActionConstants.SHIFT_LEFT); + menu.remove(ITextEditorActionConstants.CONTEXT_PREFERENCES); + + IMenuManager showInMenu = menu.findMenuUsingPath("viewsShowIn"); + System.out.println(showInMenu); + } } diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java new file mode 100644 index 000000000..443359284 --- /dev/null +++ b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java @@ -0,0 +1,33 @@ +// $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.bulkeditor.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * @author n.hoffmann + * @created Mar 11, 2011 + * @version 1.0 + */ +public class DeleteHandler extends AbstractHandler { + + /* (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java index 2acee1d6f..5cbfc77a9 100644 --- a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java +++ b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java @@ -55,7 +55,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements ISele .getLogger(ReferencingObjectsView.class); /** Constant ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked} */ - public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.referencingobjectsview"; + public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"; private TableViewer viewer; diff --git a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java index c54e8bac2..354448c37 100644 --- a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java +++ b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java @@ -112,6 +112,10 @@ public class NavigationUtil extends AbstractUtility{ NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e); } } + }else if(selectedObject instanceof ICdmBase){ + openEditor((ICdmBase) selectedObject); + }else{ + NavigationUtil.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject)); } } -- 2.34.1