Merge branch 'release/4.9.0' 4.9.0
authorjenkins <jenkins-int@bgbm.org>
Thu, 20 Jul 2017 13:44:53 +0000 (15:44 +0200)
committerjenkins <jenkins-int@bgbm.org>
Thu, 20 Jul 2017 13:44:53 +0000 (15:44 +0200)
78 files changed:
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/plugin.xml
eu.etaxonomy.taxeditor.application/pom.xml
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ModelResourceHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/pom.xml
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.cdmlib/pom.xml
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/fragment.e4xmi
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/pom.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterDragListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature.platform/pom.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.feature/pom.xml
eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.help/pom.xml
eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.molecular.lib/pom.xml
eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.molecular/pom.xml
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/pom.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java
eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.printpublisher/pom.xml
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/fragment.e4xmi
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/pom.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/AvailableFeaturesWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/AvailableFeaturesWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDragListener.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDropAdapter.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDragListener.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeExportListener.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerContextMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/pom.xml
eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.webapp/pom.xml
eu.etaxonomy.taxeditor.workbench/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.workbench/pom.xml
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/IE4ViewerPart.java [new file with mode: 0644]
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre
eu.etaxonomy.taxeditor/pom.xml
pom.xml
src/site/apt/getting-started.apt

index 7b56be4..00133b9 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Application
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/plugin
@@ -31,6 +31,12 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.e4.ui.model.workbench,
  eu.etaxonomy.taxeditor.workbench,
  org.eclipse.e4.ui.di,
+ org.eclipse.e4.core.di.annotations,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.e4.core.contexts,
+ org.eclipse.e4.core.di,
+ org.eclipse.e4.core.services,
  org.eclipse.e4.core.di.annotations
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
index 30844fa..802e04c 100644 (file)
              name="lifeCycleURI"
              value="bundleclass://eu.etaxonomy.taxeditor.application/eu.etaxonomy.taxeditor.LifeCycleManager">
        </property>
+       <property
+             name="modelResourceHandler"
+             value="bundleclass://eu.etaxonomy.taxeditor.application/eu.etaxonomy.taxeditor.ModelResourceHandler">
+       </property>
     </product>
  </extension>
  <extension
index 165f55b..9e1d175 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ModelResourceHandler.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ModelResourceHandler.java
new file mode 100644 (file)
index 0000000..164caa3
--- /dev/null
@@ -0,0 +1,338 @@
+// $Id$
+/**
+* Copyright (C) 2017 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.core.internal.runtime.PlatformURLPluginConnection;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.log.Logger;
+import org.eclipse.e4.ui.internal.workbench.CommandLineOptionModelProcessor;
+import org.eclipse.e4.ui.internal.workbench.E4Workbench;
+import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory;
+import org.eclipse.e4.ui.internal.workbench.ModelAssembler;
+import org.eclipse.e4.ui.internal.workbench.URIHelper;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.MApplicationElement;
+import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
+import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
+import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl;
+import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl;
+import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl;
+import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl;
+import org.eclipse.e4.ui.workbench.IModelResourceHandler;
+import org.eclipse.e4.ui.workbench.IWorkbench;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author pplitzner
+ * @date 07.07.2017
+ *
+ */
+public class ModelResourceHandler implements IModelResourceHandler {
+
+    private static final String WORKBENCH_XMI = "workbench.xmi";
+    private ResourceSetImpl resourceSetImpl;
+    private Resource resource;
+
+    @Inject
+    private Logger logger;
+
+    @Inject
+    private IEclipseContext context;
+
+    @Inject
+    @Named(E4Workbench.INITIAL_WORKBENCH_MODEL_URI)
+    private URI applicationDefinitionInstance;
+
+    /**
+     * Dictates whether the model should be stored using EMF or with the merging algorithm.
+     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=295524
+     *
+     */
+    final private boolean saveAndRestore;
+    final private boolean clearPersistedState;
+
+    /**
+     * Constructor.
+     *
+     * @param saveAndRestore
+     * @param clearPersistedState
+     */
+    @Inject
+    public ModelResourceHandler(@Named(IWorkbench.PERSIST_STATE) boolean saveAndRestore,
+            @Named(IWorkbench.CLEAR_PERSISTED_STATE) boolean clearPersistedState) {
+        this.saveAndRestore = saveAndRestore;
+        this.clearPersistedState = clearPersistedState;
+    }
+
+    @PostConstruct
+    void init() {
+        resourceSetImpl = new ResourceSetImpl();
+        resourceSetImpl.getResourceFactoryRegistry().getExtensionToFactoryMap()
+                .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new E4XMIResourceFactory());
+
+        resourceSetImpl.getPackageRegistry().put(ApplicationPackageImpl.eNS_URI,
+                ApplicationPackageImpl.eINSTANCE);
+        resourceSetImpl.getPackageRegistry().put(CommandsPackageImpl.eNS_URI,
+                CommandsPackageImpl.eINSTANCE);
+        resourceSetImpl.getPackageRegistry().put(UiPackageImpl.eNS_URI, UiPackageImpl.eINSTANCE);
+        resourceSetImpl.getPackageRegistry()
+                .put(MenuPackageImpl.eNS_URI, MenuPackageImpl.eINSTANCE);
+        resourceSetImpl.getPackageRegistry().put(BasicPackageImpl.eNS_URI,
+                BasicPackageImpl.eINSTANCE);
+        resourceSetImpl.getPackageRegistry().put(AdvancedPackageImpl.eNS_URI,
+                AdvancedPackageImpl.eINSTANCE);
+        resourceSetImpl
+                .getPackageRegistry()
+                .put(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.eNS_URI,
+                        org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.eINSTANCE);
+
+    }
+
+    /**
+     * @return {@code true} if the current application model has top-level windows.
+     */
+    public boolean hasTopLevelWindows() {
+        return hasTopLevelWindows(resource);
+    }
+
+    /**
+     * @return {@code true} if the specified application model has top-level windows.
+     */
+    private boolean hasTopLevelWindows(Resource applicationResource) {
+        if (applicationResource == null || applicationResource.getContents() == null) {
+            // If the application resource doesn't exist or has no contents, then it has no
+            // top-level windows (and we are in an error state).
+            return false;
+        }
+        MApplication application = (MApplication) applicationResource.getContents().get(0);
+        return !application.getChildren().isEmpty();
+    }
+
+    @Override
+    public Resource loadMostRecentModel() {
+        File workbenchData = null;
+        URI restoreLocation = null;
+
+        if (saveAndRestore) {
+            workbenchData = getWorkbenchSaveLocation();
+            restoreLocation = URI.createFileURI(workbenchData.getAbsolutePath());
+        }
+
+        if (clearPersistedState && workbenchData != null && workbenchData.exists()) {
+            workbenchData.delete();
+        }
+
+        // last stored time-stamp
+        long restoreLastModified = restoreLocation == null ? 0L : new File(
+                restoreLocation.toFileString()).lastModified();
+
+        // See bug 380663, bug 381219
+        // long lastApplicationModification = getLastApplicationModification();
+        // boolean restore = restoreLastModified > lastApplicationModification;
+        boolean restore = restoreLastModified > 0;
+        boolean initialModel;
+
+        resource = null;
+        if (restore && saveAndRestore) {
+            resource = loadResource(restoreLocation);
+            // If the saved model does not have any top-level windows, Eclipse will exit
+            // immediately, so throw out the persisted state and reinitialize with the defaults.
+            if (!hasTopLevelWindows(resource)) {
+                if (logger != null) {
+                    logger.error(new Exception(), // log a stack trace to help debug the corruption
+                            "The persisted workbench has no top-level windows, so reinitializing with defaults."); //$NON-NLS-1$
+                }
+                resource = null;
+            }
+        }
+        if (resource == null) {
+            Resource applicationResource = loadResource(applicationDefinitionInstance);
+            MApplication theApp = (MApplication) applicationResource.getContents().get(0);
+            resource = createResourceWithApp(theApp);
+            context.set(E4Workbench.NO_SAVED_MODEL_FOUND, Boolean.TRUE);
+            initialModel = true;
+        } else {
+            initialModel = false;
+        }
+
+        // Add model items described in the model extension point
+        // This has to be done before commands are put into the context
+        MApplication appElement = (MApplication) resource.getContents().get(0);
+
+        this.context.set(MApplication.class, appElement);
+        ModelAssembler contribProcessor = ContextInjectionFactory.make(ModelAssembler.class,
+                context);
+        contribProcessor.processModel(initialModel);
+
+        if (!hasTopLevelWindows(resource) && logger != null) {
+            logger.error(new Exception(), // log a stack trace to help debug the
+                                            // corruption
+                    "Initializing from the application definition instance yields no top-level windows! " //$NON-NLS-1$
+                            + "Continuing execution, but the missing windows may cause other initialization failures."); //$NON-NLS-1$
+        }
+
+        if (!clearPersistedState) {
+            CommandLineOptionModelProcessor processor = ContextInjectionFactory.make(
+                    CommandLineOptionModelProcessor.class, context);
+            processor.process();
+        }
+
+        return resource;
+    }
+
+    @Override
+    public void save() throws IOException {
+        if (saveAndRestore) {
+            resource.save(null);
+        }
+    }
+
+    /**
+     * Creates a resource with an app Model, used for saving copies of the main app model.
+     *
+     * @param theApp
+     *            the application model to add to the resource
+     * @return a resource with a proper save path with the model as contents
+     */
+    @Override
+    public Resource createResourceWithApp(MApplication theApp) {
+        Resource res = createResource();
+        res.getContents().add((EObject) theApp);
+        return res;
+    }
+
+    private Resource createResource() {
+        if (saveAndRestore) {
+            URI saveLocation = URI.createFileURI(getWorkbenchSaveLocation().getAbsolutePath());
+            return resourceSetImpl.createResource(saveLocation);
+        }
+        return resourceSetImpl.createResource(URI.createURI(WORKBENCH_XMI)); //$NON-NLS-1$
+    }
+
+    private File getWorkbenchSaveLocation() {
+        File workbenchData = new File(getBaseLocation(), WORKBENCH_XMI); //$NON-NLS-1$
+        return workbenchData;
+    }
+
+    private File getBaseLocation() {
+        File baseLocation;
+        try {
+            baseLocation = new File(URIUtil.toURI(Platform.getInstallLocation().getURL()));
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        baseLocation = new File(baseLocation, "configuration"); //$NON-NLS-1$
+        return baseLocation;
+    }
+
+    // Ensures that even models with error are loaded!
+    private Resource loadResource(URI uri) {
+        Resource resource;
+        try {
+            resource = getResource(uri);
+        } catch (Exception e) {
+            // TODO We could use diagnostics for better analyzing the error
+            logger.error(e, "Unable to load resource " + uri.toString()); //$NON-NLS-1$
+            return null;
+        }
+
+        // TODO once we switch from deltas, we only need this once on the default model?
+        String contributorURI = URIHelper.EMFtoPlatform(uri);
+        if (contributorURI != null) {
+            TreeIterator<EObject> it = EcoreUtil.getAllContents(resource.getContents());
+            while (it.hasNext()) {
+                EObject o = it.next();
+                if (o instanceof MApplicationElement) {
+                    ((MApplicationElement) o).setContributorURI(contributorURI);
+                }
+            }
+        }
+        return resource;
+    }
+
+    private Resource getResource(URI uri) throws Exception {
+        Resource resource;
+        if (saveAndRestore) {
+            resource = resourceSetImpl.getResource(uri, true);
+        } else {
+            // Workaround for java.lang.IllegalStateException: No instance data can be specified
+            // thrown by org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized
+            // The DataArea.assertLocationInitialized is called by ResourceSetImpl.getResource(URI,
+            // boolean)
+            resource = resourceSetImpl.createResource(uri);
+            resource.load(new URL(uri.toString()).openStream(), resourceSetImpl.getLoadOptions());
+        }
+
+        return resource;
+    }
+
+    protected long getLastApplicationModification() {
+        long appLastModified = 0L;
+        ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
+
+        Map<String, ?> attributes = resourceSetImpl.getURIConverter().getAttributes(
+                applicationDefinitionInstance,
+                Collections.singletonMap(URIConverter.OPTION_REQUESTED_ATTRIBUTES,
+                        Collections.singleton(URIConverter.ATTRIBUTE_TIME_STAMP)));
+
+        Object timestamp = attributes.get(URIConverter.ATTRIBUTE_TIME_STAMP);
+        if (timestamp instanceof Long) {
+            appLastModified = ((Long) timestamp).longValue();
+        } else if (applicationDefinitionInstance.isPlatformPlugin()) {
+            try {
+                java.net.URL url = new java.net.URL(applicationDefinitionInstance.toString());
+                // can't just use 'url.openConnection()' as it usually returns a
+                // PlatformURLPluginConnection which doesn't expose the
+                // last-modification time. So we try to resolve the file through
+                // the bundle to obtain a BundleURLConnection instead.
+                Object[] obj = PlatformURLPluginConnection.parse(url.getFile().trim(), url);
+                Bundle b = (Bundle) obj[0];
+                // first try to resolve as an bundle file entry, then as a resource using
+                // the bundle's classpath
+                java.net.URL resolved = b.getEntry((String) obj[1]);
+                if (resolved == null) {
+                    resolved = b.getResource((String) obj[1]);
+                }
+                if (resolved != null) {
+                    URLConnection openConnection = resolved.openConnection();
+                    appLastModified = openConnection.getLastModified();
+                }
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+
+        return appLastModified;
+    }
+
+
+
+}
index 003b49d..0fb4530 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Bulkeditor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
index 4491a90..6183142 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>4.8.2</version>
+               <version>4.9.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index ffaa86c..4f0b55d 100644 (file)
        <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.8.8.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.8.8.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.8.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.8.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.9.0.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.9.0.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.aopalliance-1.0.0.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/com.springsource.org.apache.commons.logging-1.1.1.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.9.2.jar"/>
index a47ead6..df4057d 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: CDM Library Dependencies Plugin
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Eclipse-BundleShape: dir
 Export-Package: com.google.api,
  com.google.api.detect,
@@ -70,6 +70,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.cdm.io.csv.caryophyllales.out,
  eu.etaxonomy.cdm.io.csv.redlist.demo,
  eu.etaxonomy.cdm.io.csv.redlist.out,
+ eu.etaxonomy.cdm.io.descriptive.owl.out,
  eu.etaxonomy.cdm.io.distribution.excelupdate,
  eu.etaxonomy.cdm.io.dwca,
  eu.etaxonomy.cdm.io.dwca.in,
@@ -645,15 +646,15 @@ Bundle-ClassPath: .,
  lib/aspectjrt-1.8.8.jar,
  lib/aspectjweaver-1.8.8.jar,
  lib/batik-xml-1.7.jar,
- lib/cdmlib-commons-4.8.0.jar,
- lib/cdmlib-ext-4.8.0.jar,
- lib/cdmlib-io-4.8.0.jar,
- lib/cdmlib-model-4.8.0.jar,
- lib/cdmlib-persistence-4.8.0.jar,
- lib/cdmlib-print-4.8.0.jar,
- lib/cdmlib-remote-4.8.0.jar,
- lib/cdmlib-services-4.8.0.jar,
- lib/cdmlib-test-4.8.0.jar,
+ lib/cdmlib-commons-4.9.0.jar,
+ lib/cdmlib-ext-4.9.0.jar,
+ lib/cdmlib-io-4.9.0.jar,
+ lib/cdmlib-model-4.9.0.jar,
+ lib/cdmlib-persistence-4.9.0.jar,
+ lib/cdmlib-print-4.9.0.jar,
+ lib/cdmlib-remote-4.9.0.jar,
+ lib/cdmlib-services-4.9.0.jar,
+ lib/cdmlib-test-4.9.0.jar,
  lib/com.springsource.org.aopalliance-1.0.0.jar,
  lib/com.springsource.org.apache.commons.logging-1.1.1.jar,
  lib/commons-beanutils-1.9.2.jar,
index 4c5c8ab..5572cc4 100644 (file)
@@ -6,15 +6,15 @@ bin.includes = META-INF/,\
                lib/aspectjrt-1.8.8.jar,\
                lib/aspectjweaver-1.8.8.jar,\
                lib/batik-xml-1.7.jar,\
-               lib/cdmlib-commons-4.8.0.jar,\
-               lib/cdmlib-ext-4.8.0.jar,\
-               lib/cdmlib-io-4.8.0.jar,\
-               lib/cdmlib-model-4.8.0.jar,\
-               lib/cdmlib-persistence-4.8.0.jar,\
-               lib/cdmlib-print-4.8.0.jar,\
-               lib/cdmlib-remote-4.8.0.jar,\
-               lib/cdmlib-services-4.8.0.jar,\
-               lib/cdmlib-test-4.8.0.jar,\
+               lib/cdmlib-commons-4.9.0.jar,\
+               lib/cdmlib-ext-4.9.0.jar,\
+               lib/cdmlib-io-4.9.0.jar,\
+               lib/cdmlib-model-4.9.0.jar,\
+               lib/cdmlib-persistence-4.9.0.jar,\
+               lib/cdmlib-print-4.9.0.jar,\
+               lib/cdmlib-remote-4.9.0.jar,\
+               lib/cdmlib-services-4.9.0.jar,\
+               lib/cdmlib-test-4.9.0.jar,\
                lib/com.springsource.org.aopalliance-1.0.0.jar,\
                lib/com.springsource.org.apache.commons.logging-1.1.1.jar,\
                lib/commons-beanutils-1.9.2.jar,\
index 415c7de..76a7f52 100644 (file)
@@ -4,7 +4,7 @@
   <parent>\r
     <groupId>eu.etaxonomy</groupId>\r
     <artifactId>taxeditor-parent</artifactId>\r
-    <version>4.8.2</version>\r
+    <version>4.9.0</version>\r
   </parent>\r
   <modelVersion>4.0.0</modelVersion>\r
   <artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
index 3e7f334..db5b0fa 100644 (file)
@@ -221,7 +221,7 @@ public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements IC
                if (getName() != null){
                        return getName();
                }else{
-                       return null;
+                       return super.toString();
                }
        }
 
index 2dc891e..a96f254 100644 (file)
@@ -10,8 +10,11 @@ package eu.etaxonomy.taxeditor.remoting.source;
 
 import java.util.Map;
 
+import org.apache.commons.lang3.StringUtils;
+
 import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteConfiguration;
 import eu.etaxonomy.cdm.api.service.IMetadataService;
+import eu.etaxonomy.cdm.common.CdmUtils;
 import eu.etaxonomy.cdm.config.CdmSource;
 import eu.etaxonomy.cdm.config.CdmSourceException;
 import eu.etaxonomy.cdm.model.metadata.CdmMetaDataPropertyName;
@@ -129,4 +132,13 @@ public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
                return metadataService.getCdmMetadataMap();
        }
 
