eu.etaxonomy.taxeditor.navigation/p2.inf -text
eu.etaxonomy.taxeditor.navigation/plugin.xml -text
eu.etaxonomy.taxeditor.navigation/pom.xml -text
+eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationCdmViewer.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigatorStateManager.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/RecentNamesContributionItem.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenDistributionEditorWizardHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/identificationkey/AbstractIdentificaitonKeyWizard.java -text
import java.util.Map;
import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
* @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
*/
@Override
- public void show(Object input, Class<?> viewerClass) {
+ public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
try {
if(viewerClass.equals(MultiPageTaxonEditor.class)){
if(input instanceof TaxonBase){
</or>
</visibleWhen>
</command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.store.open"
+ label="Edit"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ <with
+ variable="selection">
+ <reference
+ definitionId="isClassification">
+ </reference>
+ </with>
+ </visibleWhen>
+ </command>
<command
commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
label="%command.label.6"
</with>
</definition>
</extension>
+ <extension
+ point="eu.etaxonomy.taxeditor.store.cdmViewer">
+ <cdmViewer
+ class="eu.etaxonomy.taxeditor.navigation.NavigationCdmViewer">
+ </cdmViewer>
+ </extension>
</plugin>
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+import eu.etaxonomy.taxeditor.view.ICdmViewer;
+
+public class NavigationCdmViewer implements ICdmViewer {
+
+
+ @SuppressWarnings("unused")
+ private final Logger logger = Logger.getLogger(NavigationCdmViewer.class);
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
+ */
+ @Override
+ public void show(Object input, Class<?> viewerClass, ExecutionEvent event) {
+ if(viewerClass.equals(NewClassificationWizard.class)){
+ if(input instanceof Classification){
+ Classification classification = (Classification)input;
+ NewClassificationWizard classificationWizard = new NewClassificationWizard();
+ classificationWizard.init(null, null);
+ classificationWizard.setEntity(classification);
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
+ dialog.open();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.view.ICdmViewer#getViewerClasses(java.lang.Object)
+ */
+ @Override
+ public Map<Class<?>, String> getViewerClasses(Object input) {
+ Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
+ if(input instanceof Classification){
+ viewerNameMap.put(NewClassificationWizard.class, "Classification Wizard");
+ }
+ return viewerNameMap;
+ }
+
+}
id="eu.etaxonomy.taxeditor.editor.definedTerms.delete"
name="%command.name.14">
</command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.handler.OpenHandler"
+ id="eu.etaxonomy.taxeditor.store.open"
+ name="Open">
+ </command>
</extension>
<extension
point="org.eclipse.ui.importWizards">
<meta.element />
</appInfo>
<documentation>
- Extensions must provide and ICdmViewer which maps input elements to viewers which are able to display information for them.
+ Extensions must provide an ICdmViewer which maps input elements to viewers which are able to display information for them.
</documentation>
</annotation>
<complexType>
--- /dev/null
+package eu.etaxonomy.taxeditor.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.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
+
+public class OpenHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+ if(currentSelection instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) currentSelection).getFirstElement();
+ CdmViewerChooser viewerChooser = new CdmViewerChooser(HandlerUtil.getActiveShell(event));
+ viewerChooser.chooseViewer(firstElement, event);
+ }
+ return null;
+ }
+
+}
import java.util.Map;
import java.util.Map.Entry;
+import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
private Object input;
private Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap;
+ private ExecutionEvent executionEvent;
public CdmViewerChooser(Shell parentShell) {
this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...",
/**
* Opens a popup dialog with all possible viewers for the given input.
* @param input the input for which the viewers are listed
+ * @param event the {@link ExecutionEvent} if invoked via command/handler
*/
- public void chooseViewer(Object input){
+ public void chooseViewer(Object input, ExecutionEvent event){
this.input = input;
+ this.executionEvent = event;
this.nameViewerMap = new HashMap<Entry<Class<?>, String>, ICdmViewer>();
IExtensionRegistry reg = Platform.getExtensionRegistry();
if(nameViewerMap.size()==1){
Entry<Class<?>, String> next = nameViewerMap.keySet().iterator().next();
ICdmViewer cdmViewer = nameViewerMap.get(next);
- cdmViewer.show(input, next.getKey());
+ cdmViewer.show(input, next.getKey(), event);
}
else{
if(nameViewerMap.isEmpty()){
if(nameViewerMap.containsKey(firstElement)){
Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement;
ICdmViewer cdmViewer = nameViewerMap.get(entry);
- cdmViewer.show(input, entry.getKey());
+ cdmViewer.show(input, entry.getKey(), this.executionEvent);
this.close();
}
}
import java.util.Map;
+import org.eclipse.core.commands.ExecutionEvent;
+
/**
* Implementors of this interface provide a mapping of input elements to views
* Opens the viewer defined by the given viewerClass for the given input.
* @param input the input for which a viewer should be opened
* @param viewerClass the qualified class name of the viewer
+ * @param event the {@link ExecutionEvent} if invoked via command/handler
*/
- public void show(Object input, Class<?> viewerClass);
+ public void show(Object input, Class<?> viewerClass, ExecutionEvent event);
}