eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateLabelProvider.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateMenuPropertyTester.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java -text
id="eu.etaxonomy.taxeditor.editor.group.authority"
name="Cdm Authority Editor">
</editor>
+ <editor
+ class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
+ default="false"
+ id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
+ name="Derivate View">
+ </editor>
</extension>
<extension
point="org.eclipse.ui.views">
name="Concept Graph"
restorable="true">
</view>
- <view
- allowMultiple="false"
- category="eu.etaxonomy.taxeditor.editor.category"
- class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
- icon="icons/leaf_detail.png"
- id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"
- name="Derivate View"
- restorable="true">
- </view>
<category
id="eu.etaxonomy.taxeditor.editor.category"
name="Taxonomic Editor">
id="eu.etaxonomy.taxeditor.group.cdmauthorities.edit"
name="Edit CDM Authorities">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
+ id="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+ name="Open Derivate View">
+ </command>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * 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 eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
/**
* Utility for the editor package
- *
+ *
* @author n.hoffmann
* @created 20.01.2009
* @version 1.0
/**
* Opens a new editor window with the given input
- *
+ *
* @param input
* @param editorId
* @return
/**
* Opens a new editor window with the given TaxonEditorInput
- *
+ *
* @param input
* a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput}
* object.
throws PartInitException {
open(input, KeyEditor.ID);
}
-
+
public static void open(CdmAuthorityEditorInput input)
throws PartInitException {
open(input, CdmAuthorityEditor.ID);
}
+ /**
+ * Opens a new DerivateView for the given input
+ * @param input a {@link DerivateViewEditorInput} representing the selected derivate
+ * @throws PartInitException
+ */
+ public static void open(DerivateViewEditorInput input)
+ throws PartInitException {
+ open(input, DerivateView.ID);
+ }
+
/**
* Taxon Editors may be opened by supplying a taxon node uuid. Session gets
* initialised here and is passed to the editor
- *
+ *
* @param taxonNodeUuid
* a {@link java.util.UUID} object.
* @throws java.lang.Exception
* <p>
* openTaxonBase
* </p>
- *
+ *
* @param taxonBaseUuid
* a {@link java.util.UUID} object.
* @throws org.eclipse.ui.PartInitException
* <p>
* findEditorByTaxonNodeUuid
* </p>
- *
+ *
* @param taxonNodeUuid
* a {@link java.util.UUID} object.
* @return a {@link org.eclipse.ui.IEditorPart} object.
* An uninitialized taxon is one that hasn't been saved yet. As such, it
* should appear in neither the list of recent names nor in the taxonomic
* tree when opened.
- *
+ *
* @throws org.eclipse.ui.PartInitException
* if any.
* @param parentNodeUuid
* <p>
* setSaving
* </p>
- *
+ *
* @param isSaving
* a boolean.
*/
* <p>
* isSaving
* </p>
- *
+ *
* @return a boolean.
*/
public static boolean isSaving() {
/**
* Returns a set of all currently open <code>MultiPageTaxonEditor</code>s.
- *
+ *
* @return a {@link java.util.Set} object.
*/
public static Set<IEditorPart> getOpenEditors() {
/**
* Returns the currently active taxon editor
- *
+ *
* @return the taxon editor that has focus
*/
public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor() {
* <p>
* getActiveEditorPage
* </p>
- *
+ *
* @param page
* a {@link eu.etaxonomy.taxeditor.editor.Page} object.
* @return a {@link org.eclipse.ui.IEditorPart} object.
/**
* Returns the selection of the currently active taxon editor
- *
+ *
* @return a {@link org.eclipse.jface.viewers.ISelection} object.
*/
public static ISelection getCurrentSelection() {
* <p>
* getUndoContext
* </p>
- *
+ *
* @param editor
* a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
* object.
* <p>
* getUndoContext
* </p>
- *
+ *
* @return a {@link org.eclipse.core.commands.operations.IUndoContext}
* object.
*/
* <p>
* forceUserSave
* </p>
- *
+ *
* @param editor
* a {@link org.eclipse.ui.IEditorPart} object.
* @param shell
* <p>
* getSelection
* </p>
- *
+ *
* @param event
* a {@link org.eclipse.core.commands.ExecutionEvent} object.
* @return a {@link org.eclipse.jface.viewers.IStructuredSelection} object.
* <p>
* getPluginId
* </p>
- *
+ *
* @return a {@link java.lang.String} object.
*/
public static String getPluginId() {
.NewInstance(polytomousKeyUuid);
open(input);
}
-
+
public static void openCdmAuthorities(UUID groupUuid)
throws Exception {
CdmAuthorityEditorInput input = CdmAuthorityEditorInput.NewInstance(groupUuid);
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+
+public class OpenDerivateViewHandler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ if(currentSelection instanceof IStructuredSelection){
+ Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
+ if(selectedElement instanceof ICdmBase){
+ DerivateViewEditorInput input = new DerivateViewEditorInput(((ICdmBase) selectedElement).getUuid());
+ try {
+ EditorUtil.open(input);
+ } catch (PartInitException e) {
+ AbstractUtility.error(OpenDerivateViewHandler.class, "Could not open DerivateView", e);
+ }
+ }
+ }
+ return null;
+
+ }
+
+}
*/
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- // TODO Auto-generated method stub
-
+ viewer.setInput(input);
}
/* (non-Javadoc)
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2013 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.derivate;
+
+import java.util.UUID;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author pplitzner
+ * @date 25.11.2013
+ *
+ */
+public class DerivateViewEditorInput implements IEditorInput {
+
+ private final UUID uuid;
+
+ /**
+ * @param uuid
+ */
+ public DerivateViewEditorInput(UUID uuid) {
+ super();
+ this.uuid = uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Class adapter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ @Override
+ public boolean exists() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ @Override
+ public ImageDescriptor getImageDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getName()
+ */
+ @Override
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ @Override
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ @Override
+ public String getToolTipText() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
+ if (uuid == null) {
+ if (other.uuid != null) {
+ return false;
+ }
+ } else if (!uuid.equals(other.uuid)) {
+ return false;
+ }
+ return true;
+ }
+
+}
import java.util.List;
+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.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.ui.handlers.IHandlerService;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeCacheStrategy;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorImpl;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
public class DerivateSearchCompositeController {
- private DerivateSearchComposite derivateSearchComposite;
- private IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase<?>> configurator;
+ private final DerivateSearchComposite derivateSearchComposite;
+ private IIdentifiableEntityServiceConfigurator<SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy>> configurator;
/**
* @param derivateSearchComposite
resultViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
-// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, editorId);
+ String commandId = "eu.etaxonomy.taxeditor.editor.handler.openDerivateView";
+
+ IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
+ try {
+ handlerService.executeCommand(commandId, null);
+ } catch (ExecutionException e) {
+ AbstractUtility.error(DerivateSearchCompositeController.class, e);
+ } catch (NotDefinedException e) {
+ AbstractUtility.error(DerivateSearchCompositeController.class, e);
+ } catch (NotEnabledException e) {
+ AbstractUtility.error(DerivateSearchCompositeController.class, e);
+ } catch (NotHandledException e) {
+ AbstractUtility.error(DerivateSearchCompositeController.class, e);
+ }
+
}
});
- configurator = new IdentifiableServiceConfiguratorImpl<SpecimenOrObservationBase<?>>();
+ configurator = new IdentifiableServiceConfiguratorImpl<SpecimenOrObservationBase<DerivedUnitFacadeCacheStrategy>>();
}
private void searchDerivates(String searchString){