eu.etaxonomy.taxeditor.editor/pom.xml -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmDataTransfer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/ChooseFromMultipleTaxonNodesDialog.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java -text
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IDropTargetable.java -text
eu.etaxonomy.taxeditor.store/p2.inf -text
eu.etaxonomy.taxeditor.store/plugin.xml -text
eu.etaxonomy.taxeditor.store/pom.xml -text
+eu.etaxonomy.taxeditor.store/schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/CdmDataSourceRepository.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceCredentialsWizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceH2WizardPage.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractSplitableViewPart.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerChooser.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/ICdmViewer.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceContentProvider.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceLabelProvider.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/CdmDataSourceViewPart.java -text
</description>
</wizard>
</extension>
+ <extension
+ point="eu.etaxonomy.taxeditor.store.cdmViewer">
+ <cdmViewer
+ class="eu.etaxonomy.taxeditor.editor.EditorCdmViewer">
+ <input
+ class="eu.etaxonomy.cdm.model.taxon.TaxonBase">
+ <part
+ class="eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor"
+ name="Taxon Editor">
+ </part>
+ </input>
+ </cdmViewer>
+ </extension>
</plugin>
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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;
+
+import org.apache.log4j.Logger;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.view.ICdmViewer;
+
+/**
+ * @author pplitzner
+ * @date Feb 23, 2015
+ *
+ */
+public class EditorCdmViewer implements ICdmViewer {
+
+ private final Logger logger = Logger.getLogger(EditorCdmViewer.class);
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.view.ICdmViewer#show(java.lang.Object)
+ */
+ @Override
+ public void show(Object input, Class<?> viewerClass) {
+ try {
+ if(viewerClass.equals(MultiPageTaxonEditor.class)){
+ if(input instanceof TaxonBase){
+ TaxonEditorInput editorInput = TaxonEditorInput.NewInstanceFromTaxonBase(((TaxonBase<?>) input).getUuid());
+ EditorUtil.open(editorInput);
+ }
+ }
+ else if(viewerClass.equals(DerivateView.class)){
+ if(input instanceof SpecimenOrObservationBase){
+ }
+ }
+ } catch (PartInitException e) {
+ String errorMessage = "Could not open editor";
+ logger.error(errorMessage, e);
+ MessagingUtils.error(EditorCdmViewer.class, errorMessage, e);
+ }
+ }
+
+}
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+ <extension-point id="eu.etaxonomy.taxeditor.store.cdmViewer" name="Cdm Viewer" schema="schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd"/>
<extension
point="org.eclipse.ui.preferencePages">
<page
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="eu.etaxonomy.taxeditor.store" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="eu.etaxonomy.taxeditor.store" id="eu.etaxonomy.taxeditor.store.cdmViewer" name="Cdm Viewer"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="cdmViewer"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="att" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="cdmViewer">
+ <annotation>
+ <documentation>
+ A Cdm Viewer knows what viewer or editor can show which input.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="input"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the viewer.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":eu.etaxonomy.taxeditor.view.ICdmViewer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="input">
+ <annotation>
+ <documentation>
+ The input element which can be shown by the cdmViewer.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="part"/>
+ </sequence>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the input element.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="part">
+ <annotation>
+ <documentation>
+ The part which can be opened for the given input.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the part.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ The name of the part.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- /dev/null
+// $Id$
+/**
+ * Copyright (C) 2015 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.view;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+/**
+ * @author pplitzner
+ * @date Feb 23, 2015
+ *
+ */
+public class CdmViewerChooser extends PopupDialog implements ISelectionChangedListener{
+
+ private Map<String, ICdmViewer> viewerNameMap;
+ private Object input;
+
+ public CdmViewerChooser(Shell parentShell) {
+ this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...", "Clicking will open the selected viewer");
+ }
+
+ public CdmViewerChooser(Shell parent, int shellStyle, boolean takeFocusOnOpen, boolean persistSize,
+ boolean persistLocation, boolean showDialogMenu, boolean showPersistActions, String titleText,
+ String infoText) {
+ super(parent, shellStyle, takeFocusOnOpen, persistSize, persistLocation, showDialogMenu, showPersistActions,
+ titleText, infoText);
+ }
+
+ public void chooseViewer(Object input){
+ viewerNameMap = new HashMap<String, ICdmViewer>();
+ this.input = input;
+ IExtensionRegistry reg = Platform.getExtensionRegistry();
+ IConfigurationElement[] extensions = reg
+ .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
+ for (IConfigurationElement e : extensions) {
+ Object o;
+// try {
+// o = e.createExecutableExtension("class");
+// if (o instanceof ICdmViewer) {
+// ICdmViewer cdmViewer = (ICdmViewer) o;
+// Collection<String> viewerNames = cdmViewer.getViewerNames(input);
+// if(viewerNames!=null){
+// for (String string : viewerNames) {
+// viewerNameMap.put(string, cdmViewer);
+// }
+// }
+// }
+// } catch (CoreException e1) {
+// MessagingUtils.error(CdmViewerChooser.class, "Could not load cdmViewer extension", e1);
+// }
+ for (IConfigurationElement inputConfigurationElement : e.getChildren("input")) {
+ System.out.println("input");
+ for (IConfigurationElement partConfigurationElement : inputConfigurationElement.getChildren("part")) {
+ System.out.println("part");
+ }
+ }
+ }
+ this.open();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ TableViewer viewer = new TableViewer(new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.setLabelProvider(new ColumnLabelProvider());
+ viewer.addSelectionChangedListener(this);
+ viewer.setInput(viewerNameMap.keySet());
+ return parent;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ ICdmViewer cdmViewer = viewerNameMap.get(firstElement);
+ if(cdmViewer!=null){
+ cdmViewer.show(input, null);
+ this.close();
+ }
+ }
+ }
+
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2015 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.view;
+
+
+/**
+ * @author pplitzner
+ * @date Feb 23, 2015
+ *
+ */
+public interface ICdmViewer {
+
+ public void show(Object input, Class<?> viewerName);
+
+}