taxeditor-navigation/pom.xml -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/RecentNamesContributionItem.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/StateManager.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/WorkbenchUndoContextAdapterFactory.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/DeleteTreeNodeHandler.java -text
-taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/EditTaxonHandler.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/EditHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/MoveTaxonHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonNodeHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeHandler.java -text
Bundle-ManifestVersion: 2
Bundle-Name: EDIT Taxonomic Editor - Navigation Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 2.1.1.qualifier
-Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
+Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,eu.etaxonomy.taxeditor.navigation,eu.etaxonomy.taxeditor.navigation.handler,eu.etaxonomy.taxeditor.navigation.internal,eu.etaxonomy.taxeditor.navigation.navigator,eu.etaxonomy.taxeditor.navigation.search,eu.etaxonomy.taxeditor.newWizards
Require-Bundle: org.eclipse.ui;bundle-version="3.4.1",
org.eclipse.core.runtime.jobs,
org.eclipse.equinox.app,
org.osgi.framework
+Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator"
icon="icons/edit_16x16.gif"
id="eu.etaxonomy.taxeditor.navigation.navigator"
- name="Taxonomic Tree"
+ name="Taxon Navigator"
restorable="true">
</view>
</extension>
locationURI="menu:eu.etaxonomy.taxeditor.menu.showView">
<command
commandId="eu.etaxonomy.taxeditor.navigation.command.showTaxonomicTreeView"
- label="Taxonomic Tree"
+ label="Taxon Navigator"
style="push">
</command>
</menuContribution>
<command
commandId="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
id="eu.etaxonomy.taxeditor.navigation.menu.nu.new.taxonomicTree"
- label="Taxonomic Tree"
+ label="Classification"
style="push">
</command>
</menu>
visible="true">
</separator>
<command
- commandId="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
+ commandId="eu.etaxonomy.taxeditor.navigation.command.editSelection"
label="Edit"
style="push">
- <separator
- name="taxeditor-navigation.separator4">
- </separator>
<visibleWhen>
<reference
definitionId="isTaxonNode">
<command
commandId="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
id="eu.etaxonomy.taxeditor.navigation.menu.nu.new.taxonomicTree"
- label="Taxonomic Tree"
+ label="Classification"
style="push">
</command>
</menuContribution>
<command
defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.NewTaxonomicTreeHandler"
id="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
- name="New Taxonomic Tree">
+ name="New Classification">
</command>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.EditTaxonHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
- name="Edit Taxon">
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.EditHandler"
+ id="eu.etaxonomy.taxeditor.navigation.command.editSelection"
+ name="Edit">
</command>
<command
defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.MoveTaxonHandler"
</command>
</extension>
- <extension
- point="org.eclipse.ui.themes">
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.searchResult"
- label="Search Result">
- <description>
- Colors and fonts used to display the search result.
- </description>
- </themeElementCategory>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.searchResult"
- id="eu.etaxonomy.taxeditor.preferences.searchResult.fontSynonym"
- isEditable="true"
- label="Synonym font">
- <fontValue
- value="Lucida Sans-italic-11">
- </fontValue>
- <description>
- The font that is used for synonyms in the search result list.
- </description>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.searchResult"
- id="eu.etaxonomy.taxeditor.preferences.searchResult.fontAccepted"
- isEditable="true"
- label="Accepted font">
- <description>
- The font that is used for accepted taxa in the search result list.
- </description>
- <fontValue
- value="Lucida Sans-bold-11">
- </fontValue>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.searchResult"
- id="eu.etaxonomy.taxeditor.preferences.searchResult.fontDefault"
- isEditable="true"
- label="Other font">
- <description>
- The font used by default in the search result list.
- </description>
- <fontValue
- value="Lucida Grande-11">
- </fontValue>
- </fontDefinition>
- </extension>
+
<!--extension
point="org.eclipse.ui.navigator.viewer">
<viewer
value="eu.etaxonomy.cdm.model.taxon.TaxonNode">
</instanceof>
</possibleChildren>
- <actionProvider
- class="eu.etaxonomy.taxeditor.navigation.navigator.OpenTaxonActionProvider"
- id="eu.etaxonomy.taxeditor.navigation.action.open"
- overrides="org.eclipse.ui.navigator.resources.OpenActions">
- <enablement>
- <instanceof
- value="eu.etaxonomy.cdm.model.taxon.TaxonNode">
- </instanceof>
- </enablement>
- </actionProvider>
</navigatorContent>
<navigatorContent
+ activeByDefault="false"
contentProvider="eu.etaxonomy.taxeditor.navigation.navigator.SynonymContentProvider"
id="eu.etaxonomy.taxeditor.navigation.synonymcontent"
labelProvider="eu.etaxonomy.taxeditor.navigation.navigator.SynonymLabelProvider"
</primaryWizard-->
<wizard
category="eu.etaxonomy.taxeditor.new.category.cdm"
- class="eu.etaxonomy.taxeditor.newWizards.NewTaxonomicTreeWizard"
+ class="eu.etaxonomy.taxeditor.newWizards.NewClassificationWizard"
hasPages="true"
icon="icons/tree_icon_small.jpg"
- id="eu.etaxonomy.taxeditor.new.taxonomicTree"
- name="Taxonomic Tree">
+ id="eu.etaxonomy.taxeditor.new.classification"
+ name="Classification">
</wizard>
<wizard
category="eu.etaxonomy.taxeditor.new.category.cdm"
package eu.etaxonomy.taxeditor.navigation;
-import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.UndoContext;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.navigator.CommonViewer;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
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.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
+import eu.etaxonomy.taxeditor.section.BulkEditorOpeningSelectionListener;
/**
* @author n.hoffmann
*
* @param uuid
*/
- public static void openEditor(TaxonNode selection) {
+// public static void openEditor(TaxonNode selection) {
+// try {
+// UUID entityUuid = selection.getUuid();
+// EditorUtil.openTaxonNode(entityUuid);
+// } catch (PartInitException e) {
+// logger.error("Error opening the editor", e);
+// }
+// }
+
+ public static void executeEditHandler(){
+
+ String commandId = "eu.etaxonomy.taxeditor.navigation.command.editSelection";
+
+ IHandlerService handlerService = (IHandlerService) NavigationUtil.getService(IHandlerService.class);
try {
- UUID entityUuid = selection.getUuid();
- EditorUtil.open(entityUuid);
+ handlerService.executeCommand(commandId, null);
+ } catch (ExecutionException e) {
+ logger.error("ExecutionException when trying to execute EditHandler.", e);
+ } catch (NotDefinedException e) {
+ logger.error("NotDefinedException when trying to execute EditHandler.", e);
+ } catch (NotEnabledException e) {
+ logger.error("NotEnabledException when trying to execute EditHandler.", e);
+ } catch (NotHandledException e) {
+ logger.error("NotHandledException when trying to execute EditHandler.", e);
+ }
+ }
+
+ public static void openEditor(CdmBase selectedObject){
+ UUID entityUuid = selectedObject.getUuid();
+ try {
+ if(selectedObject instanceof TaxonNode){
+ EditorUtil.openTaxonNode(entityUuid);
+ }else if(selectedObject instanceof TaxonBase){
+ EditorUtil.openTaxonBase(entityUuid);
+ }else if(selectedObject instanceof TaxonNameBase){
+ // TODO open bulk editor
+ warningDialog("Not implemented yet", "You tried to open a name. This is not hanlded by the software yet.");
+ }else{
+ warningDialog("Unsupported Type", "No editor exists for the current selection: " + selectedObject);
+ }
} catch (PartInitException e) {
logger.error("Error opening the editor", e);
}
* @param parentElement
*/
public static void selectInNavigator(Object element, Object parentElement) {
- TaxonNavigator navigator = getNavigator();
+ TaxonNavigator navigator = showNavigator();
if (navigator != null) {
CommonViewer viewer = navigator.getCommonViewer();
if (viewer != null) {
}else if(selection instanceof Synonym){
Synonym synonym = (Synonym) selection;
- Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
- for (Taxon taxon : synonym.getAcceptedTaxa()){
- taxonNodes.addAll(taxon.getTaxonNodes());
- }
- handleOpeningOfMultipleTaxonNodes(taxonNodes);
+ handleOpeningOfMultipleTaxa(synonym.getAcceptedTaxa());
}else{
- warningDialog("Not implemented yet", "You chose to open a name that has no connection to a taxa. The Editor does not support editing of such a content type at the moment.");
+ warningDialog("Not implemented yet", "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.");
logger.warn("Could not open editor for selection. Selection was of type: " + selection.getClass().getSimpleName());
}
}
+ private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) {
+ if(acceptedTaxa.size() == 1){
+ openEditor(acceptedTaxa.iterator().next());
+ }else if(acceptedTaxa.size() > 1){
+ // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
+ warningDialog("Not implemented yet", "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open." +
+ " This case is not handled yet by the software.");
+ }else if(acceptedTaxa.size() == 0){
+ // this is an undesired state
+ warningDialog("Incorrect state", "The accepted taxon is not in a taxonomic view. This should not have happened.");
+ }
+ }
+
/**
* @param taxonNodes
*/
/**
* @return the TaxonNavigator instance if present
*/
- public static TaxonNavigator getNavigator() {
- try {
- return (TaxonNavigator) getView(TaxonNavigator.ID);
- } catch (PartInitException e) {
- logger.error("Could not get the view.", e);
- throw new RuntimeException(e);
- }
+ public static TaxonNavigator showNavigator() {
+ return (TaxonNavigator) showView(TaxonNavigator.ID);
+ }
+
+ public static TaxonNavigator getNavigator(boolean restore) {
+ return (TaxonNavigator) getView(TaxonNavigator.ID, restore);
}
}
\ No newline at end of file
--- /dev/null
+
+package eu.etaxonomy.taxeditor.navigation;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistable;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchListener;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.XMLMemento;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInputFactory;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.model.MementoHelper;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author n.hoffmann
+ * @created Apr 1, 2010
+ * @version 1.0
+ */
+public class StateManager implements IContextListener {
+ private static final Logger logger = Logger.getLogger(StateManager.class);
+
+ private static final String EDITORS = "editors";
+
+ private static final String EDITOR = "editor";
+
+ private TaxonEditorInputFactory inputFactory;
+
+ private IMemento memento;
+
+
+ public StateManager(){
+ inputFactory = new TaxonEditorInputFactory();
+ PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() {
+
+ @Override
+ public void postShutdown(IWorkbench workbench) {}
+
+ @Override
+ public boolean preShutdown(IWorkbench workbench, boolean forced) {
+ if(contextAboutToStop()){
+ contextStop();
+ }
+ // return true in any case, otherwise the application will not stop
+ return true;
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.model.IContextListener#onContextEvent(eu.etaxonomy.taxeditor.model.IContextListener.EventType)
+ */
+ public boolean onContextEvent(EventType eventType) {
+ switch(eventType){
+ case START:
+ return contextStart();
+ case STOP:
+ return contextStop();
+ case ABOUT_TO_STOP:
+ return contextAboutToStop();
+ }
+ return false;
+ }
+
+ /**
+ * Tries to restore the state of the taxon editor and the navigator when a context starts.
+ *
+ * @return true in any case
+ */
+ private boolean contextStart() {
+ IMemento memento = null;
+ try {
+ memento = MementoHelper.readMementoFromFile(getStateFileForCurrentDatabase());
+ } catch (FileNotFoundException e) {
+ // no memento -> no previous state
+ }
+
+
+
+ restoreNavigator(memento);
+
+ restoreEditors(memento);
+
+
+ return true;
+ }
+
+ /**
+ * Reads taxon node UUIDs from the given memento and tries to open an editor
+ * for each of the found UUIDs.
+ *
+ * @param memento
+ */
+ private void restoreEditors(final IMemento memento){
+ if(memento == null){
+ return;
+ }
+
+ ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(NavigationUtil.getShell());
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ IMemento editorMementos = memento.getChild(EDITORS);
+ IMemento[] editorInputs = editorMementos.getChildren(EDITOR);
+
+ monitor.beginTask("Restoring Editors", 1 + editorInputs.length * 2);
+ monitor.worked(1);
+
+ for(IMemento editorInput : editorInputs){
+ TaxonEditorInput input = (TaxonEditorInput) inputFactory.createElement(editorInput);
+ monitor.worked(1);
+ if(!monitor.isCanceled() && input != null){
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ logger.error("Error opening an editor window", e);
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ }
+ };
+
+ try {
+ progressMonitorDialog.run(false, true, runnable);
+ } catch (InvocationTargetException e) {
+ logger.error("InvocationTargetException when trying to restore open editors", e);
+ } catch (InterruptedException e) {
+ logger.error("InterruptedException when trying to restore open editors", e);
+ }
+ }
+
+ /**
+ * Restores the state of the navigator. Will open all previously opened paths.
+ *
+ * @param memento
+ */
+ private void restoreNavigator(IMemento memento){
+ TaxonNavigator navigator = NavigationUtil.getNavigator(true);
+ navigator.restore(memento);
+ }
+
+ /**
+ * Saves editor state to memento when the the context is about to shut down.
+ * The memento gets created anew on every shutdown process as to get rid of
+ * stale data from previous sessions on this context.
+ *
+ * After this point the user may still cancel the process.
+ *
+ * @return
+ */
+ private boolean contextAboutToStop() {
+ // we are creating the memento here; even if the context is not stopped
+ if (CdmStore.getDataSource() != null) {
+
+ try {
+ memento = XMLMemento.createWriteRoot(CdmStore.getDataSource().getName());
+
+ saveEditorState(memento);
+ logger.warn("DataSource found. Memento created.");
+ } catch (Exception e) {
+ // The memento could not be created, but a not closable editor is avoided for this case.
+ logger.error("The memento could not be created: " + e.getMessage());
+ return false;
+ }
+ } else {
+ logger.error("No DataSource present.");
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * If the context
+ *
+ * @return
+ */
+ private boolean contextStop() {
+ saveNavigatorState(memento);
+
+ // save the memento when the context really stops
+ return MementoHelper.saveMementoToFile(memento, getStateFileForCurrentDatabase()) != null;
+ }
+
+ /**
+ * Saves the UUIDs
+ *
+ * @param memento
+ */
+ private void saveEditorState(IMemento memento){
+ Set<IEditorPart> editors = EditorUtil.getOpenEditors();
+
+ IMemento editorMementos = memento.createChild(EDITORS);
+
+ for(IEditorPart editor : editors){
+ IEditorInput input = editor.getEditorInput();
+ if(input instanceof IPersistable){
+ IMemento editorMemento = editorMementos.createChild(EDITOR);
+ ((IPersistable) input).saveState(editorMemento);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param memento
+ */
+ private void saveNavigatorState(IMemento memento){
+ TaxonNavigator navigator = NavigationUtil.getNavigator(false);
+ if(navigator != null){
+ navigator.save(memento);
+ }
+ }
+
+ /**
+ *
+ * @return
+ */
+ private File getStateFileForCurrentDatabase() {
+ IPath path = TaxeditorEditorPlugin.getDefault().getStateLocation();
+ if (path == null) {
+ return null;
+ }
+ path = path.append("editor_state_" + CdmStore.getDataSource().getName() + ".xml");
+ return path.toFile();
+ }
+
+}
public Object execute(ExecutionEvent event) throws ExecutionException {
- // Prompt user for confirmation
- if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Are you sure you want to delete the selected taxa?")){
- return null;
- }
-
activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- taxonNavigator = NavigationUtil.getNavigator();
+ taxonNavigator = NavigationUtil.showNavigator();
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ String plural = selection.size() > 1 ? "s" : "";
+ // Prompt user for confirmation
+ if(! MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Confirm Deletion", "Are you sure you want to delete the selected node" + plural +"?")){
+ return null;
+ }
+
Iterator selectionIterator = selection.iterator();
Set<ITreeNode> treeNodes = new HashSet<ITreeNode>();
}
}
}
-}
+}
\ No newline at end of file
+package eu.etaxonomy.taxeditor.navigation.handler;
+// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.navigation.handler;
+import org.apache.log4j.Logger;
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.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
/**
* @author n.hoffmann
- * @created 24.03.2009
+ * @created May 12, 2010
* @version 1.0
*/
-public class EditTaxonHandler extends AbstractHandler {
+public class EditHandler extends AbstractHandler implements IHandler{
+ private static final Logger logger = Logger
+ .getLogger(EditHandler.class);
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ ISelection selection = HandlerUtil.getCurrentSelection(event);//navigator.getSelection();
- ISelection selection = HandlerUtil.getActiveMenuSelection(event);
-
- Object selectedObject = ((StructuredSelection) selection).getFirstElement();
-
- if(selectedObject instanceof TaxonNode){
- NavigationUtil.openEditor((TaxonNode) selectedObject);
- }else{
- throw new IllegalArgumentException("selectedObject is not of type TaxonNode");
+ if(selection instanceof StructuredSelection){
+ for(Object selectedObject : ((StructuredSelection) selection).toArray()){
+
+ if(selectedObject instanceof CdmBase){
+ // let the openEditor() method handle everything from now on
+ NavigationUtil.openEditor((CdmBase) selectedObject);
+ }else{
+ throw new IllegalArgumentException("selectedObject is not of type CdmBase");
+ }
+ }
}
return null;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNavigator taxonNavigator = NavigationUtil.getNavigator();
+ TaxonNavigator taxonNavigator = NavigationUtil.showNavigator();
TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
public boolean postOperation(CdmBase objectAffectedByOperation) {
return true;
}
-}
+}
\ No newline at end of file
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
-
- StructuredSelection selection = (StructuredSelection) HandlerUtil.getActiveMenuSelection(event);
- NewTaxonNodeWizard wizard = new NewTaxonNodeWizard(selection);
+ NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
int status = dialog.open();
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.taxeditor.newWizards.NewTaxonomicTreeWizard;
+import eu.etaxonomy.taxeditor.newWizards.NewClassificationWizard;
/**
* @author n.hoffmann
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), new NewTaxonomicTreeWizard());
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), new NewClassificationWizard());
dialog.open();
return null;
import java.net.URL;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
configurer_p.declareImage(symbolicName, desc, shared);
}
- public IAdaptable getDefaultPageInput() {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- return workspace.getRoot();
- }
+// public IAdaptable getDefaultPageInput() {
+// IWorkspace workspace = ResourcesPlugin.getWorkspace();
+// return workspace.getRoot();
+// }
}