+       @Override
+       public String toString() {
+               String result = CdmUtils.concat("/", baseUrl, contextPath);
+               if (StringUtils.isBlank(result)){
+                       return super.toString();
+               }else{
+                       return result;
+               }
+       }
 }
index 38a3f98..9740035 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Editor Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
 Bundle-Vendor: %Bundle-Vendor.0
 Bundle-Localization: OSGI-INF/l10n/plugin
index c841901..071d883 100644 (file)
@@ -3,6 +3,7 @@
   <imports xsi:type="commands:Command" xmi:id="_WPjpoDSnEeek0dKsFNy--Q" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
   <imports xsi:type="commands:Command" xmi:id="_Qz6EMD62EeekvPZafWEv7w" elementId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"/>
   <imports xsi:type="commands:Command" xmi:id="_majwMEaQEeeXMc6kSYO7Xg" elementId="org.eclipse.ui.file.save"/>
+  <imports xsi:type="commands:Command" xmi:id="_oBEz8GhvEee3K4uKJljEYg" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.removeFeature"/>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_gSpRsDQDEeeTNOFVGI4q2w" featurename="descriptors" parentElementId="xpath:/">
     <elements xsi:type="basic:PartDescriptor" xmi:id="_gSpRsTQDEeeTNOFVGI4q2w" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView" label="%command.label.DERIVATIVE_EDITOR" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png" tooltip="%command.label.DERIVATIVE_EDITOR" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
       <tags>View</tags>
@@ -56,6 +57,9 @@
     </elements>
     <elements xsi:type="basic:PartDescriptor" xmi:id="_R7vxEECaEeeL5JDzMOYK6g" elementId="eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor" label="Character Editor" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor">
       <tags>nonRestore</tags>
+      <menus xsi:type="menu:PopupMenu" xmi:id="_cHWz8GhvEee3K4uKJljEYg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor">
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_eDZC0GhvEee3K4uKJljEYg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.removecharacter" label="Remove Character" command="_oBEz8GhvEee3K4uKJljEYg"/>
+      </menus>
     </elements>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
index 7f5bbd6..f95dcdf 100644 (file)
       </menuContribution>
       <menuContribution
             allPopups="false"
-            locationURI="popup:bulkeditor.editor">
+            locationURI="popup:bulkeditor.editor?before=eu.etaxonomy.taxeditor.bulkeditor.separator1">
          <command
                commandId="eu.etaxonomy.taxeditor.group.cdmauthorities.edit"
                label="%command.label.45"
index 9e452ad..3e95840 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
   
   <modelVersion>4.0.0</modelVersion>
index d823f6f..a1a5776 100644 (file)
@@ -137,7 +137,7 @@ TaxonEditorInput_OPEN_MISSAPPLIED_NAME=
 TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=Das akzeptierte Taxon ist in keiner Klassifikation vorhanden. Editieren mit dem Namens-Editor ist noch nicht implementier. Benutzen Sie den Bulk-Editor.
 TaxonEditorInputFactory_COULD_NOT_CREATE=Element konnte nicht erstellt werden
 TaxonEditorInputFactory_NOT_FOUND_TAXON=Konnte Taxonknoten nicht finden. UUID
-ToggleLinkWithTaxonSelectionHandler_LINK=Verknüpfen mit Taxonauswahl
+ToggleLinkWithTaxonSelectionHandler_LINK=Mit Taxonauswahl verknüpfen 
 ToggleLinkWithTaxonSelectionHandler_UNLINK=Verknüpfung mit Taxonauswahl aufheben 
 UseObjectManager_RESET_DATA=Wiederherstellen der Nutzugsdaten
 CdmAuthorityEditor_SAVING_AUTHORITY_EDITOR=Speichere CDM Authority Editor
index e438a48..843ab21 100755 (executable)
@@ -13,6 +13,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.text.IDocument;
@@ -47,6 +48,7 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 import eu.etaxonomy.cdm.common.CdmUtils;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.name.INonViralName;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
 import eu.etaxonomy.cdm.model.name.TaxonName;
