Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/plugin
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
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
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
--- /dev/null
+// $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;
+ }
+
+
+
+}
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<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-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.9.0-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.9.0-SNAPSHOT.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"/>
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.qualifier
Eclipse-BundleShape: dir
Export-Package: com.google.api,
com.google.api.detect,
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,
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-SNAPSHOT.jar,
+ lib/cdmlib-ext-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-io-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-model-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-persistence-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-print-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-remote-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-services-4.9.0-SNAPSHOT.jar,
+ lib/cdmlib-test-4.9.0-SNAPSHOT.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,
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-SNAPSHOT.jar,\
+ lib/cdmlib-ext-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-io-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-model-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-persistence-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-print-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-remote-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-services-4.9.0-SNAPSHOT.jar,\
+ lib/cdmlib-test-4.9.0-SNAPSHOT.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,\
<parent>\r
<groupId>eu.etaxonomy</groupId>\r
<artifactId>taxeditor-parent</artifactId>\r
- <version>4.8.2</version>\r
+ <version>4.9.0-SNAPSHOT</version>\r
</parent>\r
<modelVersion>4.0.0</modelVersion>\r
<artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
if (getName() != null){
return getName();
}else{
- return null;
+ return super.toString();
}
}
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;
return metadataService.getCdmMetadataMap();
}
+ @Override
+ public String toString() {
+ String result = CdmUtils.concat("/", baseUrl, contextPath);
+ if (StringUtils.isBlank(result)){
+ return super.toString();
+ }else{
+ return result;
+ }
+ }
}
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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
* {@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();
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);
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){
//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));
}
// 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);
"sources" //$NON-NLS-1$
});
Map<Object, List<String>> specimenPropertyPathMap =
- new HashMap<Object, List<String>>();
+ new HashMap<>();
specimenPropertyPathMap.put(SpecimenOrObservationBase.class,specimenPropertyPaths);
return specimenPropertyPathMap;
}
}
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());
}
*/
@Override
public List<SpecimenOrObservationBase<?>> getRootEntities() {
- return new ArrayList<SpecimenOrObservationBase<?>>(rootElements);
+ return new ArrayList<>(rootElements);
}
public void toggleListenToSelectionChange(MPart part) {
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;
private ConversationHolder conversation;
private ICdmEntitySession cdmEntitySession;
+ private Composite composite;
public CharacterEditor() {
}
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));
- 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);
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");
-
treeViewerProperties = addFeatureTreeEditor(composite_1);
- initFeatureTreeComposite(treeViewerProperties, new CharacterDragListener(treeViewerStructures.getViewer(), treeViewerProperties.getViewer()), null);
+ initFeatureTreeComposite(treeViewerProperties, null, null);
+ //TODO: fix drag and drop
+// initFeatureTreeComposite(treeViewerProperties, new CharacterDragListener(treeViewerStructures.getViewer(), treeViewerProperties.getViewer()), null);
Composite composite_2 = new Composite(sashForm, SWT.NONE);
formToolkit.adapt(composite_2);
private FeatureTreeEditorComposite addFeatureTreeEditor(Composite composite_3) {
FeatureTreeEditorComposite featureTreeEditorComposite = new FeatureTreeEditorComposite(composite_3, SWT.BORDER);
featureTreeEditorComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- featureTreeEditorComposite.getButton_add().setVisible(false);
- featureTreeEditorComposite.getButton_remove().setVisible(false);
+ featureTreeEditorComposite.getComposite_buttons().setVisible(false);
+ featureTreeEditorComposite.getText_title().setEnabled(false);
return featureTreeEditorComposite;
}
featureTreeEditorComposite.init(featureNodeDragListener, featureNodeDropAdapter, this,
new FeatureTreeChooserListener(featureTreeEditorComposite), new SelectionAdapter() {
}, new SelectionAdapter() {
+ }, new SelectionAdapter() {
});
}
<feature
id="eu.etaxonomy.taxeditor.feature.platform"
label="Taxeditor Dependencies"
- version="4.8.2"
+ version="4.9.0.qualifier"
os="linux,macosx,win32"
ws="cocoa,gtk,win32"
arch="x86,x86_64">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature.platform</artifactId>
<feature
id="eu.etaxonomy.taxeditor.feature"
label="Taxonomic Editor"
- version="4.8.2"
+ version="4.9.0.qualifier"
provider-name="EDIT"
plugin="eu.etaxonomy.taxeditor.application"
os="linux,macosx,win32"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.feature</artifactId>
Bundle-ManifestVersion: 2
Bundle-Name: Help
Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
Bundle-Vendor: EDIT
Require-Bundle: org.eclipse.ui,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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.qualifier
Bundle-ClassPath: .,
lib/owlapi-xmlutils-4.1.4.jar,
lib/commons-collections4-4.1.jar,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<name>Molecular Library Dependencies Bundle</name>
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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.qualifier
Require-Bundle: org.eclipse.osgi,
org.eclipse.ui,
eu.etaxonomy.taxeditor.cdmlib,
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/bundle
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
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);
});
child = new Composite(this, SWT.NULL);
-
+
child.setLayout(new GridLayout());
child.setVisible(isSimpleDetailsViewActivated);
}
});
-
+
final Button showHybrid = new Button(child, SWT.CHECK);
isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
showHybrid.setText("Show hybrid section");
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)) {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.swt.dnd.DropTargetListener#dropAccept(org.eclipse.swt.dnd.DropTargetEvent)
- */
@Override
public void dropAccept(DropTargetEvent arg0) {
}
import javax.inject.Named;
import org.eclipse.core.runtime.IStatus;
+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 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;
@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, @Optional@Named(IServiceConstants.ACTIVE_SHELL) Shell shell){
+ if (CdmStore.isActive()){
+ if(conversation == null){
+ conversation = CdmStore.createConversation();
}
- }, new AddButtonListener(), new RemoveSelectionListener());
+ 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(this, composite.getViewer()), this, new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FeatureTree tree = FeatureTreeSelectionDialog.select(shell, conversation, null);
+ if (tree != null) {
+ composite.setSelectedTree(tree, FeatureTreeEditor.this);
+ }
+ }
+ }, new AddButtonListener(), new RemoveSelectionListener(), new FeatureTreeExportListener(shell, composite));
composite.getText_title().setEnabled(false);
- }
+ }
public void setDirty(boolean isDirty){
this.dirty.setDirty(isDirty);
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);
}
IStructuredSelection selection = (IStructuredSelection) event
.getSelection();
- composite.getButton_add().setEnabled(selection.size() <= 1);
- composite.getButton_remove().setEnabled(selection.size() > 0);
+ composite.getBtnAdd().setEnabled(selection.size() <= 1);
+ composite.getBtnRemove().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();
}
// 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);
}
@Override
public List<FeatureTree> getRootEntities() {
List<FeatureTree> root = new ArrayList<>();
- root.add(featureTree);
+ root.add(composite.getFeatureTree());
return root;
}
@Override
public void widgetSelected(SelectionEvent e) {
AvailableFeaturesWizard wizard = new AvailableFeaturesWizard(
- featureTree);
- WizardDialog dialog = new WizardDialog(shell, wizard);
+ composite.getFeatureTree());
+ WizardDialog dialog = new WizardDialog(e.widget.getDisplay().getActiveShell(), wizard);
if (dialog.open() == IStatus.OK) {
FeatureNode parent = ((FeatureTree) composite.getViewer().getInput()).getRoot();
composite.getViewer().refresh();
}
}
+
}
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeLabelProvider;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* @author pplitzner
private Text text_title;
private Button btnOpenFeatureTree;
private TreeViewer viewer;
- private Button button_add;
- private Button button_remove;
+ private Button btnAdd;
+ private Button btnRemove;
+ private Button btnExportTree;
+
+ private Composite composite_buttons;
public FeatureTreeEditorComposite(Composite parent, int style) {
super(parent, style);
viewer.getControl().setLayoutData(
new GridData(SWT.FILL, SWT.FILL, true, true));
- Composite composite_buttons = new Composite(this,
+ 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));
+ btnAdd = new Button(composite_buttons, SWT.PUSH);
+ btnAdd.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
+ btnAdd.setToolTipText(Messages.FeatureTreeEditorComposite_ADD_FEATURE);
+ btnAdd.setImage(ImageResources.getImage(ImageResources.ADD_EDIT));
+ btnRemove = new Button(composite_buttons, SWT.PUSH);
+ btnRemove.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
+ btnRemove.setToolTipText(Messages.FeatureTreeEditorComposite_REMOVE_FEATURE);
+ btnRemove.setImage(ImageResources.getImage(ImageResources.TRASH_ICON));
+
+ btnExportTree = new Button(composite_buttons, SWT.NONE);
+ btnExportTree.setToolTipText("Export feature tree");
+ btnExportTree.setImage(ImageResources.getImage(ImageResources.MOVE_ICON));
+ btnExportTree.setVisible(TaxeditorStorePlugin.getDefault().getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES));
}
public void init(DragSourceListener dragSourceListener,
DropTargetListener dropTargetListener, ISelectionChangedListener viewerSelectionChangedListener,
- SelectionListener openFeatureTreeSelectionListener, SelectionListener addButtonSelectionListener, SelectionListener removeButtonSelectionListener) {
+ SelectionListener openFeatureTreeSelectionListener, SelectionListener addButtonSelectionListener, SelectionListener removeButtonSelectionListener, SelectionListener exportButtonSelectionListener) {
viewer.setContentProvider(new FeatureTreeContentProvider());
viewer.setLabelProvider(new FeatureTreeLabelProvider());
viewer.addSelectionChangedListener(viewerSelectionChangedListener);
- button_add.addSelectionListener(addButtonSelectionListener);
- button_remove.addSelectionListener(removeButtonSelectionListener);
+ btnAdd.addSelectionListener(addButtonSelectionListener);
+ btnRemove.addSelectionListener(removeButtonSelectionListener);
+ btnExportTree.addSelectionListener(exportButtonSelectionListener);
btnOpenFeatureTree.addSelectionListener(openFeatureTreeSelectionListener);
}
/**
* @return the button_add
*/
- public Button getButton_add() {
- return button_add;
+ public Button getBtnAdd() {
+ return btnAdd;
}
/**
* @return the button_remove
*/
- public Button getButton_remove() {
- return button_remove;
+ public Button getBtnRemove() {
+ return btnRemove;
+ }
+
+ /**
+ * @return the composite_buttons
+ */
+ public Composite getComposite_buttons() {
+ return composite_buttons;
+ }
+
+ /**
+ * @return the btnExportTree
+ */
+ public Button getBtnExportTree() {
+ return btnExportTree;
}
}
--- /dev/null
+/**
+* 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();
+ }
+ }
+}
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.qualifier
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<artifactId>eu.etaxonomy.taxeditor.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
Bundle-ManifestVersion: 2
Bundle-Name: Webapp
Bundle-SymbolicName: eu.etaxonomy.taxeditor.webapp;singleton:=true
-Bundle-Version: 4.8.2
+Bundle-Version: 4.9.0.qualifier
Require-Bundle: org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.webapp</artifactId>
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.qualifier
Bundle-Activator: eu.etaxonomy.taxeditor.workbench.Activator
Bundle-Vendor: EDIT
Require-Bundle: org.eclipse.ui,
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<?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.qualifier">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<text>
<?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.qualifier" useFeatures="true" includeLaunchers="true">
<aboutInfo>
<image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
</prerequisites>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0-SNAPSHOT</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-SNAPSHOT</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-SNAPSHOT</taxeditor.version>
<update.dir>snapshot</update.dir>
<unitils.version>3.4.2</unitils.version>
<log4j.version>1.2.17</log4j.version>