@@ -90,7 +92,6 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 02.06.2008
- * @version 1.0
  */
 abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                IFormPart, IContainerConstants, IElementHasDetails {
@@ -314,7 +315,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         */
        public void showAnnotations() {
 
-               if (getName().hasProblem()) {
+               if (getName() != null && getName().hasProblem()) {
                        showParsingProblems();
                }
 
@@ -340,7 +341,12 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        private void showParsingProblems() {
                String text = getNameViewer().getTextWidget().getText();
 
-               List<ParserProblem> parsingProblems = getName().getParsingProblems();
+               TaxonName name = getName();
+               if (name == null){
+                       return;
+               }
+
+               List<ParserProblem> parsingProblems = name.getParsingProblems();
 
                for (ParserProblem problem : parsingProblems) {
                        getNameViewer().addAnnotation(new EditorAnnotation(problem),
@@ -351,7 +357,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        private Position getParsingProblemPosition() {
                String text = getNameViewer().getTextWidget().getText();
 
-               if (getName().hasProblem() && text.length() > 0) {
+               if (getName() != null && getName().hasProblem() && text.length() > 0) {
                        int start = getName().getProblemStarts();
                        int length = getName().getProblemEnds() - start;
 
@@ -450,8 +456,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * @return
         */
        private boolean isFreetextEditingAllowed() {
-               INonViralName name = (INonViralName) HibernateProxyHelper
-                               .deproxy(getName());
                boolean enableFreetext = true;
 
                enableFreetext |= isNameUsedMultipleTimes();
@@ -468,27 +472,33 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         */
        private boolean isNameUsedMultipleTimes() {
 
-               Set<TaxonBase> taxonBases = getName().getTaxonBases();
-               Iterator<TaxonBase> tbItr = taxonBases.iterator();
-               int nonOrphanedTaxonBaseCount = taxonBases.size();
-
-               while(tbItr.hasNext()) {
-                       TaxonBase tb = tbItr.next();
-                       if(tb.isOrphaned()) {
-                               nonOrphanedTaxonBaseCount--;
+               TaxonName name = getName();
+               if (name != null){
+                       Set<TaxonBase> taxonBases = name.getTaxonBases();
+                       Iterator<TaxonBase> tbItr = taxonBases.iterator();
+                       int nonOrphanedTaxonBaseCount = taxonBases.size();
+       
+                       while(tbItr.hasNext()) {
+                               TaxonBase<?> tb = tbItr.next();
+                               if(tb.isOrphaned()) {
+                                       nonOrphanedTaxonBaseCount--;
+                               }
+                       }
+                       if(nonOrphanedTaxonBaseCount > 1) {
+                               return true;
                        }
-               }
-               if(nonOrphanedTaxonBaseCount > 1) {
-                       return true;
                }
                return false;
        }
 
        private boolean isNameParsable() {
                TaxonName name = getName();
+               if (name == null){
+                       return false;
+               }
 
                boolean isParsable = true;
-               isParsable &= CdmUtils.isEmpty(name.getAppendedPhrase()); // taxonFieldsEmpty();
+               isParsable &= StringUtils.isBlank(name.getAppendedPhrase()); // taxonFieldsEmpty();
 
                isParsable &= !name.isProtectedAuthorshipCache();
                isParsable &= !name.isProtectedNameCache();
@@ -526,8 +536,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
         */
        public TaxonName getName() {
-               return HibernateProxyHelper.deproxy(getTaxonBase()
-                               .getName());
+               return CdmBase.deproxy(getTaxonBase().getName());
        }
 
        /**
index 63a0fa0..121867d 100644 (file)
@@ -53,9 +53,6 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
                this.icon = icon;
        }
        
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
-        */
        /** {@inheritDoc} */
        @Override
        protected void initializeComposite() {
@@ -72,12 +69,13 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
        protected void updateIcon(){
                TaxonName name = getName();
                
+               
                if(! name.getStatus().isEmpty()){
                        
                        Set<NomenclaturalStatus> allStatus = name.getStatus();
                        
                        for (NomenclaturalStatus status : allStatus){
-                               if(status.getType() != null && (status.getType().equals(NomenclaturalStatusType.INVALID()) || status.getType().equals(NomenclaturalStatusType.NUDUM()))){
+                               if(status.getType() != null && (status.getType().isInvalidType())){
                                        setIcon(INVALID_OR_NUDUM_NAME_ICON);
                                        return;
                                }
index 1f5a542..84faaaf 100644 (file)
@@ -160,8 +160,8 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
      * {@inheritDoc}
      */
     public void init(DerivateViewEditorInput editorInput){
-        this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
-        this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+        this.derivateToRootEntityMap = new HashMap<>();
+        this.rootElements = new HashSet<>();
 
         //init tree
         Collection<UUID> derivativeUuids = editorInput.getDerivativeUuids();
@@ -254,8 +254,8 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
 
             List<SpecimenOrObservationBase> derivates = null;
             if(derivativeUuids!=null){
-                this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
-                this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+                this.derivateToRootEntityMap = new HashMap<>();
+                this.rootElements = new HashSet<>();
                 derivates = CdmStore.getService(IOccurrenceService.class).load(new ArrayList(derivativeUuids), SPECIMEN_INIT_STRATEGY);
             }
             updateRootEntities(derivates);
@@ -266,8 +266,8 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
 
     public void updateRootEntities(List<SpecimenOrObservationBase> derivates) {
         if(derivates!=null){
-            this.derivateToRootEntityMap = new HashMap<SpecimenOrObservationBase<?>, SpecimenOrObservationBase<?>>();
-            this.rootElements = new HashSet<SpecimenOrObservationBase<?>>();
+            this.derivateToRootEntityMap = new HashMap<>();
+            this.rootElements = new HashSet<>();
             for (SpecimenOrObservationBase derivate : derivates) {
 
                 if(derivate instanceof FieldUnit){
@@ -296,7 +296,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
         //set selection to derivatives if the filter criteria
         //taxon assignment or derivative type are set
         if(derivates!=null && !derivateSearchCompositeController.isDefaultSearch()){
-            List<TreeNode> nodesToSelect = new ArrayList<TreeNode>();
+            List<TreeNode> nodesToSelect = new ArrayList<>();
             for (SpecimenOrObservationBase specimenOrObservationBase : derivates) {
                 nodesToSelect.add(new TreeNode(specimenOrObservationBase));
             }
@@ -330,7 +330,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
         // commit the conversation and start a new transaction immediately
         conversation.commit(true);
 
-        CdmStore.getService(IOccurrenceService.class).merge(new ArrayList<SpecimenOrObservationBase>(rootElements), true);
+        CdmStore.getService(IOccurrenceService.class).merge(new ArrayList<>(rootElements), true);
 
         monitor.worked(1);
 
@@ -397,7 +397,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
                 "sources" //$NON-NLS-1$
         });
         Map<Object, List<String>> specimenPropertyPathMap =
-                new HashMap<Object, List<String>>();
+                new HashMap<>();
         specimenPropertyPathMap.put(SpecimenOrObservationBase.class,specimenPropertyPaths);
         return specimenPropertyPathMap;
     }
@@ -520,7 +520,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
             }
             if(selectedTaxon!=null){
                 Collection<SpecimenOrObservationBase> fieldUnits = CdmStore.getService(IOccurrenceService.class).listFieldUnitsByAssociatedTaxon(selectedTaxon, null, null);
-                Collection<UUID> uuids = new HashSet<UUID>();
+                Collection<UUID> uuids = new HashSet<>();
                 for (SpecimenOrObservationBase specimenOrObservationBase : fieldUnits) {
                     uuids.add(specimenOrObservationBase.getUuid());
                 }
@@ -551,7 +551,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
      */
     @Override
     public List<SpecimenOrObservationBase<?>> getRootEntities() {
-        return new ArrayList<SpecimenOrObservationBase<?>>(rootElements);
+        return new ArrayList<>(rootElements);
     }
 
     public void toggleListenToSelectionChange(MPart part) {
index 7b127f6..4da3e51 100644 (file)
@@ -13,8 +13,8 @@ import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.dnd.DragSourceEvent;
 
 import eu.etaxonomy.cdm.model.description.FeatureNode;
-import eu.etaxonomy.taxeditor.featuretree.FeatureNodeDragListener;
 import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDragListener;
 
 /**
  * @author pplitzner
index f634901..c6a0888 100644 (file)
@@ -12,19 +12,18 @@ package eu.etaxonomy.taxeditor.editor.workingSet;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
-import javax.inject.Named;
 
-import org.eclipse.e4.core.di.annotations.Optional;
 import org.eclipse.e4.ui.di.Focus;
 import org.eclipse.e4.ui.di.Persist;
 import org.eclipse.e4.ui.model.application.ui.MDirtyable;
-import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.services.EMenuService;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -42,36 +41,41 @@ import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.featuretree.FeatureNodeDragListener;
-import eu.etaxonomy.taxeditor.featuretree.FeatureNodeDropAdapter;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDragListener;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter;
 import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditorComposite;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
 
 /**
  * @author pplitzner
  * @date 24.05.2017
  *
  */
-public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChangedListener, ModifyListener{
-
+public class CharacterEditor
+        implements ICdmEntitySessionEnabled, ISelectionChangedListener, ModifyListener, IE4ViewerPart
+        , IPartContentHasDetails, IPartContentHasSupplementalData{
 
     private FeatureTreeEditorComposite characterTreeEditorComposite;
-    private FeatureTreeEditorComposite treeViewerProperties;
-    private FeatureTreeEditorComposite treeViewerStructures;
+    private FeatureTreeEditorComposite propertiesTreeEditorComposite;
+    private FeatureTreeEditorComposite structuresTreeEditorComposite;
     private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
     private Button btnAddCharacter;
 
@@ -81,11 +85,10 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
     @Inject
     private MDirtyable dirty;
 
-    private Shell shell;
-
     private ConversationHolder conversation;
 
     private ICdmEntitySession cdmEntitySession;
+    private Composite composite;
 
     public CharacterEditor() {
     }
@@ -94,7 +97,7 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
      * Create contents of the view part.
      */
     @PostConstruct
-    public void createControls(Composite parent) {
+    public void createControls(Composite parent, EMenuService menuService ) {
         if (CdmStore.isActive()){
             if(conversation == null){
                 conversation = CdmStore.createConversation();
@@ -113,74 +116,65 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
         formToolkit.adapt(sashForm);
         formToolkit.paintBordersFor(sashForm);
 
-        Composite composite = new Composite(sashForm, SWT.NONE);
+        composite = new Composite(sashForm, SWT.NONE);
         formToolkit.adapt(composite);
         formToolkit.paintBordersFor(composite);
-        composite.setLayout(new GridLayout(1, false));
+        GridLayout gl_composite = new GridLayout(1, false);
+        gl_composite.marginWidth = 0;
+        composite.setLayout(gl_composite);
 
-        Label lblNewLabel = new Label(composite, SWT.NONE);
-        lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
-        formToolkit.adapt(lblNewLabel, true, true);
-        lblNewLabel.setText("Structures");
-
-        treeViewerStructures = addFeatureTreeEditor(composite);
-        initFeatureTreeComposite(treeViewerStructures, null, null);
+        structuresTreeEditorComposite = addFeatureTreeEditor(composite);
+        initFeatureTreeComposite(structuresTreeEditorComposite, null, null);
+        structuresTreeEditorComposite.getLabel_title().setText("Structures");
 
         Composite composite_1 = new Composite(sashForm, SWT.NONE);
         formToolkit.adapt(composite_1);
         formToolkit.paintBordersFor(composite_1);
-        composite_1.setLayout(new GridLayout(1, false));
-
-        Label lblNewLabel_1 = new Label(composite_1, SWT.NONE);
-        lblNewLabel_1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
-        formToolkit.adapt(lblNewLabel_1, true, true);
-        lblNewLabel_1.setText("Properties");
+        GridLayout gl_composite_1 = new GridLayout(1, false);
+        gl_composite_1.marginWidth = 0;
+        composite_1.setLayout(gl_composite_1);
 
-        treeViewerProperties = addFeatureTreeEditor(composite_1);
-        initFeatureTreeComposite(treeViewerProperties, new CharacterDragListener(treeViewerStructures.getViewer(), treeViewerProperties.getViewer()), null);
-
-        Composite composite_2 = new Composite(sashForm, SWT.NONE);
-        formToolkit.adapt(composite_2);
-        formToolkit.paintBordersFor(composite_2);
-        composite_2.setLayout(new GridLayout(1, false));
-
-        btnAddCharacter = new Button(composite_2, SWT.NONE);
-        btnAddCharacter.setText(">>");
-        btnAddCharacter.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, true, 1, 1));
-        formToolkit.adapt(btnAddCharacter, true, true);
+        propertiesTreeEditorComposite = addFeatureTreeEditor(composite_1);
+        initFeatureTreeComposite(propertiesTreeEditorComposite, null, null);
+        propertiesTreeEditorComposite.getLabel_title().setText("Properties");
+        //TODO: fix drag and drop
+//        initFeatureTreeComposite(treeViewerProperties, new CharacterDragListener(treeViewerStructures.getViewer(), treeViewerProperties.getViewer()), null);
 
         Composite composite_3 = new Composite(sashForm, SWT.NONE);
         formToolkit.adapt(composite_3);
         formToolkit.paintBordersFor(composite_3);
-        composite_3.setLayout(new GridLayout(1, false));
+        GridLayout gl_composite_3 = new GridLayout(2, false);
+        gl_composite_3.marginWidth = 0;
+        composite_3.setLayout(gl_composite_3);
+
+        btnAddCharacter = new Button(composite_3, SWT.NONE);
+        btnAddCharacter.setText(">>");
+        formToolkit.adapt(btnAddCharacter, true, true);
 
         characterTreeEditorComposite = addFeatureTreeEditor(composite_3);
-        initFeatureTreeComposite(characterTreeEditorComposite, new FeatureNodeDragListener(characterTreeEditorComposite.getViewer()), new FeatureNodeDropAdapter(characterTreeEditorComposite.getViewer()));
+        initFeatureTreeComposite(characterTreeEditorComposite, new FeatureNodeDragListener(characterTreeEditorComposite.getViewer()), new FeatureNodeDropAdapter(dirty, characterTreeEditorComposite.getViewer()));
+        characterTreeEditorComposite.getLabel_title().setText("Characters");
 
-        sashForm.setWeights(new int[] {3, 3, 1, 3});
+        //add context menu to character viewer//create context menu
+        menuService.registerContextMenu(characterTreeEditorComposite.getViewer().getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor");
 
         init();
     }
 
     private FeatureTreeEditorComposite addFeatureTreeEditor(Composite composite_3) {
-        FeatureTreeEditorComposite featureTreeEditorComposite = new FeatureTreeEditorComposite(composite_3, SWT.BORDER);
+        FeatureTreeEditorComposite featureTreeEditorComposite = new FeatureTreeEditorComposite(composite_3, SWT.NONE);
         featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-        featureTreeEditorComposite.getButton_add().setVisible(false);
-        featureTreeEditorComposite.getButton_remove().setVisible(false);
         return featureTreeEditorComposite;
     }
 
     private void initFeatureTreeComposite(FeatureTreeEditorComposite featureTreeEditorComposite,
             FeatureNodeDragListener featureNodeDragListener, FeatureNodeDropAdapter featureNodeDropAdapter) {
         featureTreeEditorComposite.init(featureNodeDragListener, featureNodeDropAdapter, this,
-                new FeatureTreeChooserListener(featureTreeEditorComposite), new SelectionAdapter() {
-                }, new SelectionAdapter() {
-                });
+                new FeatureTreeChooserListener(featureTreeEditorComposite));
     }
 
     @Focus
-    public void focus(@Optional@Named(IServiceConstants.ACTIVE_SHELL)Shell shell){
-        this.shell = shell;
+    public void focus(){
         if(characterTreeEditorComposite!=null){
             characterTreeEditorComposite.getViewer().getControl().setFocus();
         }
@@ -199,23 +193,32 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
              */
             @Override
             public void widgetSelected(SelectionEvent e) {
-                ISelection structureTreeSelection = treeViewerStructures.getViewer().getSelection();
-                ISelection propertyTreeSelection = treeViewerProperties.getViewer().getSelection();
+                ISelection structureTreeSelection = structuresTreeEditorComposite.getViewer().getSelection();
+                ISelection propertyTreeSelection = propertiesTreeEditorComposite.getViewer().getSelection();
                 if(structureTreeSelection==null || propertyTreeSelection==null || characterTreeEditorComposite.getFeatureTree()==null){
                     MessagingUtils.warningDialog("Cannot perform action", CharacterEditor.this,
                             "You have to select a structure, a property and a feature tree to perform this action.");
                     return;
                 }
-                //get selected structure and property
-                FeatureNode structureNode = (FeatureNode) ((TreeSelection)structureTreeSelection).getFirstElement();
-                FeatureNode propertyNode = (FeatureNode) ((TreeSelection)propertyTreeSelection).getFirstElement();
-                //create new Character
-                String label = structureNode.getFeature().toString()+" "+propertyNode.getFeature().toString();
-                Character character = Character.NewInstance(structureNode, propertyNode, null, label, label);
-
-                //add new Character to feature tree
-                FeatureNode parent = ((FeatureTree) characterTreeEditorComposite.getViewer().getInput()).getRoot();
-                CdmStore.getService(IFeatureNodeService.class).addChildFeaturNode(parent.getUuid(), character.getUuid());
+                //get selected structures and properties
+                Iterator<FeatureNode> structureIterator = ((TreeSelection)structureTreeSelection).iterator();
+
+                //create all combinations of structures and properties
+                while(structureIterator.hasNext()){
+                    FeatureNode structureNode = structureIterator.next();
+                    Iterator<FeatureNode> propertiesIterator = ((TreeSelection)propertyTreeSelection).iterator();
+                    while(propertiesIterator.hasNext()){
+                        FeatureNode propertyNode = propertiesIterator.next();
+                        //create new Character
+                        String label = structureNode.getFeature().generateTitle()+" "+propertyNode.getFeature().generateTitle();
+                        Character character = Character.NewInstance(structureNode, propertyNode, "", label, label);
+                        character = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).merge(character), Character.class);
+
+                        //add new Character to feature tree
+                        FeatureNode parent = ((FeatureTree) characterTreeEditorComposite.getViewer().getInput()).getRoot();
+                        CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), character.getUuid());
+                    }
+                }
 
                 setDirty(true);
                 characterTreeEditorComposite.getViewer().refresh();
@@ -282,14 +285,11 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
         }
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     @Override
     public void selectionChanged(SelectionChangedEvent event) {
         //propagate selection
-        IStructuredSelection isel = (IStructuredSelection) event.getSelection();
-        selService.setSelection((isel.size() == 1 ? isel.getFirstElement() : isel.toArray()));
+        selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event));
     }
 
 
@@ -307,6 +307,21 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
         dirty.setDirty(isDirty);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public IStructuredSelection getSelection() {
+        return (IStructuredSelection) characterTreeEditorComposite.getViewer().getSelection();
+    }
+
+    @Override
+    public void refresh(){
+        structuresTreeEditorComposite.getViewer().refresh();
+        propertiesTreeEditorComposite.getViewer().refresh();
+        characterTreeEditorComposite.getViewer().refresh();
+    }
+
     private class FeatureTreeChooserListener extends SelectionAdapter{
         FeatureTreeEditorComposite featureTreeEditorComposite;
 
@@ -317,9 +332,10 @@ public class CharacterEditor implements ICdmEntitySessionEnabled, ISelectionChan
 
         @Override
         public void widgetSelected(SelectionEvent e) {
-            FeatureTree tree = FeatureTreeSelectionDialog.select(shell, conversation, null);
+            FeatureTree tree = FeatureTreeSelectionDialog.select(featureTreeEditorComposite.getDisplay().getActiveShell(), conversation, null);
             if(tree!=null){
                 featureTreeEditorComposite.setSelectedTree(tree, CharacterEditor.this);
+                featureTreeEditorComposite.getText_title().setEnabled(false);
             }
         }
     }
index 7c6d29c..86e1718 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature.platform"
       label="Taxeditor Dependencies"
-      version="4.8.2"
+      version="4.9.0"
       os="linux,macosx,win32"
       ws="cocoa,gtk,win32"
       arch="x86,x86_64">
index 64bcdf1..7f279f0 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>4.8.2</version>
+               <version>4.9.0</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
index a71bc49..a6a9886 100644 (file)
@@ -2,7 +2,7 @@
 <feature
       id="eu.etaxonomy.taxeditor.feature"
       label="Taxonomic Editor"
-      version="4.8.2"
+      version="4.9.0"
       provider-name="EDIT"
       plugin="eu.etaxonomy.taxeditor.application"
       os="linux,macosx,win32"
index 3c2ca8b..52faf25 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
index c538a02..50ba576 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Help
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
 Bundle-Vendor: EDIT
 Require-Bundle: org.eclipse.ui,
index 467fd4a..13a4540 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>4.8.2</version>
+               <version>4.9.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 9669d64..abe055d 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-ClassPath: .,
  lib/owlapi-xmlutils-4.1.4.jar,
  lib/commons-collections4-4.1.jar,
index 6f26658..7620905 100644 (file)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
   
   <name>Molecular Library Dependencies Bundle</name>
index 7bc93c5..fd21738 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Molecular Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
index 10e9259..cda8070 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
index f6c5bd2..8248b97 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Navigation Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
index 5ed60a6..16132c0 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <groupId>eu.etaxonomy</groupId>
                <artifactId>taxeditor-parent</artifactId>
-               <version>4.8.2</version>
+               <version>4.9.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 4b4f810..57356a8 100644 (file)
@@ -163,6 +163,7 @@ public class Messages extends NLS {
     public static String TaxonNodeLabelProvider_NO_TAXON;
     public static String TaxonNodeLabelProvider_NODE_WITH_NO_TAXON;
     public static String TaxonNodeLabelProvider_TAXON;
+    public static String TaxonNodeLabelProvider_CLASSIFICATION;
 
     public static String TreeNodeDropAdapter_10;
     public static String TreeNodeDropAdapter_BEHIND;
index 37b1180..b12a69a 100644 (file)
@@ -138,6 +138,7 @@ TaxonNavigatorLabels_ONLY_SINGLE_TAXON=The chosen operation is available only fo
 TaxonNavigatorLabels_SET_SEC_FOR_CHILDREN=Set new Secundum Reference for all children.
 TaxonNavigatorLabels_UNSAVED_CHANGES=There are unsaved changes in the source taxon. Please save first.
 TaxonNodeLabelProvider_NO_TAXON=>NO TAXON<
+TaxonNodeLabelProvider_CLASSIFICATION=Classification: 
 TaxonNodeLabelProvider_NODE_WITH_NO_TAXON=The taxon node does not have a taxon attached to it. Please check your import. TaxonNode: %s
 TaxonNodeLabelProvider_TAXON=Taxon: 
 TreeNodeDropAdapter_10=\ 
index 5bf8357..1ad57fe 100644 (file)
@@ -140,6 +140,7 @@ TaxonNavigatorLabels_UNSAVED_CHANGES=Es gibt 
 TaxonNodeLabelProvider_NO_TAXON=>KEIN TAXON<
 TaxonNodeLabelProvider_NODE_WITH_NO_TAXON=Der Taxonknoten enthält kein Taxon. Bitte überprüfen Sie den Import. Taxonknoten: %s
 TaxonNodeLabelProvider_TAXON=Taxon: 
+TaxonNodeLabelProvider_CLASSIFICATION=Klassifikation: 
 TreeNodeDropAdapter_10=\ 
 TreeNodeDropAdapter_BEHIND=Hinter
 TreeNodeDropAdapter_CANCEL=Abbrechen
index f91e19f..a1b71ab 100644 (file)
@@ -546,12 +546,13 @@ public class TaxonNavigator extends CommonNavigator implements
      */
     @Override
     public void onChange(CdmChangeEvent event) {
-        if(event.getAction() == Action.Delete && Classification.class.equals(event.getEntityType())) {
-            refresh();
-            return;
-        }
+//        if(event.getAction() == Action.Delete && Classification.class.equals(event.getEntityType())) {
+//            refresh();
+//            return;
+//        }
+        refresh();
         for(CdmBase cb : event.getChangedObjects()) {
-            if(cb instanceof TaxonNode) {
+               if(cb instanceof TaxonNode) {
                 TaxonNode tn = (TaxonNode)cb;
                 if(tn.getTaxon() == null) {
                     getCommonViewer().refresh(tn.getClassification());
index 3430ce0..b7ec191 100644 (file)
@@ -85,7 +85,9 @@ public class TaxonNodeLabelProvider extends ColumnLabelProvider
     public String getDescription(Object anElement) {
                if (anElement instanceof TaxonNode) {
                        Taxon data = ((TaxonNode) anElement).getTaxon();
-                       return Messages.TaxonNodeLabelProvider_TAXON + (data != null ? data.getTitleCache() : Messages.TaxonNodeLabelProvider_NO_TAXON);
+                       String text =  (data != null ? Messages.TaxonNodeLabelProvider_TAXON + data.getTitleCache() : Messages.TaxonNodeLabelProvider_CLASSIFICATION + ((TaxonNode)anElement).getClassification().getTitleCache());
+               
+                       return text;
                }
                return null;
        }
index a890daf..ee633e0 100644 (file)
@@ -9,6 +9,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
@@ -34,9 +35,9 @@ public class CreateClassificationHierarchyHandler extends AbstractHandler {
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
         if (currentSelection instanceof IStructuredSelection) {
             Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
-            if (selectedElement instanceof Classification) {
+            if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
 
-                Classification classification = (Classification) selectedElement;
+                Classification classification = ((TaxonNode) selectedElement).getClassification();
                 try {
                     TaxonNavigator taxonNavigator = (TaxonNavigator)AbstractUtility.showView(TaxonNavigator.ID);
 //                    IClassificationService service = CdmStore.getService(IClassificationService.class);
index e8087fb..d2b958b 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Printpublisher Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Require-Bundle: org.eclipse.osgi,
  org.eclipse.ui,
  eu.etaxonomy.taxeditor.cdmlib,
index 78eb21f..2bdab7d 100644 (file)
@@ -3,7 +3,7 @@
        <parent>
                <artifactId>taxeditor-parent</artifactId>
                <groupId>eu.etaxonomy</groupId>
-               <version>4.8.2</version>
+               <version>4.9.0</version>
        </parent>
 
        <modelVersion>4.0.0</modelVersion>
index 8809369..f8bb3ee 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: DataStore Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/bundle
index 39840fe..0f880e3 100644 (file)
@@ -6,9 +6,18 @@
     <elements xsi:type="basic:PartDescriptor" xmi:id="_2xmxoCXXEeex9MwMOgUeWw" elementId="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" label="%view.name.SESSIONS" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart">
       <tags>nonRestore</tags>
     </elements>
-    <elements xsi:type="basic:PartDescriptor" xmi:id="_J-3UEEqgEeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor" label="%partdescriptor.label.featureTreeEditor" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor">
+    <elements xsi:type="basic:PartDescriptor" xmi:id="_J-3UEEqgEeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor" label="%partdescriptor.label.featureTreeEditor" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor">
       <tags>nonRestore</tags>
       <handlers xmi:id="_H_c_EEq2EeeN-dEYnw7m3g" elementId="eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_LlbAMEq2EeeN-dEYnw7m3g"/>
+      <handlers xmi:id="_3wq0cGceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler" command="_oftL0GceEee0qLTtA2ZpVQ"/>
+      <handlers xmi:id="_VSc2UGcqEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler" command="_I_yx4GcqEee0qLTtA2ZpVQ"/>
+      <menus xsi:type="menu:PopupMenu" xmi:id="__Jwh4GceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor">
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_eWBz0GcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.addFeature" label="Add Feature" command="_oftL0GceEee0qLTtA2ZpVQ"/>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_Beb6QGcfEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.removeFeature" label="Remove Feature" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_7vaEcGcqEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportFeatureTree" label="Export Feature Tree" command="_I_yx4GcqEee0qLTtA2ZpVQ">
+          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_-91IQGcqEee0qLTtA2ZpVQ" coreExpressionId="isShowExperimentalFeatures"/>
+        </children>
+      </menus>
     </elements>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:bulkeditor.menus.openmenu">
       <parameters xmi:id="_BylIUCZzEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"/>
     </elements>
   </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_mPdAcGceEee0qLTtA2ZpVQ" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
+    <elements xsi:type="commands:Command" xmi:id="_oftL0GceEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.addFeature" commandName="Add Feature" description="Add a feature to the feature tree"/>
+    <elements xsi:type="commands:Command" xmi:id="_fNBtQGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.removeFeature" commandName="Remove Feature" description="Removes a feature from the feature tree"/>
+    <elements xsi:type="commands:Command" xmi:id="_I_yx4GcqEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.store.command.featureTree.exportTree" commandName="Export Feature Tree"/>
+  </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+    <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
+  </fragments>
 </fragment:ModelFragments>
index 54e4f6c..a23d8c2 100755 (executable)
             id="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"
             name="%command.name.11">
       </command>
-      
       <command
             defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
             id="eu.etaxonomy.taxeditor.datasource.connect"
index adcfca4..7748765 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
        <groupId>eu.etaxonomy</groupId>
        <artifactId>taxeditor-parent</artifactId>
-       <version>4.8.2</version>
+       <version>4.9.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
index 1cd019c..b17b312 100755 (executable)
@@ -58,7 +58,7 @@ public class NameDetailsViewComposite extends Composite {
        this.config = config;
 
       // Composite composite = new Composite(parent, SWT.NULL);
-       
+
        this.setLayout(new GridLayout());
        isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
        final Button activateCheckButton = new Button(this, SWT.CHECK);
@@ -81,7 +81,7 @@ public class NameDetailsViewComposite extends Composite {
         });
 
        child = new Composite(this, SWT.NULL);
-      
+
        child.setLayout(new GridLayout());
        child.setVisible(isSimpleDetailsViewActivated);
 
@@ -250,7 +250,7 @@ public class NameDetailsViewComposite extends Composite {
 
              }
         });
-       
+
        final Button showHybrid = new Button(child, SWT.CHECK);
        isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
        showHybrid.setText("Show hybrid section");
index bb58d88..fbb1862 100644 (file)
@@ -31,37 +31,23 @@ public class CdmAuthorityTableDropTargetListener implements DropTargetListener {
        public CdmAuthorityTableDropTargetListener(CdmAuthorityCompositeViewer viewer) {
                this.viewer = viewer;
        }
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(org.eclipse.swt.dnd.DropTargetEvent)
-        */
+
        @Override
        public void dragEnter(DropTargetEvent event) {                          
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(org.eclipse.swt.dnd.DropTargetEvent)
-        */
        @Override
        public void dragLeave(DropTargetEvent arg0) {
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent)
-        */
        @Override
        public void dragOperationChanged(DropTargetEvent arg0) {
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
-        */
        @Override
        public void dragOver(DropTargetEvent arg0) {
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
-        */
        @Override
        public void drop(DropTargetEvent dtevent) {
                if(TaxonNodeTransfer.getInstance().isSupportedType(dtevent.currentDataType)) {
@@ -75,9 +61,6 @@ public class CdmAuthorityTableDropTargetListener implements DropTargetListener {
                }               
        }
 
-       /* (non-Javadoc)
-        * @see org.eclipse.swt.dnd.DropTargetListener#dropAccept(org.eclipse.swt.dnd.DropTargetEvent)
-        */
        @Override
        public void dropAccept(DropTargetEvent arg0) {
        }
index b68cf91..61f1d7f 100644 (file)
@@ -1,8 +1,8 @@
 /**\r
 * Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
-* \r
+*\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
 */\r
@@ -24,53 +24,40 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase;
  *\r
  */\r
 public class DefinedTermDragListener extends DragSourceAdapter {\r
-       \r
+\r
        private Viewer viewer;\r
 \r
-       /**\r
-        * \r
-        */\r
        public DefinedTermDragListener(Viewer viewer) {\r
                this.viewer = viewer;\r
        }\r
 \r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)\r
-        */\r
        @Override\r
        public void dragStart(DragSourceEvent event) {\r
-               \r
-               event.doit = true;// set to false if needed - default is true\r
-       }\r
-\r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)\r
-        */\r
-       @Override\r
-       public void dragFinished(DragSourceEvent event) {\r
-               // TODO Auto-generated method stub\r
-               super.dragFinished(event);\r
+           IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();\r
+           List list = selection.toList();\r
+           for (Object object : list) {\r
+            if(!(object instanceof DefinedTermBase)){\r
+                event.doit = false;\r
+                return;\r
+            }\r
+        }\r
+               event.doit = true;\r
        }\r
 \r
-       /* (non-Javadoc)\r
-        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)\r
-        */\r
        @Override\r
        public void dragSetData(DragSourceEvent event) {\r
-               \r
+\r
                IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();\r
                List<DefinedTermBase> definedTerms = new ArrayList<DefinedTermBase>();\r
-               \r
+\r
                for (Object object : selection.toList()){\r
                                definedTerms.add((DefinedTermBase)object);\r
                        }\r
-                       \r
+\r
                if (TermTransfer.getInstance().isSupportedType(\r
                                event.dataType)) {\r
                        event.data = definedTerms.toArray(new DefinedTermBase[definedTerms.size()]);\r
                }\r
        }\r
-       \r
-       \r
 \r
 }\r
index 1715139..bcb6596 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -14,7 +14,6 @@ import java.util.Set;
 import org.eclipse.jface.wizard.Wizard;
 
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.FeatureTree;
 
 /**
  * <p>AvailableFeaturesWizard class.</p>
@@ -24,29 +23,21 @@ import eu.etaxonomy.cdm.model.description.FeatureTree;
  * @version 1.0
  */
 public class AvailableFeaturesWizard extends Wizard {
-       
-       private FeatureTree featureTree;
 
        private AvailableFeaturesWizardPage page;
 
        private Set<Feature> additionalFeatures;
-       
-       /**
-        * <p>Constructor for AvailableFeaturesWizard.</p>
-        *
-        * @param featureTree a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
-        */
-       public AvailableFeaturesWizard(FeatureTree featureTree){
-               this.featureTree = featureTree;
+
+       public AvailableFeaturesWizard(){
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void addPages() {
-               page = new AvailableFeaturesWizardPage(featureTree);
+               page = new AvailableFeaturesWizardPage();
                addPage(page);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public boolean performFinish() {
@@ -54,11 +45,6 @@ public class AvailableFeaturesWizard extends Wizard {
                return additionalFeatures.size() > 0;
        }
 
-       /**
-        * <p>Getter for the field <code>additionalFeatures</code>.</p>
-        *
-        * @return a {@link java.util.Set} object.
-        */
        public Set<Feature> getAdditionalFeatures() {
                return additionalFeatures;
        }
index d159e3b..a19358f 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -13,96 +13,77 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.preference.menu.DefinedTermBaseContentProvider;
-import eu.etaxonomy.taxeditor.preference.menu.DefinedTermBaseLabelProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermContentProvider;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermLabelProvider;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
- * <p>AvailableFeaturesWizardPage class.</p>
- *
  * @author n.hoffmann
  * @created Aug 5, 2010
  * @version 1.0
  */
 public class AvailableFeaturesWizardPage extends WizardPage {
 
-       private CheckboxTableViewer viewer;
-       private FeatureTree featureTree;
-
-       /**
-        * <p>Constructor for AvailableFeaturesWizardPage.</p>
-        *
-        * @param featureTree a {@link eu.etaxonomy.cdm.model.description.FeatureTree} object.
-        */
-       protected AvailableFeaturesWizardPage(FeatureTree featureTree) {
-               super("AvailableFeaturesWizardPage");           
-               this.featureTree = featureTree;
+       private CheckboxTreeViewer viewer;
+
+       protected AvailableFeaturesWizardPage() {
+               super("AvailableFeaturesWizardPage");
                setTitle("Available Features");
-               setDescription("Please select features you want to add to the tree. Features already in the tree do not show.");
+               setDescription("Please select features you want to add to the tree.");
        }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
-        */
+
        /** {@inheritDoc} */
        @Override
        public void createControl(Composite parent) {
                Composite composite = new Composite(parent, SWT.NULL);
                composite.setLayout(new GridLayout());
-               
-               viewer = CheckboxTableViewer.newCheckList(composite, SWT.NULL);
-               
+
+               viewer = new CheckboxTreeViewer(composite, SWT.NULL);
+
                viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               
-               viewer.setContentProvider(new DefinedTermBaseContentProvider());                
-               viewer.setLabelProvider(new DefinedTermBaseLabelProvider());
-               
-               viewer.setInput(getAvailableFeatures());
-               
+
+        viewer.setContentProvider(new TermContentProvider());
+        viewer.setLabelProvider(new TermLabelProvider());
+        // When user checks a checkbox in the tree, check all its children
+        viewer.addCheckStateListener(new ICheckStateListener() {
+            @Override
+            public void checkStateChanged(CheckStateChangedEvent event) {
+                viewer.setSubtreeChecked(event.getElement(), event.getChecked());
+            }
+        });
+
+        List<TermVocabulary<DefinedTermBase>> vocs = CdmStore.getService(IVocabularyService.class).findByTermType(TermType.Feature, null);
+               viewer.setInput(vocs);
+
                setControl(composite);
        }
 
-       /**
-        * <p>getSelectedFeatures</p>
-        *
-        * @return a {@link java.util.Set} object.
-        */
        public Set<Feature> getSelectedFeatures() {
-               
+
                Object[] checkedElements = viewer.getCheckedElements();
-               
+
                Set<Feature> features = new HashSet<Feature>(checkedElements.length);
-               
+
                for(Object element : checkedElements){
-                       features.add((Feature) element);
+                   if(element instanceof Feature){
+                       features.add((Feature) element);
+                   }
                }
-               
                return features;
        }
-       
-       /**
-        * We want to show only features that are not already in the featureTree
-        * 
-        * @return
-        */
-       private List<Feature> getAvailableFeatures(){
-               
-               List<Feature> preferredFeatures = CdmStore.getTermManager().getPreferredTerms(Feature.class);
-               
-               for(Feature featureAlreadyInTree : featureTree.getDistinctFeatures()){
-                       preferredFeatures.remove(featureAlreadyInTree);
-               }
-               
-               return preferredFeatures;
-               
-       }
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDragListener.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDragListener.java
deleted file mode 100644 (file)
index 048d298..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
-* Copyright (C) 2017 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.featuretree;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-
-import eu.etaxonomy.cdm.model.description.FeatureNode;
-
-/**
- * @author pplitzner
- * @since Jun 2, 2017
- *
- */
-public class FeatureNodeDragListener extends DragSourceAdapter {
-
-    private final TreeViewer viewer;
-
-    public FeatureNodeDragListener(TreeViewer viewer) {
-        this.viewer = viewer;
-    }
-
-    /**
-     * Method declared on DragSourceListener
-     */
-    @Override
-    public void dragFinished(DragSourceEvent event) {
-        if (!event.doit) {
-            return;
-        }
-        if (event.detail == DND.DROP_MOVE) {
-            viewer.refresh();
-        }
-    }
-
-    /**
-     * Method declared on DragSourceListener
-     */
-    @Override
-    public void dragSetData(DragSourceEvent event) {
-        IStructuredSelection selection = (IStructuredSelection) viewer
-                .getSelection();
-        FeatureNode[] featureNodes = (FeatureNode[]) selection.toList()
-                .toArray(new FeatureNode[selection.size()]);
-        if (FeatureNodeTransfer.getInstance().isSupportedType(
-                event.dataType)) {
-            event.data = featureNodes;
-        }
-    }
-
-    /**
-     * Method declared on DragSourceListener
-     */
-    @Override
-    public void dragStart(DragSourceEvent event) {
-        event.doit = !viewer.getSelection().isEmpty();
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDropAdapter.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/FeatureNodeDropAdapter.java
deleted file mode 100644 (file)
index a3f7c71..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
-* Copyright (C) 2017 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.featuretree;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.TransferData;
-
-import eu.etaxonomy.cdm.model.description.FeatureNode;
-import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-/**
- * @author pplitzner
- * @since Jun 2, 2017
- *
- */
-public class FeatureNodeDropAdapter extends ViewerDropAdapter {
-
-    public FeatureNodeDropAdapter(Viewer viewer) {
-        super(viewer);
-    }
-
-    @Override
-    public boolean performDrop(Object data) {
-        FeatureNode target = (FeatureNode) getCurrentTarget();
-        int position = 0;
-
-        if (target != null) {
-            int location = getCurrentLocation();
-            FeatureNode parent = target.getParent();
-            if (location == LOCATION_BEFORE) {
-                position = Math.max(0, parent.getIndex(target) - 1);
-                target = parent;
-            }
-
-            if (location == LOCATION_AFTER) {
-                position = parent.getIndex(target);
-                target = parent;
-            }
-        }
-
-        // set target to root node if there is no target specified
-        if (target == null) {
-            FeatureTree featureTree = (FeatureTree) getViewer().getInput();
-            target = featureTree.getRoot();
-        }
-
-        Object[] droppedObjects = (Object[]) data;
-        TreeViewer viewer = (TreeViewer) getViewer();
-
-        // cannot drop a feature node onto itself
-        for (Object droppedObject : droppedObjects) {
-            if (droppedObject == null) {
-                MessagingUtils.warningDialog(
-                                "Operation not supported yet",
-                                this,
-                                "We are currently unable to change the order of freshly created "
-                                        + "feature trees nodes. Please close and reopen the dialog to change the order of features.");
-                return false;
-            }
-            if (droppedObject.equals(target)) {
-                return false;
-            }
-        }
-        for (Object droppedObject : droppedObjects) {
-            FeatureNode droppedNode = (FeatureNode) droppedObject;
-            target.addChild(droppedNode, position);
-            viewer.add(target, droppedNode);
-            viewer.reveal(droppedNode);
-        }
-        return true;
-    }
-
-    @Override
-    public boolean validateDrop(Object target, int operation,
-            TransferData transferData) {
-        return FeatureNodeTransfer.getInstance().isSupportedType(
-                transferData);
-    }
-
-}
\ No newline at end of file
index e02342f..e479ae9 100644 (file)
@@ -16,7 +16,7 @@ import org.eclipse.swt.dnd.DragSourceEvent;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
 
-class FeatureNodeDragListener extends DragSourceAdapter {
+public class FeatureNodeDragListener extends DragSourceAdapter {
 
        private final TreeViewer viewer;
 
index a983236..b6a5f82 100644 (file)
@@ -8,24 +8,27 @@
 */
 package eu.etaxonomy.taxeditor.featuretree.e4;
 
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerDropAdapter;
 import org.eclipse.swt.dnd.TransferData;
 
 import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
+import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
 import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
-class FeatureNodeDropAdapter extends ViewerDropAdapter {
+public class FeatureNodeDropAdapter extends ViewerDropAdapter {
 
-    private final FeatureTreeEditor featureTreeEditor;
+    private final MDirtyable dirtyable;
 
-    protected FeatureNodeDropAdapter(FeatureTreeEditor featureTreeEditor, Viewer viewer) {
+    public FeatureNodeDropAdapter(MDirtyable dirtyable, Viewer viewer) {
                super(viewer);
-        this.featureTreeEditor = featureTreeEditor;
+        this.dirtyable = dirtyable;
        }
 
        @Override
@@ -63,18 +66,28 @@ class FeatureNodeDropAdapter extends ViewerDropAdapter {
                        }
                }
                for (Object droppedObject : droppedObjects) {
-                       FeatureNode droppedNode = (FeatureNode) droppedObject;
-                       CdmStore.getService(IFeatureNodeService.class).moveFeatureNode(droppedNode.getUuid(), target.getUuid(), position);
-                       viewer.refresh();
-                       viewer.reveal(droppedNode);
+                   if(droppedObject instanceof FeatureNode){
+                       FeatureNode droppedNode = (FeatureNode) droppedObject;
+                       CdmStore.getService(IFeatureNodeService.class).moveFeatureNode(droppedNode.getUuid(), target.getUuid(), position);
+                       viewer.reveal(droppedNode);
+                   }
+                   else if(droppedObject instanceof Feature){
+                       Feature droppedFeature = (Feature) droppedObject;
+                       CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(target.getUuid(), droppedFeature.getUuid());
+
+                   }
+                   viewer.refresh();
                }
-        this.featureTreeEditor.setDirty(true);
+        this.dirtyable.setDirty(true);
                return true;
        }
 
     @Override
     public boolean validateDrop(Object target, int operation, TransferData transferData) {
-        return FeatureNodeTransfer.getInstance().isSupportedType(transferData);
+        boolean isSupported = FeatureNodeTransfer.getInstance().isSupportedType(transferData);
+        isSupported |= TermTransfer.getInstance().isSupportedType(transferData);
+        isSupported &= getViewer().getInput()!=null;
+        return isSupported;
     }
 
 }
\ No newline at end of file
index d090ec6..8290ad1 100644 (file)
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.featuretree.e4;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -19,40 +18,36 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
-import javax.inject.Named;
 
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.e4.ui.di.Focus;
 import org.eclipse.e4.ui.di.Persist;
 import org.eclipse.e4.ui.model.application.ui.MDirtyable;
-import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.services.EMenuService;
 import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
-import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
-import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
 
 /**
  *
@@ -61,7 +56,7 @@ import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
  *
  */
 public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
-               ModifyListener, ISelectionChangedListener {
+               ModifyListener, ISelectionChangedListener, IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData {
 
     private ConversationHolder conversation;
 
@@ -73,38 +68,50 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
     @Inject
     private MDirtyable dirty;
 
-    private Shell shell;
-
-    private FeatureTree featureTree;
-
     private FeatureTreeEditorComposite composite;
 
     @Inject
-    public FeatureTreeEditor(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
-        this.shell = shell;
-        if(conversation==null){
-            conversation = CdmStore.createConversation();
-        }
-        if (CdmStore.isActive()) {
-            cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
-        }
+    public FeatureTreeEditor() {
     }
 
        /** {@inheritDoc} */
-       @PostConstruct
-       public void createControl(Composite parent, @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
-           composite = new FeatureTreeEditorComposite(parent, SWT.NULL);
-               composite.init(new FeatureNodeDragListener(composite.getViewer()), new FeatureNodeDropAdapter(this, composite.getViewer()), this, new SelectionAdapter() {
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                FeatureTree tree = FeatureTreeSelectionDialog.select(shell, conversation, null);
-                if(tree!=null){
-                    setSelectedTree(tree);
-                }
+    @PostConstruct
+    public void createControl(Composite parent, EMenuService menuService){
+        if (CdmStore.isActive()){
+            if(conversation == null){
+                conversation = CdmStore.createConversation();
             }
-        }, new AddButtonListener(), new RemoveSelectionListener());
-        composite.getText_title().setEnabled(false);
-       }
+            if(cdmEntitySession!=null){
+                cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+            }
+        }
+        else{
+            return;
+        }
+        composite = new FeatureTreeEditorComposite(parent, SWT.NULL);
+        composite.init(new FeatureNodeDragListener(composite.getViewer()),
+                new FeatureNodeDropAdapter(dirty, composite.getViewer()), this, new SelectionAdapter() {
+                    @Override
+                    public void widgetSelected(SelectionEvent e) {
+                        if(isDirty()){
+                            if(MessagingUtils.confirmDialog("Editor has to be saved", "You have to save before loading another feature tree. Save now?")){
+                                save();
+                            }
+                            else{
+                                return;
+                            }
+
+                        }
+                        FeatureTree tree = FeatureTreeSelectionDialog.select(composite.getDisplay().getActiveShell(), conversation, null);
+                        if (tree != null) {
+                            composite.setSelectedTree(tree, FeatureTreeEditor.this);
+                        }
+                    }
+                });
+
+        //create context menu
+        menuService.registerContextMenu(composite.getViewer().getControl(), "eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor");
+    }
 
        public void setDirty(boolean isDirty){
            this.dirty.setDirty(isDirty);
@@ -114,43 +121,29 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
            return dirty.isDirty();
        }
 
-    public void setSelectedTree(FeatureTree featureTree) {
-               this.featureTree = HibernateProxyHelper.deproxy(featureTree, FeatureTree.class);
-               this.featureTree.setRoot(HibernateProxyHelper.deproxy(featureTree.getRoot(), FeatureNode.class));
-               composite.getViewer().setInput(featureTree);
-
-               composite.getText_title().setEnabled(true);
-               composite.getText_title().removeModifyListener(this);
-               composite.getText_title().setText(featureTree.getTitleCache());
-               composite.getText_title().addModifyListener(this);
-       }
-
     public FeatureTree getSelectedFeatureTree(){
-        return this.featureTree;
+        return composite.getFeatureTree();
     }
 
        /** {@inheritDoc} */
        @Override
        public void modifyText(ModifyEvent e) {
-               featureTree.setTitleCache(composite.getText_title().getText(), true);
+           composite.getFeatureTree().setTitleCache(composite.getText_title().getText(), true);
                setDirty(true);
        }
 
        /** {@inheritDoc} */
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
-               IStructuredSelection selection = (IStructuredSelection) event
-                               .getSelection();
-
-               composite.getButton_add().setEnabled(selection.size() <= 1);
-               composite.getButton_remove().setEnabled(selection.size() > 0);
                //propagate selection
                selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event));
        }
 
        @Focus
        public void focus(){
-           composite.getViewer().getControl().setFocus();
+           if(composite!=null){
+               composite.getViewer().getControl().setFocus();
+           }
         if(conversation!=null && !conversation.isBound()){
             conversation.bind();
         }
@@ -159,6 +152,23 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
         }
        }
 
+       @Override
+    public void refresh(){
+           composite.getViewer().refresh();
+       }
+
+       public TreeViewer getViewer(){
+           return composite.getViewer();
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public IStructuredSelection getSelection() {
+           return (IStructuredSelection) composite.getViewer().getSelection();
+       }
+
        @Persist
        public void save(){
         if (!conversation.isBound()) {
@@ -168,7 +178,7 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
         // commit the conversation and start a new transaction immediately
         conversation.commit(true);
 
-        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
+        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(composite.getFeatureTree());
 
         this.setDirty(false);
        }
@@ -207,44 +217,8 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled,
     @Override
     public List<FeatureTree> getRootEntities() {
         List<FeatureTree> root = new ArrayList<>();
-        root.add(featureTree);
+        root.add(composite.getFeatureTree());
         return root;
     }
 
-       private class AddButtonListener extends SelectionAdapter {
-               @Override
-               public void widgetSelected(SelectionEvent e) {
-                       AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(
-                                       featureTree);
-                       WizardDialog dialog = new WizardDialog(shell, wizard);
-
-                       if (dialog.open() == IStatus.OK) {
-                FeatureNode parent = ((FeatureTree) composite.getViewer().getInput()).getRoot();
-                Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
-                for (Feature feature : additionalFeatures) {
-                                   CdmStore.getService(IFeatureNodeService.class).addChildFeaturNode(parent, feature);
-                               }
-                               setDirty(true);
-                               composite.getViewer().refresh();
-                               composite.getViewer().expandToLevel(parent, 1);
-                       }
-               }
-
-       }
-
-       private class RemoveSelectionListener extends SelectionAdapter {
-               @Override
-               public void widgetSelected(SelectionEvent e) {
-                       IStructuredSelection selection = (IStructuredSelection) composite.getViewer()
-                                       .getSelection();
-
-                       for (Object selectedObject : selection.toArray()) {
-                               FeatureNode featureNode = (FeatureNode) selectedObject;
-                               CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
-
-                       }
-                       setDirty(true);
-                       composite.getViewer().refresh();
-               }
-       }
 }
index d984255..4041343 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Text;
 import org.eclipse.swt.widgets.Tree;
 
 import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
 import eu.etaxonomy.taxeditor.featuretree.FeatureNodeTransfer;
 import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
 import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
@@ -45,17 +46,15 @@ public class FeatureTreeEditorComposite extends Composite{
     private Text text_title;
     private Button btnOpenFeatureTree;
     private TreeViewer viewer;
-    private Button button_add;
-    private Button button_remove;
 
     public FeatureTreeEditorComposite(Composite parent, int style) {
         super(parent, style);
-        setLayout(new GridLayout(2, false));
+        setLayout(new GridLayout(1, false));
 
         Composite composite_treeTitle = new Composite(this, SWT.NULL);
         composite_treeTitle.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true,
                 false));
-        GridLayout gl_composite_treeTitle = new GridLayout(2, false);
+        GridLayout gl_composite_treeTitle = new GridLayout(3, false);
         gl_composite_treeTitle.marginWidth = 0;
         composite_treeTitle.setLayout(gl_composite_treeTitle);
 
@@ -65,43 +64,29 @@ public class FeatureTreeEditorComposite extends Composite{
 
         text_title = new Text(composite_treeTitle, SWT.BORDER);
         text_title.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+        text_title.setEnabled(false);
 
-        btnOpenFeatureTree = new Button(this, SWT.NONE);
+        btnOpenFeatureTree = new Button(composite_treeTitle, SWT.NONE);
         btnOpenFeatureTree.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
         btnOpenFeatureTree.setToolTipText(Messages.FeatureTreeEditorComposite_OPEN_TREE);
         btnOpenFeatureTree.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
 
         viewer = new TreeViewer(this);
         Tree tree = viewer.getTree();
-        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+        tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
         viewer.getControl().setLayoutData(
                 new GridData(SWT.FILL, SWT.FILL, true, true));
-
-        Composite composite_buttons = new Composite(this,
-                SWT.NULL);
-        composite_buttons.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false,
-                false));
-        composite_buttons.setLayout(new GridLayout());
-
-        button_add = new Button(composite_buttons, SWT.PUSH);
-        button_add.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
-        button_add.setToolTipText(Messages.FeatureTreeEditorComposite_ADD_FEATURE);
-        button_add.setImage(ImageResources.getImage(ImageResources.ADD_EDIT));
-        button_remove = new Button(composite_buttons, SWT.PUSH);
-        button_remove.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
-        button_remove.setToolTipText(Messages.FeatureTreeEditorComposite_REMOVE_FEATURE);
-        button_remove.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
     }
 
-    public void init(DragSourceListener dragSourceListener,
-            DropTargetListener dropTargetListener, ISelectionChangedListener viewerSelectionChangedListener,
-            SelectionListener openFeatureTreeSelectionListener, SelectionListener addButtonSelectionListener, SelectionListener removeButtonSelectionListener) {
+    public void init(DragSourceListener dragSourceListener, DropTargetListener dropTargetListener,
+            ISelectionChangedListener viewerSelectionChangedListener,
+            SelectionListener openFeatureTreeSelectionListener) {
         viewer.setContentProvider(new FeatureTreeContentProvider());
         viewer.setLabelProvider(new FeatureTreeLabelProvider());
 
         int ops = DND.DROP_COPY | DND.DROP_MOVE;
         Transfer[] transfers = new Transfer[] { FeatureNodeTransfer
-                .getInstance() };
+                .getInstance(), TermTransfer.getInstance() };
         if(dragSourceListener!=null){
             viewer.addDragSupport(ops, transfers, dragSourceListener);
         }
@@ -111,9 +96,6 @@ public class FeatureTreeEditorComposite extends Composite{
 
         viewer.addSelectionChangedListener(viewerSelectionChangedListener);
 
-        button_add.addSelectionListener(addButtonSelectionListener);
-        button_remove.addSelectionListener(removeButtonSelectionListener);
-
         btnOpenFeatureTree.addSelectionListener(openFeatureTreeSelectionListener);
     }
 
@@ -125,6 +107,8 @@ public class FeatureTreeEditorComposite extends Composite{
         getText_title().removeModifyListener(modifyListener);
         getText_title().setText(featureTree.getTitleCache());
         getText_title().addModifyListener(modifyListener);
+        getText_title().setEnabled(true);
+        text_title.setEnabled(true);
     }
 
     /**
@@ -162,18 +146,4 @@ public class FeatureTreeEditorComposite extends Composite{
         return viewer;
     }
 
-    /**
-     * @return the button_add
-     */
-    public Button getButton_add() {
-        return button_add;
-    }
-
-    /**
-     * @return the button_remove
-     */
-    public Button getButton_remove() {
-        return button_remove;
-    }
-
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeExportListener.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeExportListener.java
new file mode 100644 (file)
index 0000000..aa987b4
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+* Copyright (C) 2017 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.featuretree.e4;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.descriptive.owl.out.OwlExportConfigurator;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @since Jul 4, 2017
+ *
+ */
+public class FeatureTreeExportListener extends SelectionAdapter{
+
+    private Shell shell;
+    private FeatureTreeEditorComposite composite;
+
+    public FeatureTreeExportListener(Shell shell, FeatureTreeEditorComposite composite) {
+        super();
+        this.shell = shell;
+        this.composite = composite;
+    }
+
+    @Override
+    public void widgetSelected(SelectionEvent e) {
+        if(composite.getFeatureTree()==null){
+            MessagingUtils.informationDialog("Export not possible", "There is no feature tree selected.");
+            return;
+        }
+        DirectoryDialog dialog = new DirectoryDialog(e.widget.getDisplay().getActiveShell());
+        String directoryString = dialog.open();
+        if(directoryString!=null){
+            // create job
+            Job job = CdmStore.getExportManager().createIOServiceJob(OwlExportConfigurator.NewInstance(null, null, composite.getFeatureTree()), new File(directoryString+"/owl.owl"));
+            // configure the job
+            job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+            job.setUser(true);
+            // schedule job
+            job.schedule();
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/AddFeatureHandler.java
new file mode 100644 (file)
index 0000000..db6b2d4
--- /dev/null
@@ -0,0 +1,63 @@
+/**
+* Copyright (C) 2017 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.featuretree.e4.handler;
+
+import java.util.Collection;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.featuretree.AvailableFeaturesWizard;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @since Jul 12, 2017
+ *
+ */
+public class AddFeatureHandler {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
+            @Named(IServiceConstants.ACTIVE_PART)MPart thisPart) {
+        FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
+        AvailableFeaturesWizard wizard = new AvailableFeaturesWizard();
+        WizardDialog dialog = new WizardDialog(shell, wizard);
+
+        if (dialog.open() == IStatus.OK) {
+            FeatureNode parent = ((FeatureTree) editor.getViewer().getInput()).getRoot();
+            Collection<Feature> additionalFeatures = wizard.getAdditionalFeatures();
+            for (Feature feature : additionalFeatures) {
+                if (!editor.getSelectedFeatureTree().getDistinctFeatures().contains(feature)) {
+                    CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), feature.getUuid());
+                }
+            }
+            thisPart.setDirty(true);
+            editor.getViewer().refresh();
+            editor.getViewer().expandToLevel(parent, 1);
+        }
+    }
+
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart) {
+        return thisPart.getObject() instanceof FeatureTreeEditor && ((FeatureTreeEditor) thisPart.getObject()).getSelectedFeatureTree()!=null;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/FeatureTreeExportHandler.java
new file mode 100644 (file)
index 0000000..f546e82
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+* Copyright (C) 2017 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.featuretree.e4.handler;
+
+import java.io.File;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.descriptive.owl.out.OwlExportConfigurator;
+import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @since Jul 12, 2017
+ *
+ */
+public class FeatureTreeExportHandler {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
+            @Named(IServiceConstants.ACTIVE_PART)MPart thisPart){
+        FeatureTreeEditor editor = ((FeatureTreeEditor) thisPart.getObject());
+        FeatureTree selectedFeatureTree = editor.getSelectedFeatureTree();
+        if(selectedFeatureTree==null){
+            MessagingUtils.informationDialog("Export not possible", "There is no feature tree selected.");
+            return;
+        }
+        DirectoryDialog dialog = new DirectoryDialog(shell);
+        String directoryString = dialog.open();
+        if(directoryString!=null){
+            // create job
+            Job job = CdmStore.getExportManager().createIOServiceJob(OwlExportConfigurator.NewInstance(null, null, selectedFeatureTree), new File(directoryString+"/owl.owl"));
+            // configure the job
+            job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+            job.setUser(true);
+            // schedule job
+            job.schedule();
+        }
+    }
+
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart){
+        return thisPart.getObject() instanceof FeatureTreeEditor && ((FeatureTreeEditor) thisPart.getObject()).getSelectedFeatureTree()!=null;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/RemoveFeatureHandler.java
new file mode 100644 (file)
index 0000000..4417d5b
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+* Copyright (C) 2017 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.featuretree.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
+import eu.etaxonomy.cdm.api.service.config.FeatureNodeDeletionConfigurator;
+import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
+
+/**
+ * @author pplitzner
+ * @since Jul 12, 2017
+ *
+ */
+public class RemoveFeatureHandler {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart){
+        if(thisPart.getObject() instanceof IE4ViewerPart){
+            IE4ViewerPart editor = (IE4ViewerPart) thisPart.getObject();
+            IStructuredSelection selection = editor.getSelection();
+            for (Object selectedObject : selection.toArray()) {
+                FeatureNode featureNode = (FeatureNode) selectedObject;
+                CdmStore.getService(IFeatureNodeService.class).deleteFeatureNode(featureNode.getUuid(), new FeatureNodeDeletionConfigurator());
+            }
+            thisPart.setDirty(true);
+            editor.refresh();
+        }
+    }
+
+    @CanExecute
+    public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart thisPart){
+        if(thisPart.getObject() instanceof IE4ViewerPart){
+            IE4ViewerPart viewerPart = (IE4ViewerPart)thisPart.getObject();
+            return viewerPart.getSelection()!=null && !viewerPart.getSelection().isEmpty();
+        }
+        return false;
+    }
+
+}
index da95042..96d5b74 100644 (file)
@@ -763,22 +763,15 @@ public abstract class AbstractUtility {
         }
     }
 
-    /**
-     * @param event
-     * @return
-     */
     public static Object getElementsFromSelectionChangedEvent(SelectionChangedEvent event) {
         IStructuredSelection selection = (IStructuredSelection) event.getSelection();
-        Object selectionToSet;
+        Object selectionToSet = selection;
         if(selection.size() == 1){
             selectionToSet = selection.getFirstElement();
         }
         else if(!selection.isEmpty()){
             selectionToSet = selection.toArray();
         }
-        else{
-            selectionToSet = selection;
-        }
         return selectionToSet;
     }
 }
index 479fc85..1b4220b 100644 (file)
@@ -19,6 +19,7 @@ import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.SynonymType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -40,9 +41,10 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<TaxonRelationship> {
 
-//     private TermComboElement<TaxonRelationshipTypeInverseContainer> combo_taxonRelationshipType;
-//     
-//     private EntitySelectionElement<Taxon> selection_relatedTaxon;
+       private TermComboElement<TaxonRelationshipTypeInverseContainer> combo_taxonRelationshipType;
+       
+       private EntitySelectionElement<Taxon> selection_relatedTaxon;
+       private CheckboxElement checkBoxDoubtful;
         protected ToggleableTextElement toggleable_cache;
        private  EntitySelectionElement<Reference> secReference;
        private  EntitySelectionElement<Reference> sensuReference;
@@ -69,54 +71,57 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
        @Override
        protected void createControls(ICdmFormElement formElement,
                        TaxonRelationship entity, int style) {
-//             combo_taxonRelationshipType = formFactory.createTermComboElement(
-//                             TaxonRelationshipTypeInverseContainer.class, 
-//                             formElement, "Relationship Type", 
-//                             getTaxonRelationshipTypeInverseContainer(), style);
-//             combo_taxonRelationshipType.setEnabled(false);
-//             selection_relatedTaxon = formFactory.createSelectionElement(
-//                             Taxon.class, getConversationHolder(), 
-//                             formElement, "Related Taxon", getRelatedTaxon(), 
-//                             EntitySelectionElement.SELECTABLE, style);
-               taxon = entity.getFromTaxon();
-               toggleable_cache = formFactory.createToggleableTextField(formElement,
-                               "Title Cache", taxon.getTitleCache(),
-                               taxon.isProtectedTitleCache(), style);
-
-               text_appendedPhrase = formFactory.createTextWithLabelElement(
-                               formElement, "Appended Phrase", taxon.getAppendedPhrase(),
-                               SWT.WRAP);
-
-
-               sensuReference = formFactory.createSelectionElement(Reference.class,
-                       getConversationHolder(), formElement, "Sensu",
-                       taxon.getSec(), EntitySelectionElement.ALL,
-                       style);
-
-               text_sensu_microreference = formFactory.createTextWithLabelElement(
-                               formElement, "Detail",
-                               taxon.getSecMicroReference(),null,
-                               SWT.WRAP);
-
-               
+               if (!entity.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+                       combo_taxonRelationshipType = formFactory.createTermComboElement(
+                                       TaxonRelationshipTypeInverseContainer.class, 
+                                       formElement, "Relationship Type", 
+                                       getTaxonRelationshipTypeInverseContainer(), style);
+                       combo_taxonRelationshipType.setEnabled(false);
+                       selection_relatedTaxon = formFactory.createSelectionElement(
+                                       Taxon.class, getConversationHolder(), 
+                                       formElement, "Related Taxon", getRelatedTaxon(), 
+                                       EntitySelectionElement.SELECTABLE, style);
+                       checkBoxDoubtful = formFactory.createCheckbox(formElement, "Relation is doubtful", entity.isDoubtful(), style);
+               }else{
+                       taxon = entity.getFromTaxon();
+                       toggleable_cache = formFactory.createToggleableTextField(formElement,
+                                       "Title Cache", taxon.getTitleCache(),
+                                       taxon.isProtectedTitleCache(), style);
        
+                       text_appendedPhrase = formFactory.createTextWithLabelElement(
+                                       formElement, "Appended Phrase", taxon.getAppendedPhrase(),
+                                       SWT.WRAP);
        
-               checkbox_published = formFactory.createCheckbox(formElement,
-                                       "Published", taxon.isPublish(), style);
-                       
-                       
-               secReference = formFactory.createSelectionElement(Reference.class,
-                               getConversationHolder(), formElement, "Misappl. Sec.",
-                               entity.getCitation(), EntitySelectionElement.ALL,
+       
+                       sensuReference = formFactory.createSelectionElement(Reference.class,
+                               getConversationHolder(), formElement, "Sensu",
+                               taxon.getSec(), EntitySelectionElement.ALL,
                                style);
        
-               text_secundum_microreference = formFactory.createTextWithLabelElement(
-                   formElement, "Detail",
-                   entity.getCitationMicroReference(),null,
-                   SWT.WRAP);
-               checkbox_doubtful = formFactory.createCheckbox(formElement,
-                               "Misappl. Doubtful", entity.isDoubtful(), style);
-
+                       text_sensu_microreference = formFactory.createTextWithLabelElement(
+                                       formElement, "Detail",
+                                       taxon.getSecMicroReference(),null,
+                                       SWT.WRAP);
+       
+                       
+               
+               
+                       checkbox_published = formFactory.createCheckbox(formElement,
+                                               "Published", taxon.isPublish(), style);
+                               
+                               
+                       secReference = formFactory.createSelectionElement(Reference.class,
+                                       getConversationHolder(), formElement, "Misappl. Sec.",
+                                       entity.getCitation(), EntitySelectionElement.ALL,
+                                       style);
+               
+                       text_secundum_microreference = formFactory.createTextWithLabelElement(
+                           formElement, "Detail",
+                           entity.getCitationMicroReference(),null,
+                           SWT.WRAP);
+                       checkbox_doubtful = formFactory.createCheckbox(formElement,
+                                       "Misappl. Doubtful", entity.isDoubtful(), style);
+               }
                
        }
        
@@ -135,23 +140,38 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
 
        @Override
        public void handleEvent(Object eventSource) {
-               if (eventSource== toggleable_cache) {
-               handleToggleableCacheField();
-       } else if (eventSource == checkbox_doubtful) {
-               taxon.setDoubtful(checkbox_doubtful.getSelection());
-       }  else if (eventSource == secReference) {
-               getEntity().setCitation(secReference.getSelection());
-       } else if (eventSource == text_appendedPhrase) {
-               taxon.setAppendedPhrase(text_appendedPhrase.getText());
-       } else if (eventSource == text_secundum_microreference) {
-               getEntity().setCitationMicroReference(text_secundum_microreference.getText());
-       } else if (eventSource == checkbox_published) {
-           taxon.setPublish(checkbox_published.getSelection());
-       } else if (eventSource == text_sensu_microreference) {
-        taxon.setSecMicroReference(text_sensu_microreference.getText());
-       }else if (eventSource == sensuReference) {
-               taxon.setSec(sensuReference.getSelection());
-       }
+               if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+                       if (eventSource== toggleable_cache) {
+                               handleToggleableCacheField();
+                       } else if (eventSource == checkbox_doubtful) {
+                               taxon.setDoubtful(checkbox_doubtful.getSelection());
+                       }  else if (eventSource == secReference) {
+                               getEntity().setCitation(secReference.getSelection());
+                       } else if (eventSource == text_appendedPhrase) {
+                               taxon.setAppendedPhrase(text_appendedPhrase.getText());
+                       } else if (eventSource == text_secundum_microreference) {
+                               getEntity().setCitationMicroReference(text_secundum_microreference.getText());
+                       } else if (eventSource == checkbox_published) {
+                           taxon.setPublish(checkbox_published.getSelection());
+                       } else if (eventSource == text_sensu_microreference) {
+                       taxon.setSecMicroReference(text_sensu_microreference.getText());
+                       }else if (eventSource == sensuReference) {
+                               taxon.setSec(sensuReference.getSelection());
+                       }
+               }else{
+                       if (eventSource == selection_relatedTaxon){
+                               boolean inverse = getTaxonRelationshipTypeInverseContainer().isInverse();
+                               Taxon relatedTaxon = selection_relatedTaxon.getEntity();
+                               if(inverse){
+                                       getEntity().setFromTaxon(relatedTaxon);
+                               }else{
+                                       getEntity().setToTaxon(relatedTaxon);
+                               }
+                       }else if(eventSource==checkBoxDoubtful){
+                           getEntity().setDoubtful(checkBoxDoubtful.getSelection());
+                       }
+               }       
+               firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
        
        protected void handleToggleableCacheField() {
@@ -163,19 +183,24 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
     }
        
         public void updateToggleableCacheField() {
+                if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
                if (toggleable_cache != null){
                    if (!taxon.isProtectedTitleCache()) {
                        toggleable_cache.setText(taxon.generateTitle());
                    }
                }
+                }
            }
         
         @Override
                protected void updateContent() {
-                       super.updateContent();
+                super.updateContent();
+                if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+                       
                        toggleable_cache.setEnabled(taxon.isProtectedTitleCache());
                        setIrrelevant(toggleable_cache.getState(),
                                        Arrays.asList(new Object[] { toggleable_cache, checkbox_published}));
+                }
                }
         @Override
            protected void updateControlStates() {
@@ -183,11 +208,13 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
               
            }
         @Override
-               protected void handleTitleCacheRelevantChange(PropertyChangeEvent event) {
+        protected void handleTitleCacheRelevantChange(PropertyChangeEvent event) {
+                if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
                        String title = taxon.generateTitle();
                        taxon.setTitleCache(title);
                        super.handleTitleCacheRelevantChange(event);
-               }
+                }
+        }
         
        @Override
        public void refresh(){
index f6a9b5b..760fc6a 100644 (file)
@@ -35,7 +35,7 @@ public class TaxonRelationshipDetailSection extends AbstractCdmDetailSection<Tax
        public TaxonRelationshipDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
-               super(formFactory, conversation, parentElement, selectionProvider, style);
+               super(formFactory, conversation, parentElement,  selectionProvider, style);
        }
 
        @Override
index 26926e8..1937c73 100644 (file)
@@ -109,6 +109,9 @@ public class CdmViewerContextMenu extends CompoundContributionItem {
             else if (selectedObject instanceof TreeNode){
                 selectedObject = ((TreeNode) selectedObject).getValue();
             }
+               if (selectedObject instanceof TaxonNode && !((TaxonNode)selectedObject).hasTaxon()){
+                       selectedObject = ((TaxonNode)selectedObject).getClassification();
+            }
             if(selectedObject instanceof ICdmBase){
                 params.put(command.getId()+".uuid", ((ICdmBase) selectedObject).getUuid()); //$NON-NLS-1$
             }
index 25fee3a..0f01337 100755 (executable)
@@ -46,6 +46,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -66,6 +67,7 @@ import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSec
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
+
 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
@@ -140,6 +142,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
     @Override
     public void setInput(Object input) {
+       
         if(input instanceof TreeNode){
             input = ((TreeNode) input).getValue();
         }
@@ -187,6 +190,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         // Too much type checking to decide which detail view to display.
         // Need to build in a mechanism where navigators / editors are 'aware'
         // of the corresponding detail viewer.
+       
         Object input = getInput();
 
         destroySections();
@@ -307,7 +311,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             createUserSection(rootElement);
         } else if (input instanceof Group) {
             createGroupSection(rootElement);
-        } else if (input instanceof TaxonRelationship) {
+        } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
+            createMisappliedNameSection(rootElement);
+        }else if (input instanceof TaxonRelationship ) {
             createTaxonRelationshipSection(rootElement);
         } else if (input instanceof TermVocabulary) {
             createTermVocabularySection(rootElement);
@@ -318,6 +324,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             createEmptySection(rootElement);
         }
         layout();
+       
     }
 
 
@@ -350,11 +357,14 @@ public class DetailsViewer extends AbstractCdmDataViewer {
     /** {@inheritDoc} */
     @Override
     public void setSelection(ISelection selection, boolean reveal) {
-        this.selection = selection;
-        if(this.selection!=null){
-            SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
-            fireSelectionChanged(selectionChangedEvent);
-        }
+       
+               this.selection = selection;
+             
+               if(this.selection!=null){
+                   SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
+                   fireSelectionChanged(selectionChangedEvent);
+               }
+       
     }
 
     private void createTaxonSections(RootElement parent) {
@@ -485,7 +495,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         destroySections();
 
         DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
+        
+      //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
+        
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
@@ -766,14 +778,15 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         addPart(groupByUserDetailSection);
     }
 
-    private void createTaxonRelationshipSection(RootElement parent) {
+    private void createMisappliedNameSection(RootElement parent) {
         destroySections();
 
         TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
        // ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
         addPart(taxonRelationshipDetailSection);
-     //   addPart(referencedEntityBaseDetailSection);
+        //addPart(referencedEntityBaseDetailSection);
+       
         NonViralNameDetailSection nonViralNameSection = formFactory
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
                         ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
@@ -814,6 +827,15 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         //}
     }
 
+    private void createTaxonRelationshipSection(RootElement parent) {
+       destroySections();
+
+       TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+        ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(taxonRelationshipDetailSection);
+        addPart(referencedEntityBaseDetailSection);
+    }
     private void createTermVocabularySection(RootElement parent) {
         destroySections();
 
index 7b54ee9..9eec913 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.test
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
index 5f3d7f2..24f4cf9 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
   <artifactId>eu.etaxonomy.taxeditor.test</artifactId>
   <packaging>eclipse-test-plugin</packaging>
index ebb82b8..1f7c45a 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Webapp
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.webapp;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Require-Bundle: org.eclipse.core.runtime
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
index c672aa4..022164d 100644 (file)
@@ -4,7 +4,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>eu.etaxonomy.taxeditor.webapp</artifactId>
index 9ad354e..d168eba 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Workbench Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.workbench;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0
 Bundle-Activator: eu.etaxonomy.taxeditor.workbench.Activator
 Bundle-Vendor: EDIT
 Require-Bundle: org.eclipse.ui,
index c3137b9..03f7c45 100644 (file)
@@ -3,7 +3,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/IE4ViewerPart.java b/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/IE4ViewerPart.java
new file mode 100644 (file)
index 0000000..fffdb5b
--- /dev/null
@@ -0,0 +1,33 @@
+/**
+* Copyright (C) 2017 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.workbench.part;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * This interface can be used for parts that contain a viewer
+ * and provide a selection
+ * @author pplitzner
+ * @since Jul 14, 2017
+ *
+ */
+public interface IE4ViewerPart {
+
+    /**
+     * Gets the current selection.
+     * @return the current selection
+     */
+    public IStructuredSelection getSelection();
+
+    /**
+     * Refresh the parts viewer
+     */
+    public void refresh();
+
+}
index f4520de..4ee0d3d 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="4.8.2">
+<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="4.9.0">
   <aboutInfo>
     <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
     <text>
index d54e890..ba09b0b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?pde version="3.5"?>
 
-<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="4.8.2" useFeatures="true" includeLaunchers="true">
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="4.9.0" useFeatures="true" includeLaunchers="true">
 
    <aboutInfo>
       <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
index cf71a0f..32d7a35 100644 (file)
@@ -2,7 +2,7 @@
   <parent>
     <groupId>eu.etaxonomy</groupId>
     <artifactId>taxeditor-parent</artifactId>
-    <version>4.8.2</version>
+    <version>4.9.0</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/pom.xml b/pom.xml
index f746c9f..fdd7547 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   </prerequisites>
   <groupId>eu.etaxonomy</groupId>
   <artifactId>taxeditor-parent</artifactId>
-  <version>4.8.2</version>
+  <version>4.9.0</version>
   <name>EDIT Taxonomic Editor</name>
   <description>The Taxonomic Editor for EDIT's platform for
     cybertaxonomy
   <properties>
     <java.codelevel>1.8</java.codelevel>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <cdmlib.version>4.8.0</cdmlib.version>
+    <cdmlib.version>4.9.0</cdmlib.version>
     <!-- TODO can we use project.version ????? -->
     <!-- Increasing tycho above 0.22.0 will fail for the macosx build because 
       for higher version numbers tycho needs to be build against Eclipse Mars or 
       higher -->
     <tycho.version>1.0.0</tycho.version>
-    <taxeditor.version>4.8.0</taxeditor.version>
+    <taxeditor.version>4.9.0</taxeditor.version>
     <update.dir>snapshot</update.dir>
     <unitils.version>3.4.2</unitils.version>
     <log4j.version>1.2.17</log4j.version>
index de8d504..5f25f32 100644 (file)
@@ -24,7 +24,6 @@ Setting up a Taxonomic Editor development environment
        Use git to check out the sources from the EDIT repository to a location on your development machine.
        
 ---
-$ git clone https://dev.e-taxonomy.eu/git/taxeditor.git
 $ git clone ssh://git@dev.e-taxonomy.eu/var/git/taxeditor.git
 ---