Bundle-ManifestVersion: 2
Bundle-Name: Application
Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/plugin
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_pdAMoB4DEeehWtOSgLepjA">
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_0q2vsB4EEeehWtOSgLepjA" featurename="descriptors" parentElementId="org.eclipse.e4.legacy.ide.application"/>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_bM7nAB4IEeehWtOSgLepjA" featurename="menuContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_0q2vsB4EEeehWtOSgLepjA" featurename="descriptors" parentElementId="xpath:/"/>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_bM7nAB4IEeehWtOSgLepjA" featurename="menuContributions" parentElementId="xpath:/">
<elements xsi:type="menu:MenuContribution" xmi:id="_q5WDAB6sEeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.menucontribution.menu" parentId="org.eclipse.ui.main.menu">
<children xsi:type="menu:Menu" xmi:id="_0MhekB6sEeePLJ5to5QrXQ" elementId="org.eclipse.ui.main.menu.file" label="%menu.label">
<children xsi:type="menu:Menu" xmi:id="_zznkcB6uEeePLJ5to5QrXQ" elementId="eu.etaxonomy.navigation.menu.new" label="%menu.label.3"/>
</children>
</elements>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_vvQmIB4JEeehWtOSgLepjA" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_vvQmIB4JEeehWtOSgLepjA" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_haDmcB6eEeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.OpenExternalAboutPlatformHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.application/eu.etaxonomy.taxeditor.OpenExternalAboutPlatformHandler" command="_V9LTcB6eEeePLJ5to5QrXQ"/>
<elements xsi:type="commands:Handler" xmi:id="_3wxe4B6gEeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.OpenExternalParserHelpHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.application/eu.etaxonomy.taxeditor.OpenExternalParserHelpHandler" command="_ye6jsB6gEeePLJ5to5QrXQ"/>
<elements xsi:type="commands:Handler" xmi:id="_cwy_oB-LEeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" command="_LuEl0B-IEeeIA_2gwq7JKg"/>
<elements xsi:type="commands:Handler" xmi:id="_pZ84gB-LEeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.handler.OpenDatabasePreferencesWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenDatabasePreferencesWizardHandler" command="_JXXNIB-IEeeIA_2gwq7JKg"/>
<elements xsi:type="commands:Handler" xmi:id="_fAnCkCaQEeeO2YpaECSmsg" elementId="eu.etaxonomy.taxeditor.handler.OpenImportPreferenceHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/target.classes.eu.etaxonomy.taxeditor.handler.OpenImportPreferenceHandler" command="_q1JAkCaQEeeO2YpaECSmsg"/>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1jM6sB4JEeehWtOSgLepjA" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1jM6sB4JEeehWtOSgLepjA" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_V9LTcB6eEeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.help.aboutPlatform" commandName="%command.name.0"/>
<elements xsi:type="commands:Command" xmi:id="_ye6jsB6gEeePLJ5to5QrXQ" elementId="eu.etaxonomy.taxeditor.application.help.parser" commandName="%command.name"/>
<elements xsi:type="commands:Command" xmi:id="_dlo3oB60EeePLJ5to5QrXQ" elementId="org.eclipse.ui.file.import" commandName="%command.label.3"/>
<elements xsi:type="commands:Command" xmi:id="_LuEl0B-IEeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.application.DatabaseRepairFunctionality" commandName="%command.label.24"/>
<elements xsi:type="commands:Command" xmi:id="_q1JAkCaQEeeO2YpaECSmsg" elementId="eu.etaxonomy.taxeditor.application.ImportSettings" commandName="%command.label.25"/>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_nOhPoB9zEeeIA_2gwq7JKg" featurename="trimContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_nOhPoB9zEeeIA_2gwq7JKg" featurename="trimContributions" parentElementId="xpath:/">
<elements xsi:type="menu:TrimContribution" xmi:id="_FIbzwB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.application.trimcontribution.0" parentId="org.eclipse.ui.main.toolbar" positionInParent="after=additions">
<children xsi:type="menu:ToolBar" xmi:id="_KDVngB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.application.toolbar.0">
<children xsi:type="menu:HandledToolItem" xmi:id="_KvxPsB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.application.handledtoolitem.xxxx" label="%command.label.21" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/new_wiz.png" command="_hooiQB7QEeeC-JvycL9ysA">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import java.util.Arrays;
import java.util.List;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.MElementContainer;
+import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
import org.eclipse.e4.ui.workbench.lifecycle.PreSave;
import org.eclipse.e4.ui.workbench.lifecycle.ProcessAdditions;
import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @author pplitzner
* @date 05.07.2017
*
*/
-public class LifeCycleManager {
+public class LifeCycleManager implements IContextListener{
private static final String NON_RESTORE = "nonRestore";
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ public LifeCycleManager() {
+ CdmStore.getContextManager().addContextListener(this);
+ }
+
@PostContextCreate
private void postContextCreate() {
}
@ProcessAdditions
- private void processAdditions() {
+ private void processAdditions(MApplication application) {
+ this.application = application;
+ hideParts();
}
@ProcessRemovals
}
@PreSave
- private void preSave(EModelService modelService, MApplication application){
+ private void preSave(){
+ }
+
+ private void hideParts() {
List<MPart> elements = modelService.findElements(application, null, MPart.class, Arrays.asList(NON_RESTORE));
for (MPart part : elements) {
- part.setToBeRendered(false);
+ MElementContainer<MUIElement> parent = part.getParent();
+ if(parent!=null){
+ if(parent.getSelectedElement()!=null
+ && parent.getSelectedElement().equals(part)){
+ parent.setSelectedElement(null);
+ }
+ parent.getChildren().remove(part);
+ }
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ hideParts();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+ hideParts();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextRefresh(IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ }
+
}
* This is a copy of
* {@link org.eclipse.e4.ui.internal.workbench.ResourceHandler}. The copy is
* registered in the plugin.xml in order to control the loading and saving of
- * the application model. The only current change is the different save location
- * (see {@link #getBaseLocation()})
+ * the application model.
*
* @author pplitzner
* @date 07.07.2017
@Inject
public ModelResourceHandler(@Named(IWorkbench.PERSIST_STATE) boolean saveAndRestore,
@Named(IWorkbench.CLEAR_PERSISTED_STATE) boolean clearPersistedState) {
- this.saveAndRestore = saveAndRestore;
+ //FIXME E4 we are currently not saving the workbench.xmi because of problems with missing context menus
+ // see #6954
+ this.saveAndRestore = false;
this.clearPersistedState = clearPersistedState;
}
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.navigation.search.SearchResultView;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.editor.view.concept.ConceptViewPart;
-
/**
* @author a.oppermann
* @created Nov 18, 2014
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
* .IPageLayout)
IFolderLayout navigationFolder = layout.createFolder("navigation",
IPageLayout.LEFT, 0.25f, layout.getEditorArea());
- navigationFolder.addView(TaxonNavigator.ID);
- navigationFolder.addPlaceholder(SearchResultView.ID + ":*");
+ navigationFolder.addView(NAVIGATOR);
+ navigationFolder.addPlaceholder(SEARCH_RESULTS);
- layout.addView(CdmDataSourceViewPart.ID, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
IFolderLayout folder = layout.createFolder("Folder", IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
- folder.addView(DescriptiveViewPart.ID);
- folder.addView(DetailsViewPart.ID);
- folder.addView(ConceptViewPart.ID);
+ folder.addView(FACTUAL_DATA_VIEW);
+ folder.addView(DETAILS_VIEW);
// folder.addView(MediaViewPart.ID);
// createAdditionalFolder(layout, layout.getEditorArea());
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.perspective;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.IPlaceholderFolderLayout;
-import org.eclipse.ui.progress.IProgressConstants;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
+import eu.etaxonomy.taxeditor.store.AppModelId;
/**
* @author n.hoffmann
public abstract class Default implements IPerspectiveFactory {
protected IPlaceholderFolderLayout folderAdditional;
-
+
+ protected static final String DETAILS_VIEW = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_DETAILS_DETAILSPARTE4;
+ protected static final String SUPPLEMENTAL_VIEW = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_SUPPLEMENTALDATA_SUPPLEMENTALDATAPARTE4;
+ protected static final String NAVIGATOR = eu.etaxonomy.taxeditor.navigation.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR;
+ protected static final String NAME_EDITOR = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4;
+ protected static final String FACTUAL_DATA_VIEW = eu.etaxonomy.taxeditor.editor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4;
+ protected static final String SEARCH_RESULTS = eu.etaxonomy.taxeditor.navigation.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_SEARCH_E4_SEARCHRESULTVIEWE4;
+
+
public static final String ADDITIONAL = "additional";
-
+
/**
- *
+ *
* @param layout
* @param refId
*/
public void createAdditionalFolder(IPageLayout layout, String refId) {
- folderAdditional = layout.createPlaceholderFolder(ADDITIONAL, IPageLayout.BOTTOM, 0.25f, refId);
-
- folderAdditional.addPlaceholder(CdmDataSourceViewPart.ID);
- folderAdditional.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
}
package eu.etaxonomy.taxeditor.perspective;
import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.progress.IProgressConstants;
-
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
/**
* @author pplitzner
@Override
public void createInitialLayout(IPageLayout layout) {
- layout.addView(TaxonNavigator.ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
-
- layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
+ layout.addView(NAVIGATOR, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
- layout.addView(DescriptiveViewPart.ID, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
+ layout.addView(DETAILS_VIEW, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
- folderAdditional = layout.createPlaceholderFolder(ADDITIONAL, IPageLayout.BOTTOM, 0.6f, TaxonNavigator.ID);
+ layout.addView(FACTUAL_DATA_VIEW, IPageLayout.BOTTOM, 0.6f, NAVIGATOR);
- folderAdditional.addPlaceholder(CdmDataSourceViewPart.ID);
- folderAdditional.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.perspective;
import org.eclipse.ui.IPageLayout;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
+import eu.etaxonomy.taxeditor.navigation.AppModelId;
/**
* @author n.hoffmann
*/
@Override
public void createInitialLayout(IPageLayout layout) {
- layout.addView(PolytomousKeyViewPart.ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
+ layout.addView(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYVIEWPARTE4, IPageLayout.LEFT, 0.25f, layout.getEditorArea());
+
+ layout.addView(DETAILS_VIEW, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
+
+ layout.addView(SUPPLEMENTAL_VIEW, IPageLayout.BOTTOM, 0.6f, DETAILS_VIEW);
- layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea());
-
- layout.addView(SupplementalDataViewPart.ID, IPageLayout.BOTTOM, 0.25f, DetailsViewPart.ID);
-
createAdditionalFolder(layout, layout.getEditorArea());
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.navigation.search.SearchResultView;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
+import eu.etaxonomy.taxeditor.navigation.search.SearchBar;
/**
* @author n.hoffmann
*/
public class Taxonomic extends Default {
- /* (non-Javadoc)
- * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
- */
- @Override
+ @Override
public void createInitialLayout(IPageLayout layout) {
- IFolderLayout navigationFolder = layout.createFolder("navigation", IPageLayout.LEFT, 0.25f, layout.getEditorArea());
-
- navigationFolder.addView(TaxonNavigator.ID);
- navigationFolder.addPlaceholder(SearchResultView.ID + ":*");
-
- layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea());
- layout.addView(SupplementalDataViewPart.ID, IPageLayout.BOTTOM, 0.25f, DetailsViewPart.ID);
-
- layout.addView(DescriptiveViewPart.ID, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea());
- layout.addView(MediaViewPart.ID, IPageLayout.RIGHT, 0.25f, DescriptiveViewPart.ID);
-
+ IFolderLayout navigationFolder = layout.createFolder(SearchBar.NAVIGATION_STACK_ID, IPageLayout.LEFT, 0.3f, layout.getEditorArea());
+
+ navigationFolder.addView(NAVIGATOR);
+ navigationFolder.addPlaceholder(SEARCH_RESULTS);
+
+ layout.addPlaceholder(NAME_EDITOR, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea());
+
+ layout.addView(DETAILS_VIEW, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
+ layout.addView(SUPPLEMENTAL_VIEW, IPageLayout.BOTTOM, 0.6f, DETAILS_VIEW);
+
+ layout.addView(FACTUAL_DATA_VIEW, IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
+
createAdditionalFolder(layout, layout.getEditorArea());
}
}
/**\r
- * \r
+ *\r
*/\r
package eu.etaxonomy.taxeditor.perspective;\r
\r
import org.eclipse.ui.IPageLayout;\r
-import eu.etaxonomy.taxeditor.editor.view.uses.UsesViewPart;\r
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;\r
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;\r
+\r
+import eu.etaxonomy.taxeditor.editor.AppModelId;\r
\r
/**\r
* Uses Class\r
- * @author a.theys \r
+ * @author a.theys\r
* @created mar 13, 2012\r
* @version 1.0\r
*/\r
/** {@inheritDoc} */\r
@Override\r
public void createInitialLayout(IPageLayout layout) {\r
- layout.addView(TaxonNavigator.ID, IPageLayout.LEFT, 0.25f, layout.getEditorArea());\r
- layout.addView(DetailsViewPart.ID, IPageLayout.RIGHT, 0.25f, layout.getEditorArea());\r
- layout.addView(UsesViewPart.ID, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea());\r
- \r
+ layout.addView(NAVIGATOR, IPageLayout.LEFT, 0.25f, layout.getEditorArea());\r
+ layout.addView(DETAILS_VIEW, IPageLayout.RIGHT, 0.25f, layout.getEditorArea());\r
+ layout.addView(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_USES, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea());\r
+\r
createAdditionalFolder(layout, layout.getEditorArea());\r
}\r
- \r
+\r
\r
}\r
\r
Bundle-ManifestVersion: 2
Bundle-Name: Bulkeditor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.bulkeditor;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.annotatedlineeditor,
eu.etaxonomy.taxeditor.annotatedlineeditor.handler,
eu.etaxonomy.taxeditor.bulkeditor,
eu.etaxonomy.taxeditor.bulkeditor.command,
+ eu.etaxonomy.taxeditor.bulkeditor.e4,
eu.etaxonomy.taxeditor.bulkeditor.handler,
eu.etaxonomy.taxeditor.bulkeditor.input,
eu.etaxonomy.taxeditor.bulkeditor.internal,
org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0.v20160229-1459",
org.eclipse.e4.ui.workbench,
org.eclipse.e4.core.di.annotations;bundle-version="1.5.0",
- org.eclipse.e4.ui.services
+ org.eclipse.e4.ui.services,
+ org.eclipse.e4.ui.di,
+ org.eclipse.e4.core.contexts
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: eu.etaxonomy.taxeditor.editor,
org.eclipse.core.runtime,
specification.label = Merge Candidate Annotation
specification.label.0 = Merge Target Annotation
command.name.10 = convert Person to Team
-command.label.OPEN_REFERENCING_OBJECTS_VIEW = Referencing Objects View
-command.name.OPEN_REFERENCING_OBJECTS_VIEW = Open Referencing Objects View
command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE = Open bulk editor for taxon node
viewCommandMapping.viewerName.REFERENCING_OBJECTS_VIEW = Referencing Objects View
viewCommandMapping.viewerName.BULK_EDITOR = Bulk Editor
handledmenuitem.label.1 = Users
handledmenuitem.label.2 = Groups
+
+command.commandname.1 = Open bulk editor for identifiable entity
+handledmenuitem.label.3 = Person and Teams
+handledmenuitem.label.4 = References
+handledmenuitem.label.5 = Names
+handledmenuitem.label.6 = Taxa
+handledmenuitem.label.7 = Media
+handledmenuitem.label.8 = Specimens and observations
specification.label = Kandidat-Annotation zusammenfügen
specification.label.0 = Ziel-Annotation zusammenfügen
command.name.10 = Person in Team umwandeln
-command.label.OPEN_REFERENCING_OBJECTS_VIEW = Referenzierende Objekte
-command.name.OPEN_REFERENCING_OBJECTS_VIEW = Öffne Referenzierende Objekte
command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE = Öffne Bulk Editor für Taxonknoten
viewCommandMapping.viewerName.REFERENCING_OBJECTS_VIEW = Referenzierende Objekte
viewCommandMapping.viewerName.BULK_EDITOR = Bulk Editor
handledmenuitem.label.1 = Nutzer
-handledmenuitem.label.2 = Nutzergruppen
\ No newline at end of file
+handledmenuitem.label.2 = Nutzergruppen
+
+command.commandname.1 = Öffne Bulkeditor für IdentifiableEntities
+handledmenuitem.label.3 = Personen und Teams
+handledmenuitem.label.4 = Referenzen
+handledmenuitem.label.5 = Namen
+handledmenuitem.label.6 = Taxa
+handledmenuitem.label.7 = Medien
+handledmenuitem.label.8 = Specimens und Beobachtungen
\ No newline at end of file
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_i8pkACAyEeeepOgM49meig">
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_HJWmwCAzEeeepOgM49meig" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_HJWmwCAzEeeepOgM49meig" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_Kc-ToCAzEeeepOgM49meig" elementId="taxeditor-bulkeditor.dynamicopenmenu" commandName="%command.name.1">
- <parameters xmi:id="_PWg1cCAzEeeepOgM49meig" elementId="taxeditor-bulkeditor.commandParameter.inputType" name="Bulk Editor Class" optional="false"/>
+ <parameters xmi:id="_PWg1cCAzEeeepOgM49meig" elementId="taxeditor-bulkeditor.commandParameter.inputType" name="Bulk Editor Input Type Parameter" optional="false"/>
</elements>
+ <elements xsi:type="commands:Command" xmi:id="_W1ggUJMjEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForTaxonNode" commandName="%command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE"/>
+ <elements xsi:type="commands:Command" xmi:id="_GAm9cJcNEeeM745tzuPNCQ" elementId="bulkeditor.commands.setmergetarget" commandName="%command.label.0"/>
+ <elements xsi:type="commands:Command" xmi:id="_Kkf_YJcNEeeM745tzuPNCQ" elementId="bulkeditor.commands.setmergecandidate" commandName="%command.label.1"/>
+ <elements xsi:type="commands:Command" xmi:id="_MNLNYJcNEeeM745tzuPNCQ" elementId="bulkeditor.commands.removemergecandidate" commandName="%command.label.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_N1zYEJcNEeeM745tzuPNCQ" elementId="bulkeditor.commands.mergegroup" commandName="%command.label.3"/>
+ <elements xsi:type="commands:Command" xmi:id="_PtZy4JcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person" commandName="%command.label.5"/>
+ <elements xsi:type="commands:Command" xmi:id="_RFEJYJcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team" commandName="%command.label.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_S8xR4JcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.delete" commandName="%command.label.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_jWkVYJcOEeeM745tzuPNCQ" elementId="taxeditor-bulkeditor.dynamicnewobjectcommand" commandName="%command.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_tLGKgJcOEeeM745tzuPNCQ" elementId="taxeditor-bulkeditor.dynamicdeleteobjectcommand" commandName="%command.name.3"/>
+ <elements xsi:type="commands:Command" xmi:id="_Svo9oKK6EeeZb4PEjoRsuw" elementId="taxeditor-bulkeditor.command.setMarkerFlag" commandName="%command.name.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_hh5p4K9kEeejfdQ69MxTUA" elementId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity" commandName="%command.commandname.1"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_l_8NMCQUEeelPNxAg-e3TA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.admin">
<elements xsi:type="menu:MenuSeparator" xmi:id="_zph3kDF2Eee-JvlKXQGppA" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.0"/>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_pgPrMCQUEeelPNxAg-e3TA" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_users" label="%handledmenuitem.label.1" command="_Kc-ToCAzEeeepOgM49meig">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_pgPrMCQUEeelPNxAg-e3TA" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_users" label="%handledmenuitem.label.1" tooltip="%handledmenuitem.label.1" command="_Kc-ToCAzEeeepOgM49meig">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_4YPk8CQ6EeeKsvEah5BAoQ" coreExpressionId="hasROLE_PROJECT_MANAGER_AND_isCdmStoreConnected"/>
<parameters xmi:id="_7uF7sCQUEeelPNxAg-e3TA" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.userBulk.userParam" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.user"/>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_pNpDACQ6EeeKsvEah5BAoQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_groups" label="%handledmenuitem.label.2" command="_Kc-ToCAzEeeepOgM49meig">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_pNpDACQ6EeeKsvEah5BAoQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_groups" label="%handledmenuitem.label.2" tooltip="%handledmenuitem.label.2" command="_Kc-ToCAzEeeepOgM49meig">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_6CFQkCQ6EeeKsvEah5BAoQ" coreExpressionId="hasROLE_PROJECT_MANAGER_AND_isCdmStoreConnected"/>
<parameters xmi:id="_pNpDASQ6EeeKsvEah5BAoQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.admin.groupBulk.groupParam" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.group"/>
</elements>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_gHUPICkFEeeCvszP-_feIA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="first">
<elements xsi:type="menu:Menu" xmi:id="_jpxCMCkFEeeCvszP-_feIA" elementId="bulkeditor.menus.openmenu" label="%menu.label" mnemonics="">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_nae6wCkFEeeCvszP-_feIA" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_9kzlsJRiEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.personandteams" label="%handledmenuitem.label.3" tooltip="%handledmenuitem.label.3" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_-wbrUJRiEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.author" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.author"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1PyzcKLEEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.references" label="%handledmenuitem.label.4" tooltip="%handledmenuitem.label.4" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_1PyzcaLEEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.reference" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.reference"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_PWEYwKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.5"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_QHXS0KLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.names" label="%handledmenuitem.label.5" tooltip="%handledmenuitem.label.5" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_QHXS0aLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.names" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.name"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_VBLhcKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.taxa" label="%handledmenuitem.label.6" tooltip="%handledmenuitem.label.6" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_VBLhcaLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.taxa" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.taxon"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_gKR80KLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.6"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_hp8_0KLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.media" label="%handledmenuitem.label.7" tooltip="%handledmenuitem.label.7" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_hp8_0aLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.media" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.media"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_liWNsKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.7"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_ob4moKLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.specimen" label="%handledmenuitem.label.8" tooltip="%handledmenuitem.label.8" command="_Kc-ToCAzEeeepOgM49meig">
+ <parameters xmi:id="_ob4moaLFEeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.input.occurrence" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.occurrence"/>
+ </children>
</elements>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_yOo1YIKgEee80qfpLNk7uw" featurename="descriptors" parentElementId="xpath:/">
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_BRphkIKhEee80qfpLNk7uw" elementId="eu.etaxonomy.taxeditor.bulkeditor.dynamicmenucontribution.referencing.openIn" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
</menus>
</elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_Mu8jsJRaEeeDJ72ZvUwCLA" elementId="bulkeditor.editor" label="%editor.name" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4">
+ <tags>nonRestore</tags>
+ <handlers xmi:id="_VdeUEJcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.ConvertPerson2TeamHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.ConvertPerson2TeamHandlerE4" command="_RFEJYJcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_y_IbIJcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.ConvertTeam2PersonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.ConvertTeam2PersonHandlerE4" command="_PtZy4JcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="__zp2gJcNEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.DeleteHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.DeleteHandlerE4" command="_S8xR4JcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_MEYoUJcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.MergeGroupHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.MergeGroupHandlerE4" command="_N1zYEJcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_Q5hLQJcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.RemoveMergeCandidateHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.RemoveMergeCandidateHandlerE4" command="_MNLNYJcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_We1N8JcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMergeCandidateHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMergeCandidateHandlerE4" command="_Kkf_YJcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_a-U4EJcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMergeTargetHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMergeTargetHandlerE4" command="_GAm9cJcNEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_qPOPQJcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.annotatedlineeditor.e4.handler.NewObjectHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.annotatedlineeditor.e4.handler.NewObjectHandlerE4" command="_jWkVYJcOEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_vskBsJcOEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.annotatedlineeditor.e4.handler.DeleteObjectHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.annotatedlineeditor.e4.handler.DeleteObjectHandlerE4" command="_tLGKgJcOEeeM745tzuPNCQ"/>
+ <handlers xmi:id="_c9ppwKK6EeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMarkerFlagHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.SetMarkerFlagHandlerE4" command="_Svo9oKK6EeeZb4PEjoRsuw"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_B6IFsJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.popupmenu.bulkeditor">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_H83EMJcMEeeM745tzuPNCQ" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_Y49vAJfHEeeUB5KN7hGpYQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicNewObjectMenuE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicNewObjectMenuE4"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_LvKuoKz5EeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.afterNew"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_3V-TQKK4EeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.dynamicmenucontribution.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_VhML4JcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.1"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_WOzf0JcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.setMergeTarget" label="%command.label.0" command="_GAm9cJcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_c0pycJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.setMergeCandidate" label="%command.label.1" command="_Kkf_YJcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_gx65QJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.removemergecandidate" label="%command.label.2" command="_MNLNYJcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_i2FJYJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.mergegroup" label="%command.label.3" command="_N1zYEJcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_lFRk0JcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.2"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_l6dgYJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.convertTeam2Person" label="%command.label.5" command="_PtZy4JcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_oKqBYJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.convertPerson2Team" label="%command.label.6" command="_RFEJYJcNEeeM745tzuPNCQ"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_p-7bYJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.3"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_MughoKK6EeeZb4PEjoRsuw" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicMarkerTypeEditingMenuE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicMarkerTypeEditingMenuE4"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_x3rgUJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.4"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_yt2TUJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.handledmenuitem.delete" label="%command.label.4" command="_S8xR4JcNEeeM745tzuPNCQ"/>
+ </menus>
+ </elements>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_NE4fEIKhEee80qfpLNk7uw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.store.menuseparator.afterSupplemental">
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_NE4fEYKhEee80qfpLNk7uw" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.referencingobjects" label="%view.name" iconURI="">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_NE4fEIKhEee80qfpLNk7uw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.editing">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_NE4fEYKhEee80qfpLNk7uw" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.referencingobjects" label="%view.name" iconURI="" tooltip="%view.name">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_2ldaQIZGEee-VvuRyq44pQ" coreExpressionId="isCdmStoreConnected"/>
<command href="../eu.etaxonomy.taxeditor.store/fragment.e4xmi#_bnVKsCZxEeeQLpuomSmVoQ"/>
<parameters xmi:id="_NE4fE4KhEee80qfpLNk7uw" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.e4.ReferencingObjectsViewE4"/>
</elements>
- <elements xsi:type="menu:MenuSeparator" xmi:id="_qTYT4J7MEee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menuseparator.1"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Z75CcJMjEeeR4YRjNqCKeA" featurename="handlers" parentElementId="xpath:/">
+ <elements xsi:type="commands:Handler" xmi:id="_b9rUAJMjEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForTaxonNodeHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForTaxonNodeHandler" command="_W1ggUJMjEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_HKAv8JRkEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.bulkeditor.e4.handler.OpenBulkEditorHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.e4.handler.OpenBulkEditorHandlerE4" command="_Kc-ToCAzEeeepOgM49meig"/>
+ <elements xsi:type="commands:Handler" xmi:id="_gBvyILVsEeelkfEvQajThw" elementId="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4" command="_hh5p4K9kEeejfdQ69MxTUA"/>
</fragments>
</fragment:ModelFragments>
</run>
</application>
</extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"
- default="false"
- id="bulkeditor.editor"
- name="%editor.name">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"
- default="false"
- id="nameeditor.editor"
- name="%editor.name.0">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
- name="%editor.name.1">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:bulkeditor.menus.openmenu">
- <dynamic
- class="eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem"
- id="taxeditor-bulkeditor.dynamicopenmenu">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </dynamic>
- </menuContribution>
- <menuContribution
- locationURI="popup:bulkeditor.editor">
- <menu
- label="%menu.label.1">
- <dynamic
- class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"
- id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">
- <visibleWhen
- checkEnabled="false">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </dynamic>
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </menu>
- <separator
- name="taxeditor-bulkeditor.separator4"
- visible="true">
- </separator>
- <command
- commandId="bulkeditor.commands.setmergetarget"
- label="%command.label.0"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isMergeEnabled">
- </reference>
- </visibleWhen>
- </command>
-
- <command
- commandId="bulkeditor.commands.setmergecandidate"
- label="%command.label.1"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isMergeEnabled">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="bulkeditor.commands.removemergecandidate"
- label="%command.label.2"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isMergeEnabled">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="bulkeditor.commands.mergegroup"
- label="%command.label.3"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isMergeEnabled">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.bulkeditor.separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
- label="%command.label.5"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isConvertEnabled">
- </reference>
- <reference
- definitionId="isTeam">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
- label="%command.label.6"
- style="push">
- <visibleWhen
- checkEnabled="true">>
- <and>
- <reference
- definitionId="isConvertEnabled">
- </reference>
- <reference
- definitionId="isPerson">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-bulkeditor.separator2"
- visible="true">
- </separator>
- <menu
- label="%menu.label.2">
- <dynamic
- class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"
- id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">
- </dynamic>
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </menu>
- <separator
- name="taxeditor-bulkeditor.separator3"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"
- label="%command.label.4"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.bulkeditor.cdmViewerContextMenu">
- </dynamic>
- <!--menuContribution
- locationURI="popup:org.eclipse.ui.popup.any"-->
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler"
- id="bulkeditor.commands.mergegroup"
- name="%command.name">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeTargetHandler"
- id="bulkeditor.commands.setmergetarget"
- name="%command.name.0">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.OpenBulkEditorHandler"
- id="taxeditor-bulkeditor.dynamicopenmenu"
- name="%command.name.1">
- <commandParameter
- id="taxeditor-bulkeditor.commandParameter.inputType"
- name="Bulk Editor Class"
- values="eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues">
- </commandParameter>
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.NewObjectHandler"
- id="taxeditor-bulkeditor.dynamicnewobjectcommand"
- name="%command.name.2">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.DeleteObjectHandler"
- id="taxeditor-bulkeditor.dynamicdeleteobjectcommand"
- name="%command.name.3">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeCandidateHandler"
- id="bulkeditor.commands.setmergecandidate"
- name="%command.name.4">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.RemoveMergeCandidateHandler"
- id="bulkeditor.commands.removemergecandidate"
- name="%command.name.5">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"
- id="taxeditor-bulkeditor.command.setMarkerFlag"
- name="%command.name.6">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.bulkeditor.delete"
- name="%command.name.7">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
- name="%command.name.8">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
- name="%command.name.10">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.openReferencingObjectsView"
- name="%command.name.OPEN_REFERENCING_OBJECTS_VIEW">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForTaxonNodeHandler"
- id="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForTaxonNode"
- name="%command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"
- name="Open bulk editor for identifiable entity">
- <commandParameter
- id="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity.uuid"
- name="Identifiable Entity UUID"
- optional="true"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
- id="eu.etaxonomy.taxeditor.openReferencingObjectsViewFromMenu"
- name="%command.name.OPEN_REFERENCING_OBJECTS_VIEW">
- </command>
- <!--command
- defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"
- id="eu.etaxonomy.taxeditor.bulkeditor.command.new"
- name="New Entity">
- </command-->
- </extension>
- <extension
- point="org.eclipse.ui.editors.markerAnnotationSpecification">
- <specification
- annotationType="merge_candidate_annotation"
- colorPreferenceKey="merge_candidate_annotation_color"
- colorPreferenceValue="220,220,255"
- highlightPreferenceValue="true"
- icon="icons/merge_candidate.gif"
- includeOnPreferencePage="true"
- label="%specification.label"
- overviewRulerPreferenceKey="merge_candidate_annotation_overview"
- overviewRulerPreferenceValue="true"
- presentationLayer="0"
- symbolicIcon="task"
- textPreferenceKey="merge_candidate_annotation_text"
- textPreferenceValue="false"
- textStylePreferenceValue="BOX"
- verticalRulerPreferenceKey="merge_candidate_annotation_vertical"
- verticalRulerPreferenceValue="true">
- </specification>
- <specification
- annotationType="merge_target_annotation"
- colorPreferenceKey="merge_target_annotation_color"
- colorPreferenceValue="220,220,255"
- highlightPreferenceValue="true"
- icon="icons/merge_target.gif"
- includeOnPreferencePage="true"
- label="%specification.label.0"
- overviewRulerPreferenceKey="merge_target_annotation_overview"
- overviewRulerPreferenceValue="true"
- presentationLayer="1"
- symbolicIcon="task"
- textPreferenceKey="merge_target_annotation_text"
- textPreferenceValue="false"
- textStylePreferenceValue="BOX"
- verticalRulerPreferenceKey="merge_target_annotation_vertical"
- verticalRulerPreferenceValue="true">
- </specification>
- </extension>
- <extension
- point="org.eclipse.ui.editors.annotationTypes">
- <type
- name="merge_candidate_annotation">
- </type>
- <type
- name="merge_target_annotation">
- </type>
- </extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"
- commandId="org.eclipse.ui.edit.cut">
- <activeWhen>
- <with
- variable="activeFocusControlId">
- <equals
- value="bulkeditor.textControlId">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"
- commandId="org.eclipse.ui.edit.copy">
- <activeWhen>
- <with
- variable="activeFocusControlId">
- <equals
- value="bulkeditor.textControlId">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"
- commandId="org.eclipse.ui.edit.paste">
- <activeWhen>
- <with
- variable="activeFocusControlId">
- <equals
- value="bulkeditor.textControlId">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"
- commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">
- <activeWhen>
- <with
- variable="selection">
- <instanceof
- value="eu.etaxonomy.taxeditor.model.LineSelection">
- </instanceof>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler"
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamRemotingHandler"
- commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity"
- commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity">
- <activeWhen>
- <and>
- <reference
- definitionId="isBulkEditorSupported">
- </reference>
- <not>
- <with
- variable="activePartId">
- <equals
- value="bulkeditor.editor">
- </equals>
- </with>
- </not>
- </and>
- </activeWhen>
- </handler>
-
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
- class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"
- id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"
- name="%page.name">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"
- id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
- name="%page.name.0">
- </page>
- </extension>
<extension
point="eu.etaxonomy.taxeditor.store.cdmViewer">
<viewCommandMapping
uri="fragment.e4xmi">
</fragment>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+ class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"
+ name="%page.name">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+ name="%page.name.0">
+ </page>
+ </extension>
<!-- start set marker -->
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.eclipse.ui.texteditor.AbstractDocumentProvider;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
* @param entity a {@link java.lang.Object} object.
* @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
*/
- protected LineAnnotation createAnnotatedLine(Object element, Object entity) throws BadLocationException {
+ public LineAnnotation createAnnotatedLine(Object element, Object entity) throws BadLocationException {
Document document = (Document) getDocument(element);
ILineDisplayStrategy lineDisplayStrategy = getLineDisplayStrategy(element);
if (!this.conversation.isBound()){
this.conversation.bind();
}
-
+
while (iterator.hasNext()) {
Annotation annotation = (Annotation) iterator.next();
if (annotation instanceof IEntityContainer<?>) {
IEntityContainer<?> container = (IEntityContainer<?>) annotation;
-
+
if (container.isMarkedAsNew() || container.isDirty()) {
-
+
Object entity = persistenceService.save(container.getEntity()); // save
container.setEntity(entity);
container.setDirty(false);
}
if (annotation.isMarkedAsMerged()) {
persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); // merge
- }
+ }
if (annotation.isMarkedAsDeleted()) {
try {
persistenceService.delete(annotation.getEntity(), annotation.getDeleteConfigurator());
e.printStackTrace();
} // merge
}
-
+
else {
// TODO clarify w AM whether this needs to be executed on merged objects
//persistenceService.delete(annotation.getEntity()); // delete
Object entity = annotation.getEntity();
//annotation.markAsDeleted(configurator);
model.removeAnnotation(annotation);
-
+
// Immediately followed by a delimiter?
int annotationEnd = offset + length;
try {
}
try {
-
+
document.replace(offset, length, "");
-
+
} catch (BadLocationException e) {
MessagingUtils.error(getClass(), "Problems removing annotated line", e);
}
updateLineFromAnnotation(annotation);
}
}
-
-
+
+
}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.annotatedlineeditor.e4;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineDocumentProvider;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineSelectionViewer;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * A list-based editor, where each line in the editor's document is associated with a domain object.
+ * <p>
+ * Extending classes must set:
+ * <ul>
+ * <li>an {@link IEntityPersistenceService} for interacting with the persistence layer; and
+ * <li>an {@link ILineDisplayStrategy} for various visual manifestations of the domain object.
+ * </ul>
+ *
+ * @author p.ciardelli
+ * @created 25.06.2009
+ * @version 1.0
+ */
+public class AnnotatedLineEditorE4 extends TextEditor implements IConversationEnabled, IPostOperationEnabled {
+
+ protected ConversationHolder conversation;
+
+ private IEntityPersistenceService persistenceService;
+ protected ILineDisplayStrategy lineDisplayStrategy;
+
+
+ /**
+ * <p>Constructor for AnnotatedLineEditor.</p>
+ *
+ * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ public AnnotatedLineEditorE4(ConversationHolder conversation) {
+ this.conversation = conversation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#doSetInput(org.eclipse.ui.IEditorInput)
+ */
+ /** {@inheritDoc} */
+ @Override
+ protected void doSetInput(IEditorInput input) throws CoreException {
+
+ AnnotatedLineDocumentProvider provider = new AnnotatedLineDocumentProvider(input);
+
+ provider.setLineDisplayStrategy(lineDisplayStrategy, input);
+ setDocumentProvider(provider);
+
+ super.doSetInput(input);
+ }
+
+ /**
+ * <p>Setter for the field <code>persistenceService</code>.</p>
+ *
+ * @param persistenceService a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
+ */
+ protected void setPersistenceService(
+ IEntityPersistenceService persistenceService) {
+ this.persistenceService = persistenceService;
+ }
+
+ /**
+ * <p>Getter for the field <code>persistenceService</code>.</p>
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService} object.
+ */
+ protected IEntityPersistenceService getPersistenceService() {
+ return persistenceService;
+ }
+
+ /**
+ * <p>Setter for the field <code>lineDisplayStrategy</code>.</p>
+ *
+ * @param lineDisplayStrategy a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy} object.
+ */
+ protected void setLineDisplayStrategy(
+ ILineDisplayStrategy lineDisplayStrategy) {
+ this.lineDisplayStrategy = lineDisplayStrategy;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected ISourceViewer createSourceViewer(Composite parent,
+ IVerticalRuler ruler, int styles) {
+
+ fAnnotationAccess= getAnnotationAccess();
+ fOverviewRuler= createOverviewRuler(getSharedColors());
+ LineSelectionViewer viewer = new LineSelectionViewer(parent, ruler, getOverviewRuler(),
+ isOverviewRulerVisible(), styles);
+ // isOverviewRulerVisible(), styles | SWT.WRAP);
+ getSourceViewerDecorationSupport(viewer);
+
+ return viewer;
+ }
+
+ /**
+ * Create an annotated line with an "empty" entity, i.e. using the editor
+ * input's default entity type and a zero-length title cache.
+ *
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLineNewObject() {
+
+ // Create new object
+
+ AnnotatedLineDocumentProvider documentProvider = (AnnotatedLineDocumentProvider) getDocumentProvider();
+ IEntityCreator entityCreator = documentProvider.getEntityCreator(getEditorInput());
+ Object entity = entityCreator.createEntity(null);
+
+ LineAnnotation annotation = createAnnotatedLine(entity);
+ if (annotation != null) {
+ annotation.markAsNew(true);
+ }
+ return annotation;
+ }
+
+ /**
+ * Create an annotated line, first creating an entity of type "key" - this key
+ * must be recognized by the editor's entity creator.
+ *
+ * @param key a {@link java.lang.Object} object.
+ * @param titleCache a {@link java.lang.String} object.
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLineNewObject(Object key, String titleCache) {
+
+
+
+ // Create new object
+ Object entity = ((AnnotatedLineDocumentProvider) getDocumentProvider()).
+ getEntityCreator(getEditorInput()).createEntity(key, titleCache);
+ // checks if the creator also saves the entity (in a different conversation), in which case
+ // we need to bind back this editors conversation
+ // we also need to reload the entity because the conversation used to
+ // to create / save the entity may have been closed
+ if(entity != null && ((AnnotatedLineDocumentProvider) getDocumentProvider()).getEntityCreator(getEditorInput()).savesEntity()) {
+ getConversationHolder().bind();
+ //FIXME: why do we use IOccurrenceService here? is this generic?
+ //because this method is only invoked by the handler which is used in the
+ //specimen bulk editor. This is unsafe and should be refactored!
+ Object object = CdmStore.getService(IOccurrenceService.class).load(((CdmBase)entity).getUuid());
+ entity = HibernateProxyHelper.deproxy(object);
+ }
+
+ if(entity == null) {
+ return null;
+ }
+ LineAnnotation annotation = createAnnotatedLine(entity);
+ if (annotation != null) {
+ annotation.markAsNew(true);
+ }
+
+ return annotation;
+
+ }
+
+ @Override
+ public boolean isDirty() {
+ return super.isDirty();
+ }
+
+ /**
+ * Creates an annotated line at the end of the document. The annotation contains the entity.
+ *
+ * @param entity a {@link java.lang.Object} object.
+ * @return a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public LineAnnotation createAnnotatedLine(Object entity) {
+
+ IEditorInput input = getEditorInput();
+ this.conversation.close();
+ this.conversation = ((AbstractBulkEditorInput)input).getConversation();
+ AnnotatedLineDocumentProvider provider = (AnnotatedLineDocumentProvider) getDocumentProvider();
+
+ LineAnnotation annotation = null;
+ try {
+ annotation = provider.createAnnotatedLine(input, entity);
+
+ // Jump to new line
+ IAnnotationModel model = provider.getAnnotationModel(input);
+ if(model != null){
+ int start= model.getPosition(annotation).getOffset();
+ selectAndReveal(start, 0);
+ }
+
+ } catch (BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return annotation;
+ }
+
+ /**
+ * <p>removeAnnotatedLine</p>
+ *
+ * @param lineno a int.
+ */
+ public void removeAnnotatedLine(int lineno) {
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(lineno);
+ }
+
+ /**
+ * <p>removeAnnotatedLine</p>
+ *
+ * @param annotation a {@link eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation} object.
+ */
+ public void removeAnnotatedLine(LineAnnotation annotation) {
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).removeAnnotatedLine(annotation);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ if (getConversationHolder() != null) {
+ if( ! getConversationHolder().isBound()){
+ getConversationHolder().bind();
+ }
+ super.doSave(progressMonitor);
+ getConversationHolder().commit(true);
+ } else {
+ super.doSave(progressMonitor);
+ }
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.texteditor.AbstractTextEditor#setFocus()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void setFocus() {
+ super.setFocus();
+ if (getConversationHolder() != null) {
+ getConversationHolder().bind();
+ }
+ ((AbstractBulkEditorInput)getEditorInput()).bind();
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
+ // TODO pass focus to underlying widgets
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {}
+
+ /**
+ * Refreshes text in all lines.
+ */
+ protected void refreshLineDisplay() {
+ IDocumentProvider provider = getDocumentProvider();
+ IEditorInput input = getEditorInput();
+ IAnnotationModel model = provider.getAnnotationModel(input);
+ Iterator iter = getDocumentProvider().getAnnotationModel(getEditorInput()).getAnnotationIterator();
+ while (iter.hasNext()) {
+ Object next = iter.next();
+ if (next instanceof LineAnnotation) {
+ LineAnnotation annotation = (LineAnnotation) next;
+ ((AnnotatedLineDocumentProvider) getDocumentProvider()).
+ updateLineFromAnnotation(annotation);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ refreshLineDisplay();
+
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.editors.text.TextEditor#dispose()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void dispose() {
+ super.dispose();
+ conversation.close();
+ ((AbstractBulkEditorInput)getEditorInput()).dispose();
+ }
+
+ /**
+ * <p>onComplete</p>
+ *
+ * @return a boolean.
+ */
+ @Override
+ public boolean onComplete() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.annotatedlineeditor.e4.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
+
+/**
+ * <p>DeleteObjectHandler class.</p>
+ *
+ * @author p.ciardelli
+ * @created 25.06.2009
+ * @version 1.0
+ */
+public class DeleteObjectHandlerE4 extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+
+ if (editor instanceof AnnotatedLineEditor) {
+
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof TextSelection) {
+
+ // Get current line
+ int line = ((TextSelection) selection).getStartLine();
+
+ ((AnnotatedLineEditor) editor).removeAnnotatedLine(line);
+ }
+ }
+ return null;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.annotatedlineeditor.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.GroupCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.UserCreator;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class NewObjectHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem) {
+
+ Object key = menuItem.getTransientData().get(IBulkEditorConstants.DYNAMIC_OPEN_OBJECT_ID+".key");
+
+ BulkEditorE4 bulkEditor = (BulkEditorE4) activePart.getObject();
+
+ if (key != null) {
+ String text = menuItem.getCommand().getCommandName();
+ //FIXME : This should probably go into some ValidatorFactory
+ IInputValidator nonEmptyInputValidator = null;
+ //FIXME : This is a workaround to not allow empty strings in the
+ // input dialog for User and Group entities.
+ // Normally this should be default
+ // behaviour, so we need to discuss whether this handler
+ // should be used to handle the creating new entities of
+ // type other than User and Group.
+ // Once #4348 is fixed this check can be removed.
+ if(text.equals(UserCreator.USER) || text.equals(GroupCreator.GROUP)) {
+ nonEmptyInputValidator = new IInputValidator() {
+ @Override
+ public String isValid(String text) {
+ if(text == null || text.isEmpty()) {
+ return "Input cannot be empty";
+ }
+ return null;
+ }
+ };
+ }
+ InputDialog dialog = new InputDialog(shell,
+ String.format("Create %s", text), String.format("Enter new %s", text), "",
+ nonEmptyInputValidator);
+
+ if (dialog.open() != Window.CANCEL) {
+ IEntityCreator entityCreator = bulkEditor.getEditorInput().getEntityCreator();
+ Object createdEntity = entityCreator.createEntity(key, dialog.getValue());
+ bulkEditor.getEditorInput().getModel().add(createdEntity);
+ bulkEditor.refresh(true);
+ bulkEditor.setDirty();
+ }
+ }
+ }
+}
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
- if (getEditorInput().isMergingEnabled()) {
- addToggleMergeCandidateListener(ruler.getControl());
- }
+// if (getEditorInput().isMergingEnabled()) {
+// addToggleMergeCandidateListener(ruler.getControl());
+// }
return viewer;
}
//conversation.clear();
//conversation.commit(true);
- getEditorInput().dispose();
- getEditorInput().bind();
- getEditorInput().performSearch(query);
+// getEditorInput().dispose();
+// getEditorInput().bind();
+// getEditorInput().performSearch(query);
refresh();
setInput(getEditorInput());
}
- /** {@inheritDoc} */
- @Override
- public AbstractBulkEditorInput getEditorInput() {
- return (AbstractBulkEditorInput) super.getEditorInput();
- }
+// /** {@inheritDoc} */
+// @Override
+// public AbstractBulkEditorInput getEditorInput() {
+// return (AbstractBulkEditorInput) super.getEditorInput();
+// }
@Override
protected void editorContextMenuAboutToShow(IMenuManager menu) {
package eu.etaxonomy.taxeditor.bulkeditor;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.common.Marker;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.annotatedlineeditor.EntityListener;
import eu.etaxonomy.taxeditor.annotatedlineeditor.ILineDisplayStrategy;
-import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
/**
* <p>BulkEditorLineDisplay class.</p>
/** {@inheritDoc} */
@Override
public String getText(Object entity) {
- return editor.getEditorInput().getText((ICdmBase) entity);
+ return "";//editor.getEditorInput().getText((CdmBase) entity);
}
/** {@inheritDoc} */
String supplementalText = "";
- AbstractBulkEditorInput input = editor.getEditorInput();
- String typeText = input.getTypeText(entity);
-
- supplementalText += StringUtils.isBlank(typeText) ? "" : String.format(" [%s]", typeText);
-
- if (entity instanceof IAnnotatableEntity) {
- IAnnotatableEntity annotatableEntity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(entity);
-
- String markerText = "";
- List<String> markers = new ArrayList<String>();
- for (Marker marker : annotatableEntity.getMarkers()) {
- String markerLabel = marker.getMarkerType() == null? " unknown marker " : marker.getMarkerType().getLabel();
- markers.add(String.format("%1s = %2s", markerLabel, marker.getFlag() ? "yes" : "no"));
- }
- if (! markers.isEmpty()) {
- markerText = StringUtils.join(markers, ", ");
- }
-
- supplementalText += StringUtils.isBlank(markerText) ? "" : String.format(" [%s]", markerText);
- }
+// AbstractBulkEditorInput input = editor.getEditorInput();
+// String typeText = input.getTypeText(entity);
+//
+// supplementalText += StringUtils.isBlank(typeText) ? "" : String.format(" [%s]", typeText);
+//
+// if (entity instanceof IAnnotatableEntity) {
+// IAnnotatableEntity annotatableEntity = (IAnnotatableEntity) HibernateProxyHelper.deproxy(entity);
+//
+// String markerText = "";
+// List<String> markers = new ArrayList<String>();
+// for (Marker marker : annotatableEntity.getMarkers()) {
+// String markerLabel = marker.getMarkerType() == null? " unknown marker " : marker.getMarkerType().getLabel();
+// markers.add(String.format("%1s = %2s", markerLabel, marker.getFlag() ? "yes" : "no"));
+// }
+// if (! markers.isEmpty()) {
+// markerText = StringUtils.join(markers, ", ");
+// }
+//
+// supplementalText += StringUtils.isBlank(markerText) ? "" : String.format(" [%s]", markerText);
+// }
return supplementalText;
}
}
private void createSortCombo(Composite parent, int style) {
- sortCombo = new BulkEditorSortCombo(parent, editor.getEditorInput().getSortProviders());
+// sortCombo = new BulkEditorSortCombo(parent, editor.getEditorInput().getSortProviders());
}
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
-import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* <p>BulkEditorUtil class.</p>
*/
public class BulkEditorUtil extends AbstractUtility{
- /**
- * Opens a new editor window with the given input
- *
- * @param input
- * @param editorId
- * @return
- * @throws PartInitException
- */
- private static IEditorPart open(IEditorInput input, String editorId)
- throws PartInitException {
- return getActivePage().openEditor(input, editorId);
- }
-
- /**
- * <p>openEmptyEditor</p>
- *
- * @param inputType a {@link eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues.BulkEditorInputType} object.
- * @throws org.eclipse.ui.PartInitException if any.
- */
- public static void openEmptyEditor(BulkEditorInputType inputType) throws PartInitException{
- AbstractBulkEditorInput editorInput = AbstractBulkEditorInput.NewInstance(inputType);
- open(editorInput, BulkEditor.ID);
- }
-
- /**
- * <p>openEditor</p>
- *
- * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
- * @throws org.eclipse.ui.PartInitException if any.
- */
- public static void openEditor(IdentifiableEntity entity) throws PartInitException{
- if(entity==null){
- MessagingUtils.errorDialog("Entity does not exist", BulkEditorUtil.class, "The entity does not exist in the data base. Maybe it has been deleted.", TaxeditorBulkeditorPlugin.PLUGIN_ID, null, false, false);
- return;
- }
- AbstractBulkEditorInput editorInput = AbstractBulkEditorInput.NewInstance(entity);
- open(editorInput, BulkEditor.ID);
- }
/**
* <p>getPluginId</p>
return TaxeditorBulkeditorPlugin.PLUGIN_ID;
}
+ public static void openBulkEditor(AbstractBulkEditorInput<?> input,
+ EModelService modelService, EPartService partService, MApplication application){
+ MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
+ bulkEditor.init(input);
+ }
+
/**
* <p>getUndoContext</p>
*
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.e4;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.e4.ui.di.Persist;
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class BulkEditorE4 implements IPartContentHasDetails, IConversationEnabled, IPostOperationEnabled,
+ IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData,
+ IPartContentHasSupplementalData, IPartContentHasMedia, IE4SavablePart {
+
+ @Inject
+ private MDirtyable dirty;
+
+ private AbstractBulkEditorInput<?> input;
+
+ private Composite topComposite;
+
+ private TableViewer viewer;
+
+ private ConversationHolder conversation;
+
+ @Inject
+ private ESelectionService selService;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ @Inject
+ private MPart thisPart;
+
+ @Inject
+ public BulkEditorE4() {
+ }
+
+ public void init(AbstractBulkEditorInput<?> input){
+ this.input = input;
+ AbstractBulkEditorInput<?> bulkEditorInput = input;
+ BulkEditorSearchE4 searchBar = new BulkEditorSearchE4(this, topComposite, SWT.NONE);
+ //layout needed because the search bar is added after @PostConstuct method
+ topComposite.getParent().layout();
+
+ thisPart.setLabel(input.getName());
+
+ //create columns
+ Table table = viewer.getTable();
+ String[] titles = {input.getName(), "Type"};
+ int[] bounds = {500, 100};
+
+ CellEditor[] editors = new CellEditor[titles.length];
+ for (int i = 0; i < titles.length; i++) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ editors[i] = new TextCellEditor(table);
+
+ column.getColumn().setText(titles[i]);
+ column.getColumn().setWidth(bounds[i]);
+ column.getColumn().setResizable(true);
+ column.getColumn().setMoveable(true);
+ }
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ viewer.setCellEditors(editors);
+ viewer.setColumnProperties(titles);
+
+ //content and label provider (NOTE: has to be set AFTER creating cell editors
+ viewer.setContentProvider(new ArrayContentProvider());
+ BulkEditorLabelProvider labelProvider = new BulkEditorLabelProvider(this);
+ viewer.setLabelProvider(labelProvider);
+
+
+ //allow text selection
+ viewer.setCellModifier(new ICellModifier() {
+ @Override
+ public void modify(Object element, String property, Object value) {
+ }
+ @Override
+ public Object getValue(Object element, String property) {
+ ITableLabelProvider tableLabelProvider = null;
+ if(viewer.getLabelProvider() instanceof ITableLabelProvider){
+ tableLabelProvider = (ITableLabelProvider) viewer.getLabelProvider();
+ }
+ Object[] columnProperties = viewer.getColumnProperties();
+ for (int i=0;i<columnProperties.length;i++) {
+ if(columnProperties[i].equals(property) && tableLabelProvider!=null){
+ return tableLabelProvider.getColumnText(element, i);
+ }
+ }
+ return "";
+ }
+ @Override
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ });
+
+ if(bulkEditorInput.getEntityUuid()!=null){
+ performSearch(new BulkEditorQuery(bulkEditorInput.getEntityUuid().toString(), null));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService) {
+ if (CdmStore.isActive()){
+ if(conversation == null){
+ conversation = CdmStore.createConversation();
+ }
+ }
+ else{
+ return;
+ }
+
+ parent.setLayout(new GridLayout());
+
+ topComposite = new Composite(parent, SWT.NONE);
+ topComposite.setLayout(new GridLayout());
+
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ topComposite.setLayoutData(gridData);
+
+ Composite bottomComposite = new Composite(parent, SWT.NONE);
+ bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ bottomComposite.setLayout(new FillLayout());
+ viewer = new TableViewer(bottomComposite, SWT.MULTI | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION);
+
+// createColumns(viewer);
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.bulkeditor.popupmenu.bulkeditor"); //$NON-NLS-1$
+
+ }
+
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor) {
+ save(monitor, true);
+ }
+
+ public void save(IProgressMonitor monitor, boolean resetMerge) {
+ input.saveModel(resetMerge);
+
+ // commit the conversation and start a new transaction immediately
+ conversation.commit(true);
+
+ Object object = viewer.getInput();
+ List<CdmBase> cdmBaseList = new ArrayList<>();;
+ if(object instanceof List){
+ for (Object item: (List)object) {
+ CdmBase cdmBase = (CdmBase) item;
+ cdmBaseList.add(cdmBase);
+ }
+ }
+ CdmStore.getService(cdmBaseList.get(0)).merge(cdmBaseList, true);
+ dirty.setDirty(false);
+ viewer.refresh();
+
+ }
+
+ /** {@inheritDoc} */
+ public void performSearch(BulkEditorQuery query) {
+ if (query != null) {
+
+ // TODO check if dirty, prompt save
+ if (isDirty()) {
+ String[] labels = {Messages.BulkEditorE4_SAVE_AND_SEARCH, Messages.BulkEditorE4_DONT_SAVE,Messages.BulkEditorE4_CANCEL};
+ MessageDialog dialog =new MessageDialog(topComposite.getShell(), Messages.BulkEditorE4_SAVE_CHANGES_TITLE, null, Messages.BulkEditorE4_SAVE_CHANGES_MESSAGE, MessageDialog.QUESTION,labels, 0);
+ int result = dialog.open();
+ if (result == 0) {
+ save(new NullProgressMonitor());
+ } else if (result == 2){
+ return;
+ }
+ }
+ dirty.setDirty(false);
+ getEditorInput().dispose();
+ getEditorInput().bind();
+ getEditorInput().performSearch(query);
+
+ viewer.setInput(getEditorInput().getModel());
+ refresh();
+ }
+ }
+
+ public void refresh() {
+ refresh(true);
+ }
+
+ public void refresh(boolean resetInput) {
+ if(resetInput){
+ viewer.setInput(getEditorInput().getModel());
+ }
+ viewer.refresh();
+ }
+
+ public TableViewer getViewer() {
+ return viewer;
+ }
+
+ public void setDirty(){
+ dirty.setDirty(true);
+ }
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ public AbstractBulkEditorInput getEditorInput() {
+ return input;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canAttachMedia() {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void changed(Object element) {
+ dirty.setDirty(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void forceDirty() {
+ dirty.setDirty(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+}
--- /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.bulkeditor.e4;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * @author pplitzner
+ * @date 11.09.2017
+ *
+ */
+public class BulkEditorLabelProvider extends LabelProvider implements ITableLabelProvider{
+
+ private BulkEditorE4 editor;
+
+ public BulkEditorLabelProvider(BulkEditorE4 editor) {
+ super();
+ this.editor = editor;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ AbstractBulkEditorInput input = editor.getEditorInput();
+
+ try {
+ if(input.getMergeCandidates().contains(element)){
+ IPath path = new Path("icons/merge_candidate.gif"); //$NON-NLS-1$
+ URL url = FileLocator.find(TaxeditorBulkeditorPlugin.getDefault().getBundle(), path, null);
+ return ImageResources.getImage(url.toURI());
+ }
+ else if(input.getMergeTarget()!=null && input.getMergeTarget().equals(element)){
+ IPath path = new Path("icons/merge_target.gif"); //$NON-NLS-1$
+ URL url = FileLocator.find(TaxeditorBulkeditorPlugin.getDefault().getBundle(), path, null);
+ return ImageResources.getImage(url.toURI());
+ }
+ } catch (URISyntaxException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ String text = null;
+
+ if (columnIndex == 0) {
+ if(element instanceof CdmBase){
+ text = editor.getEditorInput().getText((CdmBase) element);
+ }
+ }else if (columnIndex == 1) {
+ if(editor.getEditorInput().getTypeText(element)!=null){
+ text = editor.getEditorInput().getTypeText(element);
+ }
+ }
+ return text;
+ }
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.e4;
+
+import java.util.Comparator;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.swt.IFocusService;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorSortCombo;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.SearchManager;
+
+/**
+ * @author p.ciardelli
+ * @author e.-m.lee
+ * @author n.hoffmann
+ * @created 17.08.2009
+ * @version 1.0
+ */
+public class BulkEditorSearchE4 {
+
+ private static final String SEARCH = Messages.BulkEditorSearchE4_SEARCH;
+
+ private static final String DEFAULT_TEXT = String.format(Messages.BulkEditorSearchE4_WILDCARD, SearchManager.WILDCARD);
+
+ private final BulkEditorE4 editor;
+
+ private Text text;
+ private BulkEditorSortCombo sortCombo;
+
+ private Button button;
+
+
+ public Object ORDER_BY = new Object();
+
+ public BulkEditorSearchE4(BulkEditorE4 editor, Composite parent, int style) {
+ this.editor = editor;
+
+ createControl(parent, style);
+ }
+
+ /**
+ * Creates the search control.
+ */
+ protected void createControl(Composite parent, int style) {
+
+ final Composite container = new Composite(parent, style);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ container.setLayoutData(gridData);
+ container.setLayout(new GridLayout(5, false));
+
+ createSearchTextField(container, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
+
+ createSortCombo(container, style);
+
+ button = new Button(container, SWT.PUSH);
+ button.setText(SEARCH);
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateEditorInput();
+ }
+ });
+
+ registerAtFocusService();
+ }
+
+ private void createSortCombo(Composite parent, int style) {
+ sortCombo = new BulkEditorSortCombo(parent, editor.getEditorInput().getSortProviders());
+
+ }
+
+ /**
+ * Handles focus changes for the textfield.
+ */
+ private void registerAtFocusService() {
+ IFocusService focusService =
+ PlatformUI.getWorkbench().getService(IFocusService.class);
+ if (focusService != null) {
+ focusService.addFocusTracker(text, "bulkeditor.textControlId"); //$NON-NLS-1$
+ }
+ }
+
+
+ /**
+ * Creates the search textfield.
+ */
+ private void createSearchTextField(Composite parent, int style) {
+ final Label label = new Label(parent, SWT.NONE);
+ label.setText(Messages.BulkEditorSearchE4_TITLE_CACHE);
+
+ text = new Text(parent, style);
+ text.setText(DEFAULT_TEXT);
+ text.setForeground(BulkEditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
+
+ text.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ text.setForeground(BulkEditorUtil.getColor(Resources.SEARCH_VIEW_FOCUS));
+ if (DEFAULT_TEXT.equals(text.getText())) {
+ text.setText(""); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ if (CdmUtils.isEmpty(text.getText())) {
+ text.setForeground(BulkEditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
+ text.setText(DEFAULT_TEXT);
+ }
+ }
+ });
+
+ text.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.CR) {
+ updateEditorInput();
+ }
+ }
+ });
+
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ text.setLayoutData(gridData);
+ }
+
+
+ /**
+ * Shows the results of the search.
+ */
+ public void updateEditorInput() {
+
+ String searchString = getSearchString().trim();
+
+ if(DEFAULT_TEXT.equals(searchString) || CdmUtils.isBlank(searchString)){
+ return;
+ }
+
+ BulkEditorQuery query = new BulkEditorQuery(searchString, getComparator());
+ editor.performSearch(query);
+ }
+
+ /**
+ * Returns the current string in the search textfield.
+ * @return the content of the textfield
+ */
+ public String getSearchString() {
+ return text.getText().trim();
+ }
+
+ public Comparator getComparator() {
+ return sortCombo.getSelection();
+ }
+
+ public void setFocus() {
+ if(text != null && ! text.isDisposed()){
+ text.setFocus();
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.e4.command;
+
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.ui.di.AboutToShow;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
+import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @date 26.09.2017
+ *
+ */
+public class DynamicMarkerTypeEditingMenuE4 {
+
+ public static final String COMMAND_ID = "taxeditor-bulkeditor.command.setMarkerFlag"; //$NON-NLS-1$
+ public static final String COMMAND_PARAMETER_MARKER_TYPE = COMMAND_ID+".markerType"; //$NON-NLS-1$
+ public static final String COMMAND_PARAMETER_MARKER_STATE = COMMAND_ID+".markerState"; //$NON-NLS-1$
+
+ /** {@inheritDoc} */
+ @AboutToShow
+ public void aboutToShow(List<MMenuElement> items, @Named(IServiceConstants.ACTIVE_SELECTION)Object selection) {
+ if(selection==null){
+ return;
+ }
+ MMenu menu = MMenuFactory.INSTANCE.createMenu();
+ menu.setLabel(Messages.DynamicMarkerTypeEditingMenuE4_CHOOSE_MARKER_TYPE);
+ items.add(menu);
+ for(MarkerType markerType : CdmStore.getTermManager().getPreferredTerms(MarkerType.class)){
+ createMenuItem(menu, markerType);
+ }
+ }
+
+ private void createMenuItem(MMenu menu, final MarkerType markerType) {
+
+ MMenu subMenu = MMenuFactory.INSTANCE.createMenu();
+ subMenu.setLabel(String.format(Messages.DynamicMarkerTypeEditingMenuE4_SET_FLAG, markerType.getLabel()));
+ menu.getChildren().add(subMenu);
+
+ MHandledMenuItem subMenuItemYes = MMenuFactory.INSTANCE.createHandledMenuItem();
+ subMenuItemYes.setLabel(Messages.DynamicMarkerTypeEditingMenuE4_YES);
+ MCommand mCommandYes = MCommandsFactory.INSTANCE.createCommand();
+ mCommandYes.setElementId(COMMAND_ID);
+ //set params
+ subMenuItemYes.getTransientData().put(COMMAND_PARAMETER_MARKER_TYPE, markerType);
+ subMenuItemYes.getTransientData().put(COMMAND_PARAMETER_MARKER_STATE, true);
+ subMenuItemYes.setCommand(mCommandYes);
+ subMenu.getChildren().add(subMenuItemYes);
+
+ MHandledMenuItem subMenuItemNo = MMenuFactory.INSTANCE.createHandledMenuItem();
+ subMenuItemNo.setLabel(Messages.DynamicMarkerTypeEditingMenuE4_NO);
+ MCommand mCommandNo = MCommandsFactory.INSTANCE.createCommand();
+ mCommandNo.setElementId(COMMAND_ID);
+ //set params
+ subMenuItemNo.getTransientData().put(COMMAND_PARAMETER_MARKER_TYPE, markerType);
+ subMenuItemNo.getTransientData().put(COMMAND_PARAMETER_MARKER_STATE, false);
+ subMenuItemNo.setCommand(mCommandNo);
+ subMenu.getChildren().add(subMenuItemNo);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.e4.command;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.ui.di.AboutToShow;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
+import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class DynamicNewObjectMenuE4 {
+
+ private Map<? extends Object, String> classLabelPairs;
+ private BulkEditorE4 editor;
+
+ /** {@inheritDoc} */
+ @AboutToShow
+ public void aboutToShow(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ List<MMenuElement> items) {
+
+ editor = (BulkEditorE4) activePart.getObject();
+
+ classLabelPairs = getClassLabelPairs();
+
+ MMenu menu = MMenuFactory.INSTANCE.createMenu();
+ menu.setLabel(Messages.DynamicNewObjectMenuE4_NEW);
+ items.add(menu);
+
+ for(final Object key : classLabelPairs.keySet()){
+ createMenuItem(menu, key);
+ }
+ }
+
+ private void createMenuItem(MMenu menu, final Object key){
+ MHandledMenuItem menuItem = MMenuFactory.INSTANCE.createHandledMenuItem();
+ menuItem.setLabel(classLabelPairs.get(key));
+ MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+ mCommand.setElementId(IBulkEditorConstants.DYNAMIC_OPEN_OBJECT_ID);
+ mCommand.setCommandName(classLabelPairs.get(key));
+ //set params
+ menuItem.getTransientData().put(IBulkEditorConstants.DYNAMIC_OPEN_OBJECT_ID+".key", key); //$NON-NLS-1$
+
+ menuItem.setCommand(mCommand);
+ menu.getChildren().add(menuItem);
+
+ }
+
+ /**
+ * Get class label pairs from Annotated Line Editor's entity creator.
+ * @return
+ */
+ private Map<? extends Object, String> getClassLabelPairs() {
+ if (editor != null){
+ AbstractBulkEditorInput input = editor.getEditorInput();
+
+ IEntityCreator<?> entityCreator = input.getEntityCreator();
+ if(entityCreator!=null){
+ return entityCreator.getKeyLabelPairs();
+ }
+ }
+
+ return Collections.EMPTY_MAP;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.bulkeditor.e4.command;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.actions.CompoundContributionItem;
+
+import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
+
+/**
+ *
+ * @author p.ciardelli
+ * @created 19.08.2009
+ * @version 1.0
+ */
+public class OpenBulkEditorContributionItemE4 extends CompoundContributionItem {
+
+ public OpenBulkEditorContributionItemE4() {
+ }
+
+ public OpenBulkEditorContributionItemE4(String id) {
+ super(id);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected IContributionItem[] getContributionItems() {
+
+ List<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
+
+ contributionItems.add(BulkEditorInputType.AGENT.createContributionItem());
+ contributionItems.add(BulkEditorInputType.REFERENCE.createContributionItem());
+ String groupName = "test"; //$NON-NLS-1$
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.NAME.createContributionItem());
+ contributionItems.add(BulkEditorInputType.TAXON.createContributionItem());
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.MEDIA.createContributionItem());
+ contributionItems.add(new Separator(groupName));
+ contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem());
+ return contributionItems.toArray(new IContributionItem[contributionItems.size()]);
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2015 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.bulkeditor.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 12.05.2015
+ *
+ */
+public class ConvertPerson2TeamHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+
+ if (editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+ if (proceed) {
+ editor.save(new NullProgressMonitor());
+ } else {
+ return;
+ }
+ }
+
+ Team team =null;
+ UpdateResult result = null;
+ try {
+ result = CdmStore.getService(IAgentService.class).convertPerson2Team(selection.getUuid());
+ } catch (IllegalArgumentException e) {
+ MessagingUtils.errorDialog("Can not convert Person into a Team", null, e.getLocalizedMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID,e, true);
+ } catch (MergeException e) {
+ MessagingUtils.informationDialog("Convert not possible", "Person can not be transformed into team as it is already part of a team.");
+ }
+ if (result != null &&result.isOk()){
+ team = (Team)result.getCdmEntity();
+ }
+ if (team != null){
+ editor.refresh();
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = ((BulkEditorE4)activePart.getObject()).getEditorInput().isConvertingEnabled() && selection instanceof Person;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.bulkeditor.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+
+import eu.etaxonomy.cdm.api.service.IAgentService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.agent.Team;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 12.05.2015
+ *
+ */
+public class ConvertTeam2PersonHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+
+ if (editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+ if (proceed) {
+ editor.save(new NullProgressMonitor());
+ } else {
+ return;
+ }
+ }
+
+ Person person = null;
+ UpdateResult result = null;
+
+ try {
+ result = CdmStore.getService(IAgentService.class).convertTeam2Person(selection.getUuid());
+ } catch (IllegalArgumentException e) {
+ MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());
+ } catch (MergeException e) {
+ MessagingUtils.informationDialog("Can not convert Team to Person", e.getMessage());
+ }
+ if (result != null && result.isOk()){
+ person = (Person)result.getCdmEntity();
+ }
+ if (person != null){
+ editor.refresh();
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = ((BulkEditorE4)activePart.getObject()).getEditorInput().isConvertingEnabled() && selection instanceof Team;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.bulkeditor.e4.handler;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.api.service.DeleteResult;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.IReferenceService;
+import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
+import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
+
+
+/**
+ *
+ * @author pplitzner
+ * @date 11.09.2017
+ *
+ */
+public class DeleteHandlerE4 {
+
+ private static final String COULD_NOT_BE_DELETED = eu.etaxonomy.taxeditor.l10n.Messages.DeleteHandler_COULD_NOT_BE_DELETED;
+ private static final String AN_EXCEPTION_OCCURED = Messages.DeleteHandler_EXCEPTION;
+ private static final String DELETE_NOT_POSSIBLE = Messages.DeleteHandler_DELETE_NOT_POSSIBLE;
+ private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_S = Messages.DeleteHandler_REALLY_DELETE;
+ private static final String MEDIA = Messages.DeleteHandler_MEDIA;
+ private static final String TEAM_OR_PERSON = Messages.DeleteHandler_TEAM_OR_PERSON;
+ private static final String TAXON = Messages.DeleteHandler_TAXON;
+ private static final String SYNONYM = Messages.DeleteHandler_SYNONYM;
+ private static final String NAME = Messages.DeleteHandler_NAME;
+ private static final String USER = Messages.DeleteHandler_USER;
+ private static final String GROUP = Messages.DeleteHandler_GROUP;
+ private static final String REFERENCE = Messages.DeleteHandler_REFERENCE;
+ private static final String SPECIMEN_OR_OBSERVATION = Messages.DeleteHandler_SPECIMEN;
+ private static final String OBJECT = Messages.DeleteHandler_OBJECT;
+ private static final String SKIP = Messages.DeleteHandler_SKIP;
+ private static final String DELETE = eu.etaxonomy.taxeditor.l10n.Messages.DeleteHandler_DELETE;
+ private static final String CONFIRM_DELETION = Messages.DeleteHandler_CONFIRM;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase object,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ BulkEditorE4 editor= (BulkEditorE4) activePart.getObject();
+
+ DeleteConfiguratorBase config = null;
+ DeleteResult result = new DeleteResult();
+ String errorMessage= OBJECT;
+ if (editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+ if (proceed) {
+ editor.save(new NullProgressMonitor());
+ } else {
+ return ;
+ }
+ }
+ try {
+ ICdmRepository controller;
+ controller = CdmStore.getCurrentApplicationConfiguration();
+ if (object instanceof SpecimenOrObservationBase){
+ IOccurrenceService service = controller.getOccurrenceService();
+ config = new SpecimenDeleteConfigurator();
+
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config,
+ shell, CONFIRM_DELETION, null,
+ String.format(
+ DO_YOU_REALLY_WANT_TO_DELETE_THE_S+"\n"+Messages.DeleteHandler_IRREVERSIBLE,
+ SPECIMEN_OR_OBSERVATION),
+ MessageDialog.WARNING,
+ new String[] { DELETE, SKIP }, 0, true);
+ int result_dialog = dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+ result = service.isDeletable(((SpecimenOrObservationBase<?>) object).getUuid(), config);
+ errorMessage = SPECIMEN_OR_OBSERVATION;
+
+ } else if (object instanceof Reference){
+ IReferenceService service = controller.getReferenceService();
+ result = service.isDeletable(((Reference)object).getUuid(), null);
+ errorMessage = REFERENCE;
+
+ } else if (object instanceof Group){
+ errorMessage = GROUP;
+ }else if (object instanceof User){
+ errorMessage = USER;
+ } else if (object instanceof TaxonName){
+ TaxonName name = HibernateProxyHelper.deproxy(object, TaxonName.class);
+ config = new NameDeletionConfigurator();
+
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config,
+ shell, CONFIRM_DELETION, null,
+ String.format(
+ DO_YOU_REALLY_WANT_TO_DELETE_THE_S+"\n"+Messages.DeleteHandler_IRREVERSIBLE,
+ NAME),
+ MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
+ int result_dialog = dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+ result = controller.getNameService().isDeletable(name.getUuid(), config);
+ errorMessage = NAME;
+
+ } else if (object instanceof TaxonBase){
+
+ // synonym
+ if(object instanceof Synonym){
+ Synonym synonym = HibernateProxyHelper.deproxy(object, Synonym.class);
+ config = new SynonymDeletionConfigurator();
+ errorMessage = SYNONYM;
+ DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(config,
+ shell, CONFIRM_DELETION, null,
+ String.format(DO_YOU_REALLY_WANT_TO_DELETE_THE_S, SYNONYM),
+ MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
+ int result_dialog = dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+ result = controller.getTaxonService().isDeletable(synonym.getUuid(), config);
+
+ }
+ else if(object instanceof Taxon ){
+ Taxon taxon = HibernateProxyHelper.deproxy(object, Taxon.class);
+ if (((Taxon)object).getTaxonNodes().isEmpty()){
+ errorMessage = TAXON;
+ } else {
+ MessagingUtils.messageDialog(DELETE_NOT_POSSIBLE, getClass(),
+ Messages.DeleteHandler_TAXON_CAN_NOT_BE_DELETED,
+ null);
+ return;
+ }
+ config = new TaxonDeletionConfigurator();
+ ((TaxonDeletionConfigurator) config).setDeleteInAllClassifications(true);
+ DeleteConfiguratorDialog dialog;
+ dialog = new DeleteConfiguratorDialog(config, shell,
+ CONFIRM_DELETION, null,
+ String.format(DO_YOU_REALLY_WANT_TO_DELETE_THE_S, TAXON),
+ MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
+ int result_dialog = dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+ result = controller.getTaxonService().isDeletable(taxon.getUuid(), config);
+
+ }
+ } else if (object instanceof TeamOrPersonBase){
+ result = controller.getAgentService().isDeletable(object.getUuid(), null);
+ errorMessage = TEAM_OR_PERSON;
+ } else if (object instanceof Media){
+ config = new MediaDeletionConfigurator();
+
+ Media media = HibernateProxyHelper.deproxy(object, Media.class);
+ ((MediaDeletionConfigurator)config).setDeleteFrom(media);
+ DeleteConfiguratorDialog dialog;
+ dialog = new DeleteConfiguratorDialog(config, shell,
+ CONFIRM_DELETION, null,
+ String.format(DO_YOU_REALLY_WANT_TO_DELETE_THE_S, MEDIA),
+ MessageDialog.WARNING, new String[] { DELETE, SKIP }, 0, true);
+ int result_dialog = dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+
+ result = controller.getMediaService().isDeletable(media.getUuid(), config);
+ errorMessage = MEDIA;
+
+ }
+
+
+ } catch (Exception e){
+ MessagingUtils.errorDialog(AN_EXCEPTION_OCCURED+" "+DELETE_NOT_POSSIBLE, getClass(), e.getMessage(), TaxeditorBulkeditorPlugin.PLUGIN_ID, null, true); //$NON-NLS-1$
+ }
+ if (result.isError() || result.isAbort()){
+ //convert first letter to upper case
+ errorMessage = errorMessage.substring(0, 1).toUpperCase()+errorMessage.substring(1);
+ if (!result.getExceptions().isEmpty()) {
+ List<String> messages = new ArrayList<String>();
+ for (Exception e:result.getExceptions()){
+ messages.add(e.getMessage());
+ }
+ errorMessage += " " +COULD_NOT_BE_DELETED; //$NON-NLS-1$
+ //MessagingUtils.errorDialog("test", getClass(), "message", TaxeditorBulkeditorPlugin.PLUGIN_ID, result.getExceptions().iterator().next(),true);
+ DeleteResultMessagingUtils.messageDialogWithDetails(result,errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
+ }else{
+ MessagingUtils.messageDialog(DELETE_NOT_POSSIBLE, getClass(), errorMessage+" "+COULD_NOT_BE_DELETED+" "+AN_EXCEPTION_OCCURED, null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ if (result.isOk() ){
+ editor.getEditorInput().addToDelete(object, config);
+ editor.getEditorInput().getModel().remove(object);
+ editor.refresh(true);
+ editor.setDirty();
+
+ if(result.getUpdatedObjects().size() != 0 || !result.getExceptions().isEmpty()){
+ List<String> messages = new ArrayList<String>();
+ for (Exception e:result.getExceptions()){
+ messages.add(e.getMessage());
+ }
+ //convert first letter to upper case
+ errorMessage = errorMessage.substring(0, 1).toUpperCase()+errorMessage.substring(1);
+ errorMessage += eu.etaxonomy.taxeditor.l10n.Messages.DeleteHandler_CAN_BE_DELETED;
+ //MessagingUtils.errorDialog("test", getClass(), "message", TaxeditorBulkeditorPlugin.PLUGIN_ID, result.getExceptions().iterator().next(),true);
+ DeleteResultMessagingUtils.messageDialogWithDetails(result, errorMessage, TaxeditorBulkeditorPlugin.PLUGIN_ID);
+ }
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.bulkeditor.e4.handler;
+
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * Note: This merging is persisted only when saved. This handler only checks
+ * if merging is possible and removes only the list items but <b>not</b> the
+ * CDM entitites
+ * @author pplitzner
+ * @date 11.09.2017
+ *
+ */
+public class MergeGroupHandlerE4 {
+
+ @Execute
+ public void execute(
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ AbstractBulkEditorInput input = editor.getEditorInput();
+
+ if(editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ "Save changes", "You have made changes that must be saved before this query can be executed. Would you like to proceed?");
+ if (proceed) {
+ editor.save(new NullProgressMonitor(), false);
+ } else {
+ return ;
+ }
+ }
+
+ // Check whether there are any group annotations
+ List<CdmBase> mergeCandidates = input.getMergeCandidates();
+ if (mergeCandidates.size() == 0) {
+ MessageDialog.openWarning(shell,
+ "No merge candidates", "No objects have been chosen for merging.");
+ return;
+ }
+
+ // Check whether group merge target has been set
+ CdmBase mergeTarget = input.getMergeTarget();
+ if (mergeTarget == null) {
+ MessageDialog.openWarning(shell,
+ "No group merge target set", "No group merge target has been set.");
+ return;
+ }
+
+ TeamOrPersonBase teamOrPerson = null;
+ Reference ref = null;
+ if (mergeTarget instanceof TeamOrPersonBase){
+ teamOrPerson = HibernateProxyHelper.deproxy(mergeTarget, TeamOrPersonBase.class);
+ } else if(mergeTarget instanceof Reference){
+ ref = HibernateProxyHelper.deproxy(mergeTarget, Reference.class);
+ }
+ for (CdmBase item : mergeCandidates) {
+ //first check whether entities are mergeable
+ try{
+ if (ref != null){
+ Reference ref2 = HibernateProxyHelper.deproxy(item, Reference.class);
+
+ if (!CdmStore.getCommonService().isMergeable(ref, ref2, null)){
+ MessageDialog.openWarning(shell,
+ "No merge possible", "A merge of " + ref.getTitleCache() + " and " + ref2.getTitleCache() + " is not possible.");
+ return;
+ }
+ input.getModel().remove(item);
+ }
+ if (teamOrPerson != null){
+ TeamOrPersonBase teamOrPerson2 = HibernateProxyHelper.deproxy(item, TeamOrPersonBase.class);
+
+ if (!CdmStore.getCommonService().isMergeable(teamOrPerson, teamOrPerson2, null)){
+ MessageDialog.openWarning(shell,
+ "No merge possible", "A merge of " + teamOrPerson.getTitleCache() + " and " + teamOrPerson2.getTitleCache() + " is not possible.");
+ return;
+ }
+ input.getModel().remove(item);
+ }
+ }catch(MergeException e){
+
+ }
+ }
+ editor.setDirty();
+ editor.refresh();
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ canExecute = !editor.getEditorInput().getMergeCandidates().isEmpty()
+ && editor.getEditorInput().getMergeTarget()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.e4.handler;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class OpenBulkEditorHandlerE4 {
+
+ @Execute
+ public void execute(ParameterizedCommand command, EPartService partService, MApplication application, EModelService modelService) {
+ String inputTypeId = (String) command.getParameterMap().get(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID);
+ BulkEditorInputType inputType = BulkEditorInputType.getById(inputTypeId);
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(inputType);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class RemoveMergeCandidateHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ editor.getEditorInput().removeMergeCandidate(selection);
+ editor.refresh();
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ canExecute = editor.getEditorInput().isMergingEnabled()
+ && editor.getEditorInput().getMergeCandidates().contains(selection);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.bulkeditor.e4.handler;
+
+import java.util.Collections;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicMarkerTypeEditingMenuE4;
+import eu.etaxonomy.taxeditor.bulkeditor.operation.SetMarkerFlagOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @date 26.09.2017
+ *
+ */
+public class SetMarkerFlagHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)IAnnotatableEntity selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem, UISynchronize sync) {
+
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ MarkerType markerType = (MarkerType) menuItem.getTransientData().get(DynamicMarkerTypeEditingMenuE4.COMMAND_PARAMETER_MARKER_TYPE);
+ boolean markerState = (boolean) menuItem.getTransientData().get(DynamicMarkerTypeEditingMenuE4.COMMAND_PARAMETER_MARKER_STATE);
+
+
+ AbstractPostOperation operation = new SetMarkerFlagOperation("Set Marker", BulkEditorUtil.getUndoContext(), Collections.singleton(selection), markerType, markerState, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+
+ @CanExecute
+ public boolean canExecute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection instanceof IAnnotatableEntity;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class SetMergeCandidateHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ AbstractBulkEditorInput input = editor.getEditorInput();
+ if(input.getMergeTarget()!=null
+ && input.getMergeTarget().equals(selection)){
+ input.setMergeTarget(null);
+ }
+ input.addMergeCandidate(selection);
+ editor.refresh();
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ canExecute = selection!=null
+ && editor.getEditorInput().isMergingEnabled()
+ && !editor.getEditorInput().getMergeCandidates().contains(selection);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.bulkeditor.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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class SetMergeTargetHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ AbstractBulkEditorInput input = editor.getEditorInput();
+ if(input.getMergeCandidates().contains(selection)){
+ input.removeMergeCandidate(selection);
+ }
+ input.setMergeTarget(selection);
+ editor.refresh();
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)CdmBase selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+ canExecute = selection!=null
+ && editor.getEditorInput().isMergingEnabled()
+ && (editor.getEditorInput().getMergeTarget()==null
+ || !editor.getEditorInput().getMergeTarget().equals(selection));
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
-import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
-import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* <p>OpenBulkEditorHandler class.</p>
* @version 1.0
*/
public class OpenBulkEditorHandler extends AbstractHandler {
- private static final Logger logger = Logger.getLogger(OpenBulkEditorHandler.class);
-
+ private static final Logger logger = Logger.getLogger(OpenBulkEditorHandler.class);
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
String inputTypeId = event.getParameter(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID);
BulkEditorInputType inputType = BulkEditorInputType.getById(inputTypeId);
- try {
- HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().
- openEditor(AbstractBulkEditorInput.NewInstance(inputType), BulkEditor.ID);
- } catch (PartInitException e) {
- new RuntimeException(e);
- logger.error("Error opening bulk editor", e);
- }
+// try {
+// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().
+// openEditor(AbstractBulkEditorInput.NewInstance(inputType), BulkEditor.ID);
+// } catch (PartInitException e) {
+// new RuntimeException(e);
+// logger.error("Error opening bulk editor", e);
+// }
return null;
}
}
/**
* 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.
*/
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
ISelection selection = HandlerUtil.getCurrentSelection(event);
-
+
IEditorPart editor = HandlerUtil.getActiveEditor(event);
-
+
Object[] data = (Object[]) ((Event) event.getTrigger()).data;
-
- if (selection instanceof TextSelection
+
+ if (selection instanceof TextSelection
&& editor instanceof BulkEditor) {
TextSelection textSelection = (TextSelection) selection;
BulkEditor bulkEditor = (BulkEditor) editor;
-
+
LineAnnotationModel model = (LineAnnotationModel) bulkEditor.getDocumentProvider().getAnnotationModel(editor.getEditorInput());
if (model != null) {
Iterator iter = model.getAnnotationIterator(textSelection.getOffset(), textSelection.getLength(), true, true);
-
+
Set<IAnnotatableEntity> annotatableEntities = new HashSet<IAnnotatableEntity>();
while (iter.hasNext()) {
Object next = iter.next();
if (next instanceof LineAnnotation) {
Object entity = ((LineAnnotation) next).getEntity();
-
+
if(entity instanceof IAnnotatableEntity){
annotatableEntities.add((IAnnotatableEntity) entity);
}
}
}
-
+
AbstractPostOperation operation = new SetMarkerFlagOperation("Set Marker", BulkEditorUtil.getUndoContext(), annotatableEntities, (MarkerType) data[0], (Boolean) data[1], bulkEditor);
- BulkEditorUtil.executeOperation(operation);
}
}
return null;
+++ /dev/null
-package eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler;
-
-import java.util.UUID;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-public class OpenBulkEditorForIdentifiableEntity extends DefaultOpenHandlerBase<IdentifiableEntity> {
-
- @Override
- protected IdentifiableEntity getEntity(UUID uuid) {
- return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
- }
-
- @Override
- protected void open(ExecutionEvent event, IdentifiableEntity entity) {
- try {
- BulkEditorUtil.openEditor(entity);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
- }
- }
-
-
-}
import java.util.UUID;
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
+import eu.etaxonomy.cdm.model.agent.AgentBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
-public class OpenBulkEditorForIdentifiableEntityE4 {
-
- @Execute
- public void execute(MHandledMenuItem menuItem) {
- String commandId = menuItem.getCommand().getElementId();
- UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".uuid");
- IdentifiableEntity entity = CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
- try {
- BulkEditorUtil.openEditor(entity);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
- }
- }
+public class OpenBulkEditorForIdentifiableEntityE4 extends DefaultOpenHandlerBaseE4<IdentifiableEntity>{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected IdentifiableEntity getEntity(UUID uuid) {
+ return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void open(IdentifiableEntity entity, Shell shell, EPartService partService) {
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(entity);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(IdentifiableEntity entity) {
+ return entity instanceof Reference
+ || entity instanceof TaxonName
+ || entity instanceof AgentBase
+ || entity instanceof SpecimenOrObservationBase
+ || entity instanceof TaxonBase
+ || entity instanceof Media
+ ;
+ }
}
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
-public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
+public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBaseE4<TaxonNode> {
@Override
protected TaxonNode getEntity(UUID uuid) {
}
@Override
- protected void open(ExecutionEvent event, TaxonNode entity) {
- try {
- BulkEditorUtil.openEditor(entity.getTaxon());
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
- }
+ protected void open(TaxonNode entity, Shell shell, EPartService partService) {
+ AbstractBulkEditorInput input = AbstractBulkEditorInput.NewInstance(entity.getTaxon());
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(TaxonNode entity) {
+ return entity.getTaxon()!=null;
}
}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.UUID;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
+import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.strategy.merge.IMergable;
* @version 1.0
* @param <T>
*/
-public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEntitySessionInput implements IEditorInput ,
+public abstract class AbstractBulkEditorInput<T extends CdmBase> extends CdmEntitySessionInput implements
IEntityPersistenceService<T> {
private UUID entityUuid;
- private List<T> model;
+ private List<T> model = new ArrayList<>();
+
+ private Map<T, DeleteConfiguratorBase> toDelete = new HashMap<>();
+
+ private List<T> mergeCandidates = new ArrayList<>();
+ private T mergeTarget = null;
private IEntityCreator<T> entityCreator;
private final ConversationHolder conversation;
return editorInput;
}
+ public abstract String getName();
+
protected abstract List<T> listEntities(IIdentifiableEntityServiceConfigurator configurator);
protected abstract T loadEntity(UUID entityUuid);
- private void setEntityUuid(UUID entityUuid){
- this.entityUuid = entityUuid;
+ public void setMergeTarget(T t){
+ mergeTarget = t;
}
- public UUID getEntityUuid() {
- return entityUuid;
+ public List<T> getMergeCandidates() {
+ return mergeCandidates;
+ }
+
+ public T getMergeTarget() {
+ return mergeTarget;
+ }
+
+ public void removeMergeTarget(){
+ mergeTarget = null;
}
- @Override
- public boolean exists() {
- // TODO Auto-generated method stub
- return false;
+ public void addMergeCandidate(T t){
+ mergeCandidates.add(t);
}
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
+ public void removeMergeCandidate(T t){
+ mergeCandidates.remove(t);
}
- @Override
- public IPersistableElement getPersistable() {
- return null;
+ public void addToDelete(T t, DeleteConfiguratorBase config) {
+ toDelete.put(t, config);
+ }
+
+ private void setEntityUuid(UUID entityUuid){
+ this.entityUuid = entityUuid;
}
- /** {@inheritDoc} */
- @Override
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return null;
+ public UUID getEntityUuid() {
+ return entityUuid;
}
public void performSearch(final BulkEditorQuery bulkEditorQuery) {
return true;
}
+ public void saveModel(){
+ saveModel(true);
+ }
+
+ public void saveModel(boolean resetMerge){
+ //delete entities
+ for(Entry<T, DeleteConfiguratorBase> entry:toDelete.entrySet()){
+ try {
+ delete(entry.getKey(), entry.getValue());
+ } catch (ReferencedObjectUndeletableException e) {
+ e.printStackTrace();
+ }
+ }
+ toDelete.clear();
+ if(resetMerge){
+ //merge entities
+ for(T mergeCandidate:mergeCandidates){
+ merge(mergeCandidate, mergeTarget);
+ }
+ mergeCandidates.clear();
+ mergeTarget = null;
+ }
+ }
+
/** {@inheritDoc} */
@Override
return ID;
}
-
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.AGENT.label;
}
- @Override
- public String getToolTipText() {
- return getName();
- }
-
public static AbstractBulkEditorInput getInstance() {
if (instance == null) {
instance = new AgentEditorInput();
return CdmStore.getSearchManager().findTeamOrPersons(configurator);
}
- /** {@inheritDoc}
- @Override
- public AgentBase loadEntity(UUID uuid) {
- List<String> propertyPaths = Arrays.asList(new String[]{});
- return CdmStore.getService(IAgentService.class).load(uuid, propertyPaths);
- }*/
-
-
public boolean delete(AgentBase entity) throws ReferencedObjectUndeletableException {
return CdmStore.getService(IAgentService.class).delete(entity) != null;
}
- /** {@inheritDoc} */
- public boolean save(AgentBase entity) {
-
- return CdmStore.getService(IAgentService.class).saveOrUpdate(entity) != null;
- }
-
@Override
public List<IBulkEditorSortProvider<TeamOrPersonBase>> getSortProviders() {
List<IBulkEditorSortProvider<TeamOrPersonBase>> sortProviders = super.getSortProviders();
return sortProviders;
}
-
@Override
protected IEntityCreator<TeamOrPersonBase> createEntityCreator() {
return new AgentCreator();
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#merge()
- */
@Override
public void merge() {
}
-
@Override
protected TeamOrPersonBase loadEntity(UUID entityUuid) {
List<String> propertyPaths = Arrays.asList(new String[]{});
return HibernateProxyHelper.deproxy(CdmStore.getService(IAgentService.class).load(entityUuid, propertyPaths), TeamOrPersonBase.class);
}
-
-
}
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.GROUP.label;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
@Override
public Group save(Group entity) {
return CdmStore.getService(IGroupService.class).merge(entity, true).getMergedEntity();
-
+
}
/* (non-Javadoc)
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.exception.ReferencedObjectUndeletableException;
import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.cdm.persistence.dao.hibernate.media.MediaDaoHibernateImpl;
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.MediaCreator;
return BulkEditorInputType.MEDIA.label;
}
- @Override
- public String getToolTipText() {
- return getName();
- }
-
@Override
public Media save(Media entity) {
return CdmStore.getService(IMediaService.class).merge(entity, true).getMergedEntity();
-
+
}
@Override
if (config instanceof MediaDeletionConfigurator){
mediaConfig = (MediaDeletionConfigurator) config;
} else{
-
+
}
return CdmStore.getService(IMediaService.class).delete(entity.getUuid(), mediaConfig) != null;
}
return sortProviders;
}
-
+
@Override
protected Media loadEntity(UUID entityUuid) {
List<String> propertyPaths = Arrays.asList(new String[]{});
return instance;
}
- /**
- * <p>getName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.NAME.label;
}
- /**
- * <p>getToolTipText</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
/**
* <p>getID</p>
*
/** {@inheritDoc} */
@Override
public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
-
+
configurator.setPropertyPaths(getPropertyPaths());
return CdmStore.getSearchManager().findNames(configurator, this.getConversation());
}
if (config instanceof NameDeletionConfigurator){
nameConfig = (NameDeletionConfigurator) config;
} else{
-
+
}
return CdmStore.getService(INameService.class).delete(entity.getUuid(), nameConfig) != null;
}
-
+
/** {@inheritDoc} */
@Override
public TaxonName save(TaxonName entity) {
TaxonName mergedName = null;
mergedName = CdmStore.getService(INameService.class).merge(entity, true).getMergedEntity();
return mergedName;
-
+
}
@Override
"name.relationsToThisName",
"name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status",
"name.homotypicalGroup.typifiedNames.relationsToThisName.fromName"});
-
+
return nameBasePropertyPaths;
}
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- /** {@inheritDoc} */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.NAME_RELATIONSHIP.label;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- /** {@inheritDoc} */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
return CdmStore.getService(IOccurrenceService.class).load(entityUuid, propertyPaths);
}*/
- /**
- * <p>getName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.OCCURRENCE.label;
}
- /**
- * <p>getToolTipText</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
@Override
public String getTypeText(Object entity) {
if(HibernateProxyHelper.isInstanceOf(entity, SpecimenOrObservationBase.class)){
return ID;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- /**
- * <p>getName</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.REFERENCE.label;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- /**
- * <p>getToolTipText</p>
- *
- * @return a {@link java.lang.String} object.
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
/**
* <p>Getter for the field <code>instance</code>.</p>
*
\r
import eu.etaxonomy.cdm.api.service.ITaxonService;\r
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;\r
-import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;\r
-import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;\r
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;\r
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;\r
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
import eu.etaxonomy.cdm.model.taxon.Synonym;\r
import eu.etaxonomy.cdm.model.taxon.Taxon;\r
import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
-import eu.etaxonomy.cdm.persistence.query.MatchMode;\r
import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;\r
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;\r
import eu.etaxonomy.taxeditor.bulkeditor.input.entitycreator.TaxonCreator;\r
+import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.IdentifiableEntitySortProvider;\r
import eu.etaxonomy.taxeditor.store.CdmStore;\r
\r
public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{\r
return instance;\r
}\r
\r
-\r
- @Override\r
+ @Override\r
public String getName() {\r
return BulkEditorInputType.TAXON.label;\r
}\r
\r
- @Override\r
- public String getToolTipText() {\r
- return getName();\r
- }\r
-\r
-\r
/**\r
* <p>getID</p>\r
*\r
return ID;\r
}\r
\r
+ @Override\r
+ public List<IBulkEditorSortProvider<TaxonBase>> getSortProviders() {\r
+ List<IBulkEditorSortProvider<TaxonBase>> sortProviders = super.getSortProviders();\r
+\r
+ sortProviders.add(0, new IdentifiableEntitySortProvider<TaxonBase>());\r
+\r
+ return sortProviders;\r
+ }\r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput#isMergingEnabled()\r
*/\r
// IFindTaxaAndNamesConfigurator<TaxonBase> newConfig = new FindTaxaAndNamesConfiguratorImpl<TaxonBase>();\r
// newConfig.setTitleSearchString(configurator.getTitleSearchStringSqlized());\r
// newConfig.setMatchMode(MatchMode.ANYWHERE);\r
- \r
+\r
List<TaxonBase> taxa = CdmStore.getSearchManager().findTaxa(configurator);\r
List<TaxonBase> taxaCopy = new ArrayList<TaxonBase>();\r
for (TaxonBase taxon:taxa){\r
if (config instanceof TaxonDeletionConfigurator){\r
taxonConfig = (TaxonDeletionConfigurator)config;\r
}else{\r
- \r
+\r
}\r
- \r
+\r
return CdmStore.getService(ITaxonService.class).deleteTaxon(entity.getUuid(), taxonConfig, null) != null;\r
} else{\r
SynonymDeletionConfigurator synConfig = null;\r
if (config instanceof SynonymDeletionConfigurator){\r
synConfig = (SynonymDeletionConfigurator)config;\r
}else{\r
- \r
+\r
}\r
- \r
+\r
return CdmStore.getService(ITaxonService.class).deleteSynonym(entity.getUuid(), synConfig) != null;\r
}\r
}\r
return instance;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
+ @Override
public String getName() {
return BulkEditorInputType.USER.label;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService#save(java.lang.Object)
*/
public void merge() {
}
-
+
@Override
protected User loadEntity(UUID entityUuid) {
import org.eclipse.ui.IWorkbenchPreferencePage;
import eu.etaxonomy.cdm.model.common.MarkerType;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(PreferencesUtil.getPreferenceStore());
- if(!CdmStore.isActive()) {
- MessagingUtils.noDataSourceWarningDialog(null);
- }
}
@Override
/** {@inheritDoc} */
@PreDestroy
public void dispose() {
- conversation.close();
+ if(conversation!=null){
+ conversation.close();
+ }
}
/** {@inheritDoc} */
private static final String BUNDLE_NAME = "src/main/java/eu.etaxonomy.taxeditor.l10n.messages"; //$NON-NLS-1$
public static String USER_CREATOR_user_exists_title;
public static String USER_CREATOR_user_exists;
- public static String BulkEditorInputType_0;
+ public static String BulkEditorE4_CANCEL;
+ public static String BulkEditorE4_DONT_SAVE;
+ public static String BulkEditorE4_SAVE_AND_SEARCH;
+ public static String BulkEditorE4_SAVE_CHANGES_MESSAGE;
+ public static String BulkEditorE4_SAVE_CHANGES_TITLE;
+ public static String BulkEditorInputType_0;
public static String BulkEditorInputType_1;
public static String BulkEditorInputType_2;
public static String BulkEditorInputType_3;
public static String BulkEditorInputType_6;
public static String BulkEditorInputType_7;
public static String BulkEditorInputType_8;
+ public static String BulkEditorSearchE4_SEARCH;
+ public static String BulkEditorSearchE4_TITLE_CACHE;
+ public static String BulkEditorSearchE4_WILDCARD;
public static String ReferencingObjectsLabelProvider_No_description_available;
public static String ConvertPerson2TeamHandler_warning;
public static String ConvertPerson2TeamHandler_lable;
public static String DeleteHandler_TAXON_CAN_NOT_BE_DELETED;
public static String DeleteHandler_TEAM_OR_PERSON;
public static String DeleteHandler_USER;
+ public static String DynamicMarkerTypeEditingMenuE4_CHOOSE_MARKER_TYPE;
+ public static String DynamicMarkerTypeEditingMenuE4_NO;
+ public static String DynamicMarkerTypeEditingMenuE4_SET_FLAG;
+ public static String DynamicMarkerTypeEditingMenuE4_YES;
+ public static String DynamicNewObjectMenuE4_NEW;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+BulkEditorE4_CANCEL=Cancel
+BulkEditorE4_DONT_SAVE=Don't save (and Search)
+BulkEditorE4_SAVE_AND_SEARCH=Save (and Search)
+BulkEditorE4_SAVE_CHANGES_MESSAGE=You have made changes that must be saved before this query can be executed. Would you like to proceed?
+BulkEditorE4_SAVE_CHANGES_TITLE=Save changes
BulkEditorInputType_0=Persons and Teams
BulkEditorInputType_1=References
BulkEditorInputType_2=Names
BulkEditorInputType_6=Groups
BulkEditorInputType_7=Taxa
BulkEditorInputType_8=Media
+BulkEditorSearchE4_SEARCH=Search
+BulkEditorSearchE4_TITLE_CACHE=Title Cache
+BulkEditorSearchE4_WILDCARD=Use '%s' for wildcard searching
USER_CREATOR_user_exists_title=The user already exists
USER_CREATOR_user_exists=The user already exists in database
DeleteHandler_TAXON=taxon
DeleteHandler_TAXON_CAN_NOT_BE_DELETED=The taxon can not be deleted in bulk editor. It is used in a classification.
DeleteHandler_TEAM_OR_PERSON=team or person
-DeleteHandler_USER=user
\ No newline at end of file
+DeleteHandler_USER=user
+DynamicMarkerTypeEditingMenuE4_CHOOSE_MARKER_TYPE=Choose marker type
+DynamicMarkerTypeEditingMenuE4_NO=No
+DynamicMarkerTypeEditingMenuE4_SET_FLAG=Set Flag '%s'
+DynamicMarkerTypeEditingMenuE4_YES=Yes
+DynamicNewObjectMenuE4_NEW=New
+BulkEditorE4_CANCEL=Abbrechen
+BulkEditorE4_DONT_SAVE=Nicht specichern (und suchen)
+BulkEditorE4_SAVE_AND_SEARCH=Speichern (und suchen)
+BulkEditorE4_SAVE_CHANGES_MESSAGE=Sie haben Änderungn die gespeichert werden müssen, bevor sie die Anfrage durchführen können. Wollen Sie fortfahren?
+BulkEditorE4_SAVE_CHANGES_TITLE=Änderungen speichern
BulkEditorInputType_0=Personen und Teams
BulkEditorInputType_1=Referenzen
BulkEditorInputType_2=Namen
BulkEditorInputType_6=Nutzergruppen
BulkEditorInputType_7=Taxa
BulkEditorInputType_8=Medien
+BulkEditorSearchE4_SEARCH=Suche
+BulkEditorSearchE4_TITLE_CACHE=Title-Cache
+BulkEditorSearchE4_WILDCARD='%s' f\u00FCr Platzhalter-Suche benutzen
USER_CREATOR_user_exists_title=Der Benutzer existiert bereits
USER_CREATOR_user_exists=Der Benutzer existiert bereits in der Datenbank.
DeleteHandler_TAXON_CAN_NOT_BE_DELETED=Das Taxon kann im Bulk-Editor nicht gelöscht werden. Es wird in einer Klassifikation verwendet.
DeleteHandler_TEAM_OR_PERSON=Team oder Person
DeleteHandler_USER=User
+DynamicMarkerTypeEditingMenuE4_CHOOSE_MARKER_TYPE=Markertyp wählen
+DynamicMarkerTypeEditingMenuE4_NO=Nein
+DynamicMarkerTypeEditingMenuE4_SET_FLAG='%s' flag setzen
+DynamicMarkerTypeEditingMenuE4_YES=Ja
+DynamicNewObjectMenuE4_NEW=Neu
<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.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.10.0.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.10.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.11.0.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.11.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"/>
Bundle-ManifestVersion: 2
Bundle-Name: CDM Library Dependencies Plugin
Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Eclipse-BundleShape: dir
Export-Package: com.google.api,
com.google.api.detect,
eu.etaxonomy.cdm.api.utility,
eu.etaxonomy.cdm.api.validation,
eu.etaxonomy.cdm.api.validation.batch,
- eu.etaxonomy.cdm.aspectj,
eu.etaxonomy.cdm.common,
eu.etaxonomy.cdm.common.media,
eu.etaxonomy.cdm.common.monitor,
lib/aspectjrt-1.8.8.jar,
lib/aspectjweaver-1.8.8.jar,
lib/batik-xml-1.7.jar,
- lib/cdmlib-commons-4.10.0.jar,
- lib/cdmlib-ext-4.10.0.jar,
- lib/cdmlib-io-4.10.0.jar,
- lib/cdmlib-model-4.10.0.jar,
- lib/cdmlib-persistence-4.10.0.jar,
- lib/cdmlib-print-4.10.0.jar,
- lib/cdmlib-remote-4.10.0.jar,
- lib/cdmlib-services-4.10.0.jar,
- lib/cdmlib-test-4.10.0.jar,
+ lib/cdmlib-commons-4.11.0.jar,
+ lib/cdmlib-ext-4.11.0.jar,
+ lib/cdmlib-io-4.11.0.jar,
+ lib/cdmlib-model-4.11.0.jar,
+ lib/cdmlib-persistence-4.11.0.jar,
+ lib/cdmlib-print-4.11.0.jar,
+ lib/cdmlib-remote-4.11.0.jar,
+ lib/cdmlib-services-4.11.0.jar,
+ lib/cdmlib-test-4.11.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,
lib/aspectjrt-1.8.8.jar,\
lib/aspectjweaver-1.8.8.jar,\
lib/batik-xml-1.7.jar,\
- lib/cdmlib-commons-4.10.0.jar,\
- lib/cdmlib-ext-4.10.0.jar,\
- lib/cdmlib-io-4.10.0.jar,\
- lib/cdmlib-model-4.10.0.jar,\
- lib/cdmlib-persistence-4.10.0.jar,\
- lib/cdmlib-print-4.10.0.jar,\
- lib/cdmlib-remote-4.10.0.jar,\
- lib/cdmlib-services-4.10.0.jar,\
- lib/cdmlib-test-4.10.0.jar,\
+ lib/cdmlib-commons-4.11.0.jar,\
+ lib/cdmlib-ext-4.11.0.jar,\
+ lib/cdmlib-io-4.11.0.jar,\
+ lib/cdmlib-model-4.11.0.jar,\
+ lib/cdmlib-persistence-4.11.0.jar,\
+ lib/cdmlib-print-4.11.0.jar,\
+ lib/cdmlib-remote-4.11.0.jar,\
+ lib/cdmlib-services-4.11.0.jar,\
+ lib/cdmlib-test-4.11.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,\
<parent>\r
<groupId>eu.etaxonomy</groupId>\r
<artifactId>taxeditor-parent</artifactId>\r
- <version>4.10.0</version>\r
+ <version>4.11.0</version>\r
</parent>\r
<modelVersion>4.0.0</modelVersion>\r
<artifactId>eu.etaxonomy.taxeditor.cdmlib</artifactId>\r
</dependency>\r
<dependency>\r
<groupId>org.hibernate.javax.persistence</groupId>\r
- <artifactId>hibernate-jpa-2.0-api</artifactId>\r
- <version>1.0.1.Final</version>\r
+ <artifactId>hibernate-jpa-2.1-api</artifactId>\r
+ <version>1.0.0.Final</version>\r
</dependency>\r
<dependency>\r
<groupId>org.hibernate</groupId>\r
/**
* @author cmathew
* @date 14 Oct 2014
- *
*/
@Component
public class CachedCommonServiceImpl implements ICachedCommonService {
CachedCommonServiceImpl.cacheEnabled = cacheEnabled;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#find(java.lang.Class, int)
- */
@Override
public CdmBase find(Class<? extends CdmBase> clazz, int id) {
CdmBase cdmEntity = CdmApplicationState.getCurrentAppConfig().getCommonService().find(clazz, id, getPropertyPaths(clazz));
throw new NullPointerException("CDM Entity of type " + clazz.getName() + " with id " + id + " is null.");
}
return cdmEntity;
-
}
return propertyPaths;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.service.ICachedCommonService#initializeCollection(java.util.UUID, java.lang.String)
- */
@Override
public Object initializeCollection(UUID ownerUuid, String fieldName) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().initializeCollection(ownerUuid, fieldName, getPropertyPaths(fieldName));
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#isEmpty(org.hibernate.collection.spi.PersistentCollection)
- */
@Override
public boolean isEmpty(UUID ownerUuid, String fieldName) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().isEmpty(ownerUuid, fieldName);
-
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#size(org.hibernate.collection.spi.PersistentCollection)
- */
@Override
public int size(UUID ownerUuid, String fieldName) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().size(ownerUuid, fieldName);
}
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#contains(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
@Override
public boolean contains(UUID ownerUuid, String fieldName, Object element) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().contains(ownerUuid, fieldName, element);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsKey(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
@Override
public boolean containsKey(UUID ownerUuid, String fieldName, Object key) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().containsKey(ownerUuid, fieldName, key);
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.remoting.service.ICachedCommonService#containsValue(org.hibernate.collection.spi.PersistentCollection, java.lang.Object)
- */
@Override
public boolean containsValue(UUID ownerUuid, String fieldName, Object element) {
return CdmApplicationState.getCurrentAppConfig().getCommonService().containsValue(ownerUuid, fieldName, element);
}
-
-
-
-
-
}
Bundle-ManifestVersion: 2
Bundle-Name: Editor Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.editor;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: OSGI-INF/l10n/plugin
Export-Package: eu.etaxonomy.taxeditor.editor,
+ eu.etaxonomy.taxeditor.editor.e4,
eu.etaxonomy.taxeditor.editor.handler,
eu.etaxonomy.taxeditor.editor.handler.defaultHandler,
eu.etaxonomy.taxeditor.editor.internal,
eu.etaxonomy.taxeditor.editor.key.polytomous,
- eu.etaxonomy.taxeditor.editor.name,
+ eu.etaxonomy.taxeditor.editor.key.polytomous.e4,
+ eu.etaxonomy.taxeditor.editor.name.e4,
eu.etaxonomy.taxeditor.editor.name.handler,
eu.etaxonomy.taxeditor.editor.name.operation,
eu.etaxonomy.taxeditor.editor.view.concept,
org.eclipse.e4.ui.model.workbench,
org.eclipse.e4.ui.di,
org.eclipse.e4.core.commands,
+ org.eclipse.e4.core.services,
org.eclipse.e4.core.contexts
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
command.name.32 = Create Concept Relation\r
command.name.33 = Open Related Concept\r
category.name.7 = -- Group\r
-command.name.34 = Edit CDM Authorities\r
+command.name.34 = Edit Authorities\r
command.name.35 = Open Specimen Editor\r
scheme.description = The default key binding scheme for the Taxonomic Editor\r
scheme.name = Taxonomic Editor Default Key Bindings\r
command.name.32 = Erstelle Konzeptrelationen
command.name.33 = \u00d6ffne verbundenes Konzept
category.name.7 = -- Gruppe
-command.name.34 = Bearbeite CDM Rechte
+command.name.34 = Bearbeite Rechte
command.name.35 = \u00d6ffne Specimen-Editor
scheme.description = Die Standard Tastenkombinationsschema f\u00fcr den Taxonomischen Editor
scheme.name = Taxonomic Editor Standard Tastenkombinationen
<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"/>
+ <imports xsi:type="commands:Command" xmi:id="_0WYQcL2lEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.command.collapse"/>
+ <imports xsi:type="commands:Command" xmi:id="_vDKPoL4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.workbench.command.expand"/>
<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>
<handlers xmi:id="_DgC2MIG5EeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandlerE4" command="_AqgMcIG5EeehlNPrK_b5JA"/>
<handlers xmi:id="_o7njgIy0EeeQaL4TL8oz7Q" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4" command="_8ccfgIHXEeehlNPrK_b5JA"/>
<handlers xmi:id="_xJ3XUIy0EeeQaL4TL8oz7Q" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.ToggleShowOnlyIndividualAssociationsHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.ToggleShowOnlyIndividualAssociationsHandlerE4" command="_4eDWoIy0EeeQaL4TL8oz7Q"/>
+ <handlers xmi:id="_Te6qAIy3EeeQaL4TL8oz7Q" elementId="eu.etaxonomy.taxeditor.editor.factualData.saveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_majwMEaQEeeXMc6kSYO7Xg"/>
+ <handlers xmi:id="_Epa7oJMpEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement" command="_j2cfsJMmEeeR4YRjNqCKeA"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_HxxDt4GxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.factualDataView">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_bMfdYIG5EeehlNPrK_b5JA" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_jvmnkIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.factualData.addDescription" label="%command.label.27" command="_gE3lwIGyEeehlNPrK_b5JA"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_pOAxAIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.10"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_rLS9EIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.factualData.delete" label="%command.label.30" command="_AqgMcIG5EeehlNPrK_b5JA"/>
</menus>
+ <toolbar xmi:id="_sfp2sL2jEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.editor.toolbar.0">
+ <children xsi:type="menu:HandledToolItem" xmi:id="_t7kbEL2jEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.editor.handledtoolitem.factual.showIndividualAssociations" label="%command.name.41" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif" type="Check" command="_4eDWoIy0EeeQaL4TL8oz7Q"/>
+ <children xsi:type="menu:HandledToolItem" xmi:id="_1ltxYL2lEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.editor.factual.handledtoolitem.collapse" label="Collapse" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/collapseall.gif" command="_0WYQcL2lEeeyWfw0n8-ICQ"/>
+ <children xsi:type="menu:HandledToolItem" xmi:id="_xqBkML4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.editor.factual.handledtoolitem.expand" label="Expand" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/expandAll.jpg" command="_vDKPoL4vEeewU62zpvPllA"/>
+ </toolbar>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_KJxRIIZ4EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4" label="%view.name.2" iconURI="" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4">
<handlers xmi:id="_fEoFAIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.DeleteConceptRelationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.DeleteConceptRelationHandlerE4" command="_Ob4xIIZ5EeeOc9DZcjNN7g"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_KT8rYIZ5EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel44" label="%command.label.44" command="_Ob4xIIZ5EeeOc9DZcjNN7g"/>
</menus>
</elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_tLceMIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4" label="Taxon Name Editor" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif" tooltip="" allowMultiple="true" category="" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4">
+ <tags>View</tags>
+ <tags>nonRestore</tags>
+ <handlers xmi:id="_tLceQIl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.handler.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_majwMEaQEeeXMc6kSYO7Xg"/>
+ <handlers xmi:id="_DCv88IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4" command="_ult4EIvOEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OqNIQIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4" command="_KpUFsIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_XFc2QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4" command="_VPLRIIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_ffY8sIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4" command="_c0byUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_qKP84IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4" command="_oBnccIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_14GrIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4" command="_yh49QIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_8Lzd0IvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4" command="_56AaUIvPEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_GTxMUIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4" command="_CoVcYIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_OZLNMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4" command="_L4vQwIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_WWqoMIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4" command="_UFDx8IvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_edkd4IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4" command="_b2nCsIvQEee7R4eqeQiXZg"/>
+ <handlers xmi:id="_lv9GYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" command="_jNvBQIvQEee7R4eqeQiXZg"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_tLceQYl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor">
+ <children xsi:type="menu:Menu" xmi:id="_R6buoIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.new" label="%menu.label">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym" label="%command.label.9" command="_ult4EIvOEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym" label="%command.label.10" command="_KpUFsIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newSynonymInHomotypicGroup" label="%command.label.11" command="_VPLRIIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_LGspoIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.16"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication" label="%command.label.49" command="_c0byUIvPEee7R4eqeQiXZg"/>
+ </children>
+ <children xsi:type="menu:Menu" xmi:id="_ZXIJsIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.changeTo" label="%menu.label.0">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted" label="%command.label.12" command="_oBnccIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym" label="%command.label.13" command="_yh49QIvPEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication" label="%command.label.14" command="_56AaUIvPEee7R4eqeQiXZg"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_a0anEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.13"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.delete" label="%command.label.15" command="_CoVcYIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_dVXg4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.deleteEmptyNames" label="%command.label.16" command="_L4vQwIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_e7Jy8Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.14"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_fkhgEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.swapSynonymWithAccpeted" label="%command.label.17" command="_UFDx8IvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_hdfz4Il5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.setAsBasionym" label="%command.label.57" command="_b2nCsIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_iw4HUIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.moveSynonym" label="%command.label.56" command="_jNvBQIvQEee7R4eqeQiXZg"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_kS2QYIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.15"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_zsZzIIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.nameEditorPopup.details" label="%command.label.18" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_zsZzIYvQEee7R4eqeQiXZg" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_zsZzIovQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
+ </children>
+ </menus>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_1STmAJRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.view.uses" label="%view.name.0" iconURI="" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.uses.e4.UsesViewPartE4">
+ <handlers xmi:id="_1STmAZRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseHandlerE4" command="_5B3ykJRNEeeDJ72ZvUwCLA"/>
+ <handlers xmi:id="_1STmApRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseSummaryHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseSummaryHandlerE4" command="_AWDx4JROEeeDJ72ZvUwCLA"/>
+ <handlers xmi:id="_1STmA5RMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseRecordHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseRecordHandlerE4" command="_9kCWMJRNEeeDJ72ZvUwCLA"/>
+ <handlers xmi:id="_1STmBJRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandlerE4" command="_EydEsJROEeeDJ72ZvUwCLA"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_1STmCZRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.usesView">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_1STmCpRMEeeDJ72ZvUwCLA" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1STmC5RMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUse" label="%command.label.32" command="_5B3ykJRNEeeDJ72ZvUwCLA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1STmDpRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUseSummary" label="%command.label.33" command="_AWDx4JROEeeDJ72ZvUwCLA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1STmEJRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUseRecord" label="%command.label.34" command="_9kCWMJRNEeeDJ72ZvUwCLA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_xMcucJRNEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.17"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1STmFJRMEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.delete" label="%command.label.35" command="_EydEsJROEeeDJ72ZvUwCLA"/>
+ </menus>
+ <toolbar xmi:id="_2-u_EL4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.editor.toolbar.1">
+ <children xsi:type="menu:HandledToolItem" xmi:id="_3xn0kL4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.editor.handledtoolitem.uses.collapse" label="Collapse" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/collapseall.gif" command="_0WYQcL2lEeeyWfw0n8-ICQ"/>
+ <children xsi:type="menu:HandledToolItem" xmi:id="__fcb4L4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.editor.factual.handledtoolitem.uses.expand" label="Expand" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/expandAll.jpg" command="_vDKPoL4vEeewU62zpvPllA"/>
+ </toolbar>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_gIHnIKNpEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.view.concept.graph.e4.ConceptGraphViewE4" label="%view.name.3" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/address-book-new.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.concept.graph.e4.ConceptGraphViewE4"/>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_rg3MoKKbEeee0INlRJv_6Q" elementId="eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4" label="%editor.name.8" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/check.png" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4"/>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_ghDAsKO6EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4" label="%editor.name.2" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4">
+ <tags>nonRestore</tags>
+ <handlers xmi:id="_dpB_kKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.e4.handler.ApplyLayoutHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.e4.handler.ApplyLayoutHandlerE4" command="_zN-H8KO8EeeWePK798pdTw"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_J8Q6AKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeygrapheditor" toBeRendered="false" visible="false">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_bnPG8KRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.newnode" toBeRendered="false" visible="false" label="%command.label.20" command="_jJ_4kKO9EeeWePK798pdTw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_wKd6cKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.delete" toBeRendered="false" visible="false" label="%command.label.21" command="_uM4zsKO8EeeWePK798pdTw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_whq5gKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.18" toBeRendered="false" visible="false"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_w9X-EKRbEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.applylayout" toBeRendered="false" visible="false" label="%command.label.22" command="_zN-H8KO8EeeWePK798pdTw"/>
+ </menus>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_tJeg0KO6EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4" label="%editor.name.3" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4">
+ <tags>nonRestore</tags>
+ <handlers xmi:id="_yHjdwKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.InsertNewNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.InsertNewNodeHandlerE4" command="_jJ_4kKO9EeeWePK798pdTw"/>
+ <handlers xmi:id="_zCFMUKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.DeleteNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.DeleteNodeHandlerE4" command="_uM4zsKO8EeeWePK798pdTw"/>
+ <handlers xmi:id="_8DficKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateChildNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateChildNodeHandlerE4" command="_tyHGwKO9EeeWePK798pdTw"/>
+ <handlers xmi:id="_QHL6QKRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateSiblingNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateSiblingNodeHandlerE4" command="_rkKogKO9EeeWePK798pdTw"/>
+ <handlers xmi:id="_pDoJsKRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.RefreshNodeNumberingHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.RefreshNodeNumberingHandlerE4" command="_mH1G8KRSEeePufXF8uhoCw"/>
+ <handlers xmi:id="_gCYp4KTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.handler.1" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.OpenPolytomousGraphEditorHandler" command="_ZolPMKTaEeejf7ggYkp-TA"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_2JO_8KRQEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeylisteditor">
+ <children xsi:type="menu:Menu" xmi:id="_2yjpwKRQEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.menu.polytomouskeylist.newkeynumber" label="%menu.label.4">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_DWtt4KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.new.insertNode" label="%command.label.58" command="_jJ_4kKO9EeeWePK798pdTw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_GeKnAKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.new.aftercurrent" label="%command.label.23" command="_tyHGwKO9EeeWePK798pdTw"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Iqi_AKRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.newAlternative" label="%command.label.24" command="_rkKogKO9EeeWePK798pdTw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_LJ-14KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.refreshNodes" label="%command.label.25" command="_mH1G8KRSEeePufXF8uhoCw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_Ww_XAKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.19"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_TvBa0KTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.opengraph" label="Open Graph" command="_ZolPMKTaEeejf7ggYkp-TA"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_XMhccKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.20"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Rf4A8KRREeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.delete" label="%command.label.26" command="_uM4zsKO8EeeWePK798pdTw"/>
+ </menus>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_ARZyMKz2EeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4" label="%editor.name.4" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_BjF3ADVqEee_b7RlBzTDRw" elementId="eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit" commandName="%command.commandname.1"/>
<elements xsi:type="commands:Command" xmi:id="_2torwIZ7EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.name.createConceptRelation" commandName="%command.name.32"/>
<elements xsi:type="commands:Command" xmi:id="_OKtWAIaDEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.view.concept.command.open" commandName="%command.name.33"/>
<elements xsi:type="commands:Command" xmi:id="_cMeq0IaHEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship" commandName="Open related concept in bulk editor"/>
+ <elements xsi:type="commands:Command" xmi:id="_ult4EIvOEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym" commandName="%command.name.1"/>
+ <elements xsi:type="commands:Command" xmi:id="_KpUFsIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym" commandName="%command.name.0"/>
+ <elements xsi:type="commands:Command" xmi:id="_VPLRIIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup" commandName="%command.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_c0byUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.createMisapplication" commandName="%command.name.36"/>
+ <elements xsi:type="commands:Command" xmi:id="_oBnccIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon" commandName="%command.name.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_yh49QIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToSynonym" commandName="%command.name.3"/>
+ <elements xsi:type="commands:Command" xmi:id="_56AaUIvPEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication" commandName="%command.name.5"/>
+ <elements xsi:type="commands:Command" xmi:id="_CoVcYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.delete" commandName="%command.name.45"/>
+ <elements xsi:type="commands:Command" xmi:id="_L4vQwIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames" commandName="%command.name.9"/>
+ <elements xsi:type="commands:Command" xmi:id="_UFDx8IvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted" commandName="%command.name.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_b2nCsIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym" commandName="%command.name.57"/>
+ <elements xsi:type="commands:Command" xmi:id="_jNvBQIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon" commandName="%command.name.46"/>
<elements xsi:type="commands:Command" xmi:id="_4eDWoIy0EeeQaL4TL8oz7Q" elementId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations" commandName="%command.name.41"/>
+ <elements xsi:type="commands:Command" xmi:id="_2Bn-EJMjEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.openSpecimenEditorForTypeSpecimen" commandName="%command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN"/>
+ <elements xsi:type="commands:Command" xmi:id="_XJT7MJMlEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon" commandName="%command.name.42"/>
+ <elements xsi:type="commands:Command" xmi:id="_9S0o4JMlEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode" commandName="%command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE"/>
+ <elements xsi:type="commands:Command" xmi:id="_j2cfsJMmEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor" commandName="%command.name.OPEN_DERIVATIVE_EDITOR"/>
+ <elements xsi:type="commands:Command" xmi:id="_5B3ykJRNEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.use.commands.adduse" commandName="%command.name.14"/>
+ <elements xsi:type="commands:Command" xmi:id="_9kCWMJRNEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.use.createUseRecord" commandName="%command.name.16"/>
+ <elements xsi:type="commands:Command" xmi:id="_AWDx4JROEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.use.createUseSummary" commandName="%command.name.15"/>
+ <elements xsi:type="commands:Command" xmi:id="_EydEsJROEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.editor.use.command.delete" commandName="%command.name.47"/>
+ <elements xsi:type="commands:Command" xmi:id="_Qi76oKNsEeee0INlRJv_6Q" elementId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler" commandName="%command.name.38">
+ <parameters xmi:id="_57LjQKNuEeee0INlRJv_6Q" elementId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistView.uuid" name="taxonNodeUuid"/>
+ </elements>
+ <elements xsi:type="commands:Command" xmi:id="_uM4zsKO8EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.delete" commandName="%command.label.21"/>
+ <elements xsi:type="commands:Command" xmi:id="_zN-H8KO8EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.command.applyLayout" commandName="%command.name.31"/>
+ <elements xsi:type="commands:Command" xmi:id="_jJ_4kKO9EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.new.node" commandName="%command.name.58"/>
+ <elements xsi:type="commands:Command" xmi:id="_rkKogKO9EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling" commandName="%command.name.29"/>
+ <elements xsi:type="commands:Command" xmi:id="_tyHGwKO9EeeWePK798pdTw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.new.child" commandName="%command.name.28"/>
+ <elements xsi:type="commands:Command" xmi:id="_mH1G8KRSEeePufXF8uhoCw" elementId="eu.etaxonomy.taxeditor.key.polytomous.command.refresh" commandName="%command.name.30"/>
+ <elements xsi:type="commands:Command" xmi:id="_ZolPMKTaEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.editor.command.polytomouskeylist.openGraph" commandName="Open Graph Editor"/>
+ <elements xsi:type="commands:Command" xmi:id="_cxTosKzzEeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.group.cdmauthorities.edit" commandName="%command.name.34"/>
+ <elements xsi:type="commands:Command" xmi:id="_PDjFMLsKEeeQJq8FDGEi1g" elementId="eu.etaxonomy.taxeditor.editor.command.openSpecimenEditorFromMenu" commandName="Open Specimen Editor"/>
+ <elements xsi:type="commands:Command" xmi:id="_61IwAK20EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.datasource" commandName="%command.name.39"/>
+ <elements xsi:type="commands:Command" xmi:id="_x3ecAK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.reference" commandName="%command.name.23"/>
+ <elements xsi:type="commands:Command" xmi:id="_1CaG8K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.name" commandName="%command.name.24"/>
+ <elements xsi:type="commands:Command" xmi:id="_2vSfgK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.team" commandName="%command.name.25"/>
+ <elements xsi:type="commands:Command" xmi:id="_4nv18K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.person" commandName="%command.name.26"/>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.store.menuseparator.afterSupplemental">
- <elements xsi:type="menu:MenuSeparator" xmi:id="_eAVmMJ7SEee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.14"/>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_XBhycIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.factualData" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/address-book-new.png" command="_WPjpoDSnEeek0dKsFNy--Q">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_COD1EIZHEee-VvuRyq44pQ" coreExpressionId="isCdmStoreConnected"/>
- <parameters xmi:id="_XBhycYGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.factualview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4"/>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_5s52EIZ3EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.concept" label="%command.label.6" tooltip="%command.label.6" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_BIalYIZ4EeeOc9DZcjNN7g" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_80HvkIaAEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4"/>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_cBaP4IDMEeeBD7P1FZoD-g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.mediaView" label="%view.name.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/camera-photo.png" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_cBaP4IDMEeeBD7P1FZoD-g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.mediaView" label="%view.name.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/camera-photo.png" tooltip="%view.name.1" command="_WPjpoDSnEeek0dKsFNy--Q">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_AIP_IIZHEee-VvuRyq44pQ" coreExpressionId="isCdmStoreConnected"/>
<parameters xmi:id="_cBaP4oDMEeeBD7P1FZoD-g" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.mediaview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4"/>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_5s52EIZ3EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.concept" label="%command.label.6" command="_WPjpoDSnEeek0dKsFNy--Q">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_BIalYIZ4EeeOc9DZcjNN7g" coreExpressionId="isCdmStoreConnected"/>
- <parameters xmi:id="_80HvkIaAEeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_XBhycIGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.factualData" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/address-book-new.png" tooltip="%view.name" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_COD1EIZHEee-VvuRyq44pQ" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_XBhycYGxEeehlNPrK_b5JA" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.factualview" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4"/>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_1D-38FvqEeerXd84Zrk_9A" coreExpressionId="isShowExperimentalFeatures"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_FPIHQKNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.conceptGraph" label="%view.name.3" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/address-book-new.png" tooltip="%view.name.3" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_WbFAcKNxEeebGZ23ERGMGw" coreExpressionId="isCdmStoreConnectedAndShowExperimental"/>
+ <parameters xmi:id="_FPIuUaNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.conceptGraph" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.view.concept.graph.e4.ConceptGraphViewE4"/>
+ </elements>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_P9N9YJMkEeeR4YRjNqCKeA" featurename="handlers" parentElementId="xpath:/">
+ <elements xsi:type="commands:Handler" xmi:id="_SL3mQJMkEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler" command="_2Bn-EJMjEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_S27gAJMlEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonBaseHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonBaseHandler" command="_XJT7MJMlEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_EYtGcJMmEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonNodeHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonNodeHandler" command="_9S0o4JMlEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_ihC9kJMnEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForSpecimenOrOBservationBase" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForSpecimenOrOBservationBase" command="_j2cfsJMmEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_9MRA4KNrEeee0INlRJv_6Q" elementId="eu.etaxonomy.taxeditor.editor.view.checklist.e4.handler.OpenChecklistEditorHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.checklist.e4.handler.OpenChecklistEditorHandlerE4" command="_Qi76oKNsEeee0INlRJv_6Q"/>
+ <elements xsi:type="commands:Handler" xmi:id="_MAx1UKz0EeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.editor.group.authority.e4.handler.EditCdmAuthoritiesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.group.authority.e4.handler.EditCdmAuthoritiesHandlerE4" command="_cxTosKzzEeeBIsZyvYlAaA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_SJx2ULsKEeeQJq8FDGEi1g" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenSpecimenEditorFromMenu" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenSpecimenEditorFromMenu" command="_PDjFMLsKEeeQJq8FDGEi1g"/>
+ <elements xsi:type="commands:Handler" xmi:id="_MtFB8K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.view.datasource.e4.handler.CreateDataSourceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.handler.CreateDataSourceHandlerE4" command="_61IwAK20EeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_TlvGYK22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewReferenceHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewReferenceHandler" command="_x3ecAK21EeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_Xi9w8K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler" command="_1CaG8K21EeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_ahCroK22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler" command="_2vSfgK21EeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_c0Ba4K22EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler" command="_4nv18K21EeeykrJkROy5EA"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_OyvD8KNOEee5fYT78qEx0A" featurename="children" parentElementId="bulkeditor.menus.openmenu" positionInList="last">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_SZZBkKNOEee5fYT78qEx0A" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen_editor" label="%command.label.DERIVATIVE_EDITOR" tooltip="%command.label.DERIVATIVE_EDITOR" command="_PDjFMLsKEeeQJq8FDGEi1g"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Fw06MKz0EeeBIsZyvYlAaA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.bulkeditor.popupmenu.bulkeditor" positionInList="after:eu.etaxonomy.taxeditor.bulkeditor.menuseparator.afterNew">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_JzLVUKz0EeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandname34" label="%command.name.34" command="_cxTosKzzEeeBIsZyvYlAaA"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_UH7p8K21EeeykrJkROy5EA" featurename="children" parentElementId="eu.etaxonomy.navigation.menu.new">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_dy1B8K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel46" label="%command.label.46" command="_1CaG8K21EeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_oAwOgK21EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_fC3GcK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel47" label="%command.label.47" command="_x3ecAK21EeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_o70voK21EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_iqFEwK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel1" label="%command.label.1" command="_2vSfgK21EeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_qRTU0K21EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_jlY2cK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel2" label="%command.label.2" command="_4nv18K21EeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_rxgjUK21EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ <elements xsi:type="menu:MenuSeparator" xmi:id="_lyGloK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.21"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_ZkTzEK21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel48" label="%command.label.48" command="_61IwAK20EeeykrJkROy5EA"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_v3iTkMRpEeednrXvH5DIOw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.store.menu.termeditor" positionInList="after:eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" tooltip="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_G0z2MKNxEeebGZ23ERGMGw" coreExpressionId="isCdmStoreConnectedAndShowExperimental"/>
<parameters xmi:id="_wJkmoEalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showView.parameter.charactereditor" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor"/>
</elements>
- <elements xsi:type="menu:MenuSeparator" xmi:id="_df06IJ7SEee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.13"/>
</fragments>
</fragment:ModelFragments>
</adapter>
</factory>
</extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor"
- icon="icons/edit_16x16.gif"
- id="eu.etaxonomy.taxeditor.editor.taxon"
- name="%editor.name">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor"
- default="true"
- id="eu.etaxonomy.taxeditor.editor.taxon.name"
- name="%editor.name.0">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.key.KeyEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.key"
- name="%editor.name.1">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.key.polytomous.graph"
- name="%editor.name.2">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.key.polytomous.list"
- name="%editor.name.3">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.group.authority"
- name="%editor.name.4">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor"
- name="%editor.name.6">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor"
- name="%editor.name.7">
- </editor>
- <editor
- class="eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"
- icon="icons/check.png"
- id="eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"
- name="%editor.name.8">
- </editor>
- </extension>
<extension
point="org.eclipse.ui.views">
- <view
- allowMultiple="false"
- category="eu.etaxonomy.taxeditor.editor.category"
- class="eu.etaxonomy.taxeditor.editor.view.uses.UsesViewPart"
- icon="icons/leaf.png"
- id="eu.etaxonomy.taxeditor.editor.view.uses"
- name="%view.name.0"
- restorable="true">
- </view>
- <view
- category="eu.etaxonomy.taxeditor.editor.category"
- class="eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphView"
- icon="icons/address-book-new.png"
- id="eu.etaxonomy.taxeditor.editor.view.concept.graph"
- name="%view.name.3"
- restorable="true">
- </view>
- <category
- id="eu.etaxonomy.taxeditor.editor.category"
- name="%category.name">
- </category>
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"
- name="%view.name.4">
- </view>
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifResponseImportView"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.GbifResponseImportView"
- name="%view.name.5">
- </view>
<view
allowMultiple="false"
category="eu.etaxonomy.taxeditor.editor.category"
</extension>
<extension
point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:eu.etaxonomy.navigation.menu.new?after=eu.etaxonomy.navigation.menu.new.separator1">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.name"
- label="%command.label.46"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.reference"
- label="%command.label.47"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.team"
- label="%command.label.1"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.person"
- label="%command.label.2"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.navigation.menu.new.separator2"
- visible="true">
- </separator>
- <separator
- name="eu.etaxonomy.navigation.menu.new.separator3"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.new.datasource"
- label="%command.label.48"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.store.showViewMenu.details">
- <separator
- name="eu.etaxonomy.taxeditor.editor.showViewMenu"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="%command.label.7"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.editor.view.concept.graph">
- </parameter>
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isShowExperimentalFeatures">
- </reference>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </and>
- </visibleWhen>
- </command>
- </menuContribution>
<menuContribution
locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.store.showViewMenu.internal">
<separator
</visibleWhen>
</command>
</menuContribution>
- <menuContribution
- locationURI="menu:org.eclipse.ui.main.menu.navigate">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.command.openParent"
- label="%command.label.8"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.taxon.name">
- <menu
- label="%menu.label">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym"
- label="%command.label.9"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym"
- label="%command.label.10"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup"
- label="%command.label.11"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isSynonym">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
- label="%command.label.49"
- style="push">
- <visibleWhen>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isMisapplication">
- </reference>
- </or>
- </visibleWhen>
- </command>
- </menu>
- <!--<command
- commandId="eu.etaxonomy.taxeditor.editor.name.changeAcceptedToSynonym"
- label="Change Accepted Taxon to Synonym"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isAcceptedAndHasNoHomotypicSynonyms">
- </reference>
- </visibleWhen
- <visibleWhen>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isMisapplication">
- </reference>
- </or>
- </visibleWhen>
- </command>-->
- <menu
- label="%menu.label.0">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon"
- label="%command.label.12"
- style="push">
- <visibleWhen>
- <and>
- <not>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isMisapplication">
- </reference>
- </or>
- </not>
- <reference
- definitionId="isNotHomotypicSynonymOfAcceptedTaxon">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.changeToSynonym"
- label="%command.label.13"
- style="push">
- <visibleWhen>
- <not>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isSynonym">
- </reference>
- </or>
- </not>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication"
- label="%command.label.14"
- style="push">
- <visibleWhen>
- <not>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isMisapplication">
- </reference>
- </or>
- </not>
- </visibleWhen>
- </command>
- </menu>
- <separator
- name="taxeditor-editor.separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.delete"
- label="%command.label.15"
- style="push">
- <visibleWhen>
- <or>
- <reference
- definitionId="isSynonym">
- </reference>
- <reference
- definitionId="isMisapplication">
- </reference>
- <reference
- definitionId="isConceptRelation">
- </reference>
- </or>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
- label="%command.label.16"
- style="push">
- <visibleWhen>
- <reference
- definitionId="hasEmptyNames">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-editor.separator2"
- visible="true">
- </separator>
- <!-- <dynamic
- class="eu.etaxonomy.taxeditor.editor.name.handler.GroupBasionymContributionItem"
- id="taxeditor-editor.dynamic.setBasionym">
- <visibleWhen>
- <or>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- <reference
- definitionId="isSynonym">
- </reference>
- </or>
- </visibleWhen>
- </dynamic>-->
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
- label="%command.label.17"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isSynonym">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
- label="%command.label.57"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isSynonymInHomotypicalGroupWithMoreSynonyms">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon"
- label="%command.label.56"
- style="push">
- <visibleWhen>
- <and>
- <reference
- definitionId="isSynonym">
- </reference>
- <reference
- definitionId="isNotHomotypicSynonymOfAcceptedTaxon">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-editor.separator3"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="%command.label.18"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.view.detail">
- </parameter>
- </command>
- <separator
- name="taxeditor-editor.separator4"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.save"
- label="%command.label.19"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.key.polytomous">
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new"
- label="%command.label.20"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.delete"
- label="%command.label.21"
- style="push">
- </command>
- <separator
- name="taxeditor-editor.separator2"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.key.command.applyLayout"
- label="%command.label.22"
- style="push">
- </command>
- <separator
- name="taxeditor-editor.separator3"
- visible="true">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.key.polytomous.list">
- <menu
- label="%menu.label.4">
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.node"
- label="%command.label.58"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.child"
- label="%command.label.23"
- style="push">
- </command>
- </menu>
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling"
- label="%command.label.24"
- style="push">
- </command>
- <!-- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.editor.polytomous.list.cdmViewerContextMenu">
- </dynamic>-->
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.refresh"
- label="%command.label.25"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.delete"
- label="%command.label.26"
- style="push">
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.editor.separator1">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.descriptive">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.adddescription"
- label="%command.label.27"
- style="push">
- </command>
- <menu
- label="%menu.label.1">
- <dynamic
- class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DynamicFeatureMenu"
- id="eu.etaxonomy.taxeditor.dynamicFeatureMenu">
- </dynamic>
- <visibleWhen
- checkEnabled="true">
- <or>
- <reference
- definitionId="isDescription">
- </reference>
- <reference
- definitionId="isDescriptionElement">
- </reference>
- <reference
- definitionId="isFeatureNodeContainer">
- </reference>
- </or>
- </visibleWhen>
- </menu>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator3"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon"
- label="%command.label.28"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isDescription">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements"
- label="%command.label.29"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <or>
- <reference
- definitionId="isFeatureNodeContainer">
- </reference>
- <reference
- definitionId="isDescriptionElement">
- </reference>
- </or>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.editor.separator1">
- </separator>
- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.editor.descriptive.cdmViewerContextMenu">
- </dynamic>
- <separator
- name="eu.etaxonomy.taxeditor.editor.separator1">
- </separator>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterNew"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.delete"
- label="%command.label.30"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <count
- value="+">
- </count>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterDelete"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.save"
- label="%command.label.31"
- style="push">
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.editor.separator1">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor">
- <dynamic
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorContextMenu"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorContextMenu">
- </dynamic>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.dataimport.GbifImportEditor">
- <dynamic
- class="eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorContextMenu"
- id="eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorContextMenu">
- </dynamic>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.editor.view.uses">
- <command
- commandId="eu.etaxonomy.taxeditor.use.commands.adduse"
- label="%command.label.32"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.use.createUseSummary"
- label="%command.label.33"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <or>
- <reference
- definitionId="isDescription">
- </reference>
- <reference
- definitionId="isDescriptionElement">
- </reference>
- <reference
- definitionId="isFeatureNodeContainer">
- </reference>
- </or>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.use.createUseRecord"
- label="%command.label.34"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <or>
- <reference
- definitionId="isDescription">
- </reference>
- <reference
- definitionId="isDescriptionElement">
- </reference>
- <reference
- definitionId="isFeatureNodeContainer">
- </reference>
- </or>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.usesEditor.separator3"
- visible="true">
- </separator>
- <separator
- name="taxeditor-editor.separator1"
- visible="true">
- </separator>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterNew"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.editor.use.command.delete"
- label="%command.label.35"
- style="push">
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.taxonDescriptionEditor.separator.afterDelete"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.save"
- label="%command.label.36"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:bulkeditor.editor?before=eu.etaxonomy.taxeditor.bulkeditor.separator1">
- <command
- commandId="eu.etaxonomy.taxeditor.group.cdmauthorities.edit"
- label="%command.label.45"
- style="push">
- <visibleWhen>
- <reference
- definitionId="isGroupEditor">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="toolbar:eu.etaxonomy.taxeditor.editor.view.descriptive">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
- icon="icons/link_obj.gif"
- style="toggle"
- tooltip="%command.tooltip">
- </command>
- </menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=eu.etaxonomy.taxeditor.navigation.search.toolbar">
</command>
</toolbar>
</menuContribution>
- <menuContribution
- locationURI="menu:bulkeditor.menus.openmenu">
- <command
- commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditorFromMenu"
- label="%command.label.DERIVATIVE_EDITOR"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
</count>
</enabledWhen>
</handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.name.handler.DeleteTaxonBaseHandler"
- commandId="eu.etaxonomy.taxeditor.editor.name.command.delete">
- <activeWhen>
- <and>
- <reference
- definitionId="isTaxonBase">
- </reference>
- <not>
- <reference
- definitionId="isAcceptedTaxon">
- </reference>
- </not>
- </and>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.DeleteNodeHandler"
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.delete">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.editor.key">
- </equals>
- </with>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyPropertyTester.isKeyNode">
- </test>
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
- commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.RemotingCreateChildPolytomousKeyNodeHandler"
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.child">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.InsertNewNodeHandler"
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.node">
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyPropertyTester.isKeyNode">
- </test>
-
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.RemotingCreateSiblingPolytomousKeyNodeHandler"
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.editor.key">
- </equals>
- </with>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyPropertyTester.isKeyNode">
- </test>
-
- </with>
- </enabledWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
- commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement"
- commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.editor.view.descriptive">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForTaxonNode"
- commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor">
- <activeWhen>
- <with
- variable="selection">
- <reference
- definitionId="isTaxonNode">
- </reference>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForSpecimenOrOBservationBase"
- commandId="eu.etaxonomy.taxeditor.editor.openSpecimenEditor">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="bulkeditor.editor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
- commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler">
- <activeWhen>
- <and>
- <reference
- definitionId="isChecklistEditorEnabled">
- </reference>
- <reference
- definitionId="isTaxonNode">
- </reference>
- </and>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.key.polytomous.handler.RefreshNodeNumberingHandler"
- commandId="eu.etaxonomy.taxeditor.key.polytomous.command.refresh">
- <enabledWhen>
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyPropertyTester.isKeyNode">
- </test>
- </with>
- </enabledWhen>
- </handler>
</extension>
<extension
name="%extension.name"
id="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
name="%category.name.0">
</category>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenParentHandler"
- id="eu.etaxonomy.taxeditor.editor.command.openParent"
- name="%command.name">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHomotypicSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym"
- name="%command.name.0">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateHeterotypicSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym"
- name="%command.name.1">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateSynonymInHomotypicalGroupHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup"
- name="%command.name.2">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.CreateMisapplicationHandler"
- id="eu.etaxonomy.taxeditor.editor.name.createMisapplication"
- name="%command.name.36">
- </command>
<!-- <command
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.MoveTaxonHandler"
id="eu.etaxonomy.taxeditor.editor.name.moveTaxon"
name="Move Taxon">
</command>-->
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToSynonymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToSynonym"
- name="%command.name.3">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeSynonymToAcceptedTaxonHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon"
- name="%command.name.4">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeToMisapplicationHandler"
- id="eu.etaxonomy.taxeditor.editor.name.changeToMisapplication"
- name="%command.name.5">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler"
- id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
- name="%command.name.6">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
- name="%command.name.57">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.MoveSynonymToAnotherAcceptedTaxonHandler"
- id="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon"
- name="%command.name.46">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.setBasionym"
- name="%command.name.7">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.RemoveBasionymHandler"
- id="eu.etaxonomy.taxeditor.editor.name.removeBasionym"
- name="%command.name.8">
- </command>
<!-- <command
categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.ChangeAcceptedTaxonToSynonymHandler"
id="eu.etaxonomy.taxeditor.editor.name.changeAcceptedToSynonym"
name="Change Accepted Taxon to Synonym">
</command>-->
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteTaxonBaseHandler"
- id="eu.etaxonomy.taxeditor.editor.name.delete"
- name="%command.name.45">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.DeleteAllEmptyNamesHandler"
- id="eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames"
- name="%command.name.9">
- </command>
<category
id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.category"
name="%category.name.1">
id="eu.etaxonomy.taxeditor.editor.view.uses.command.category"
name="%category.name.2">
</category>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.view.uses.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.view.uses.handler.CreateUseHandler"
- id="eu.etaxonomy.taxeditor.use.commands.adduse"
- name="%command.name.14">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.view.uses.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.view.uses.handler.CreateUseRecordHandler"
- id="eu.etaxonomy.taxeditor.editor.use.createUseRecord"
- name="%command.name.16">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.view.uses.command.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.view.uses.handler.CreateUseSummaryHandler"
- id="eu.etaxonomy.taxeditor.editor.use.createUseSummary"
- name="%command.name.15">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.editor.use.command.delete"
- name="%command.name.47">
- </command>
<category
id="eu.etaxonomy.taxeditor.editor.media.category"
name="%category.name.3">
id="eu.etaxonomy.taxeditor.editor.new.category"
name="%category.name.4">
</category>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.create.NewReferenceHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.reference"
- name="%command.name.23">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.create.NewNameHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.name"
- name="%command.name.24">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.create.NewTeamHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.team"
- name="%command.name.25">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.create.NewPersonHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.person"
- name="%command.name.26">
- </command>
- <category
- id="eu.etaxonomy.taxeditor.editor.key.category"
- name="%category.name.5">
- </category>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
-
- id="eu.etaxonomy.taxeditor.key.polytomous.command.new.child"
- name="%command.name.28">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
-
- id="eu.etaxonomy.taxeditor.key.polytomous.command.new.node"
- name="%command.name.58">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
- id="eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling"
- name="%command.name.29">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
-
- id="eu.etaxonomy.taxeditor.key.polytomous.command.refresh"
- name="%command.name.30">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.key.handler.ApplyLayoutHandler"
- id="eu.etaxonomy.taxeditor.key.command.applyLayout"
- name="%command.name.31">
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.key.category"
- id="eu.etaxonomy.taxeditor.key.polytomous.command.delete"
- name="%command.name.50">
- </command>
<category
id="eu.etaxonomy.taxeditor.editor.view.concept.category"
name="%category.name.6">
id="eu.etaxonomy.taxeditor.bulkeditor.group.category"
name="%category.name.7">
</category>
- <command
- categoryId="eu.etaxonomy.taxeditor.bulkeditor.group.category"
- defaultHandler="eu.etaxonomy.taxeditor.editor.group.authority.handler.EditCdmAuthoritiesHandler"
- id="eu.etaxonomy.taxeditor.group.cdmauthorities.edit"
- name="%command.name.34">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"
- name="%command.name.38">
- <commandParameter
- id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler.uuid"
- name="taxonNodeUuid"
- optional="true"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
- <command
- categoryId="eu.etaxonomy.taxeditor.editor.new.category"
- defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.CreateDataSourceHandler"
- id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
- name="%command.name.39">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
- name="%command.name.41">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"
- name="%command.name.42">
- <commandParameter
- id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon.uuid"
- name="%commandParameter.name"
- optional="false"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonNodeHandler"
- id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode"
- name="%command.name.OPEN_NAME_EDITOR_FOR_TAXON_NODE">
- <commandParameter
- id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode.uuid"
- name="taxon node uuid"
- optional="true"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
<command
defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
id="eu.etaxonomy.taxeditor.editor.openSpecimenEditorFromMenu"
name="%command.name.OPEN_DERIVATIVE_EDITOR">
</command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler"
- id="eu.etaxonomy.taxeditor.openSpecimenEditorForTypeSpecimen"
- name="%command.name.OPEN_EDITOR_FOR_TYPE_SPECIMEN">
- </command>
</extension>
<extension
type="java.lang.Object">
</propertyTester>
<propertyTester
- class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DescriptionsMenuPropertyTester"
+ class="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DescriptionsMenuPropertyTesterE4"
id="eu.etaxonomy.taxeditor.descriptions.propertyTester"
namespace="eu.etaxonomy.taxeditor.descriptions.propertyTester"
properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery,isTaxonEditor,isBulkEditor,isDerivateEditor, isIndividualsAssociation"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
--- /dev/null
+package eu.etaxonomy.taxeditor.editor;
+
+public class AppModelId {
+ public static final String COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_OPENCHECKLISTVIEW_UUID = "eu.etaxonomy.taxeditor.editor.handler.OpenChecklistView.uuid";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_OPENBULKEDITORFORIDENTIFIABLEENTITY = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENPART = "eu.etaxonomy.taxeditor.command.openPart";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_CONSENSUS_SEQUENCE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_consensus_sequence";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_DNA_SAMPLE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_dna_sample";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_EXISTING_MEDIA_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_existing_media_specimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_MEDIA_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_media_specimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_SINGLE_READ = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_single_read";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_specimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_TISSUE_SAMPLE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_tissue_sample";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_POLYTOMOUSKEYLIST_OPENGRAPH = "eu.etaxonomy.taxeditor.editor.command.polytomouskeylist.openGraph";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_SPECIMENEDITOR_CREATE_FIELD_UNIT = "eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATE_DEEPDELETE = "eu.etaxonomy.taxeditor.editor.derivate.deepDelete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATE_DELETE = "eu.etaxonomy.taxeditor.editor.derivate.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_COPYSINGLEREADTOCLIPBOARD = "eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_REMOVESINGLEREADFROMSEQUENCE = "eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_REUSESINGLEREAD = "eu.etaxonomy.taxeditor.editor.derivative.reuseSingleRead";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_TOGGLELINKWITHTAXONSELECTION = "eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_OPENCHECKLISTVIEWHANDLER = "eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_SHOWONLYINDIVIDUALASSOCIATIONS = "eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.media.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_MOVEIMGDOWN = "eu.etaxonomy.taxeditor.editor.media.command.moveimgdown";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_MOVEIMGUP = "eu.etaxonomy.taxeditor.editor.media.command.moveimgup";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_NEWIMAGE = "eu.etaxonomy.taxeditor.editor.media.command.newimage";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_NEWIMAGEGALLERY = "eu.etaxonomy.taxeditor.editor.media.command.newimagegallery";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_USEEXISTINGIMAGE = "eu.etaxonomy.taxeditor.editor.media.command.useExistingImage";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CHANGETOACCEPTEDTAXON = "eu.etaxonomy.taxeditor.editor.name.changeToAcceptedTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CHANGETOMISAPPLICATION = "eu.etaxonomy.taxeditor.editor.name.changeToMisapplication";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CHANGETOSYNONYM = "eu.etaxonomy.taxeditor.editor.name.changeToSynonym";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CREATECONCEPTRELATION = "eu.etaxonomy.taxeditor.editor.name.createConceptRelation";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CREATEHETEROTYPICSYNOYM = "eu.etaxonomy.taxeditor.editor.name.createHeterotypicSynoym";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CREATEHOMOTYPICSYNOYM = "eu.etaxonomy.taxeditor.editor.name.createHomotypicSynoym";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CREATEMISAPPLICATION = "eu.etaxonomy.taxeditor.editor.name.createMisapplication";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_CREATESYNONYMINHOMOTYPICALGROUP = "eu.etaxonomy.taxeditor.editor.name.createSynonymInHomotypicalGroup";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_DELETE = "eu.etaxonomy.taxeditor.editor.name.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_DELETEALLEMPTYNAMES = "eu.etaxonomy.taxeditor.editor.name.deleteAllEmptyNames";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_MOVESYNONYMTOANOTHERACCEPTEDTAXON = "eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_SETASBASIONYM = "eu.etaxonomy.taxeditor.editor.name.setAsBasionym";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_SWAPSYNONYMANDACCEPTED = "eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_OPENBULKEDITORFORTAXONRELATIONSHIP = "eu.etaxonomy.taxeditor.editor.openBulkEditorForTaxonRelationship";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_OPENSPECIMENEDITOR = "eu.etaxonomy.taxeditor.editor.openSpecimenEditor";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_OPENTAXONEDITORFORTAXON = "eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_OPENTAXONEDITORFORTAXONNODE = "eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_USE_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.use.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_USE_CREATEUSERECORD = "eu.etaxonomy.taxeditor.editor.use.createUseRecord";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_USE_CREATEUSESUMMARY = "eu.etaxonomy.taxeditor.editor.use.createUseSummary";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.view.concept.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_COMMAND_OPEN = "eu.etaxonomy.taxeditor.editor.view.concept.command.open";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_ADDDESCRIPTION = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.adddescription";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_CREATEDESCRIPTIONELEMENT = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.createDescriptionElement";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_MOVEDESCRIPTIONELEMENTS = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_MOVEDESCRIPTIONTOTAXON = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_GROUP_CDMAUTHORITIES_EDIT = "eu.etaxonomy.taxeditor.group.cdmauthorities.edit";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_COMMAND_APPLYLAYOUT = "eu.etaxonomy.taxeditor.key.command.applyLayout";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_POLYTOMOUS_COMMAND_NEW_CHILD = "eu.etaxonomy.taxeditor.key.polytomous.command.new.child";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_POLYTOMOUS_COMMAND_NEW_NODE = "eu.etaxonomy.taxeditor.key.polytomous.command.new.node";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_POLYTOMOUS_COMMAND_NEW_SIBLING = "eu.etaxonomy.taxeditor.key.polytomous.command.new.sibling";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_POLYTOMOUS_COMMAND_REFRESH = "eu.etaxonomy.taxeditor.key.polytomous.command.refresh";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_KEY_POLYTOMOUS_DELETE = "eu.etaxonomy.taxeditor.key.polytomous.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_OPENSPECIMENEDITORFORTYPESPECIMEN = "eu.etaxonomy.taxeditor.openSpecimenEditorForTypeSpecimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_FEATURETREE_REMOVEFEATURE = "eu.etaxonomy.taxeditor.store.command.featureTree.removeFeature";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_USE_COMMANDS_ADDUSE = "eu.etaxonomy.taxeditor.use.commands.adduse";
+ public static final String COMMAND_ORG_ECLIPSE_UI_FILE_SAVE = "org.eclipse.ui.file.save";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_CONCEPT_DYNAMICMENUCONTRIBUTION_CDMVIEWER = "eu.etaxonomy.taxeditor.editor.concept.dynamicmenucontribution.cdmViewer";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_DYNAMICMENUCONTRIBUTION_2 = "eu.etaxonomy.taxeditor.editor.dynamicmenucontribution.2";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUAL_DYNAMICMENUCONTRIBUTION_CDMVIEWER = "eu.etaxonomy.taxeditor.editor.factual.dynamicmenucontribution.cdmViewer";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_SPECIMENEDITOR_DYNAMICMENUCONTRIBUTION_CDMVIEWER = "eu.etaxonomy.taxeditor.editor.specimeneditor.dynamicmenucontribution.cdmViewer";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_DYNAMICFEATUREMENUE4 = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DynamicFeatureMenuE4";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_DELETE = "eu.etaxonomy.taxeditor.editor.factualData.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_MOVEDESCRIPTIONELEMENT = "eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionElement";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_MOVEDESCRIPTIONTOTAXON = "eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionToTaxon";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_ADDEXISTINGIMAGE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.addExistingImage";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABEL44 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel44";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABEL52 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel52";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABEL54 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel54";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELLINK_WITH_TAXON_SELECTION = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabellink_with_taxon_selection";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELREMOVE_SINGLE_READ_FROM_THIS_SEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabelremove_single_read_from_this_sequence";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELREUSE_SINGLE_READ_FOR_OTHER_SEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabelreuse_single_read_for_other_sequence";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDNAME34 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandname34";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDNAMEREUSE_SINGLE_READ = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandnamereuse_single_read";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONCEPT_DELETE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONCEPT_NEWUSE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUse";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONCEPT_NEWUSERECORD = "eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUseRecord";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONCEPT_NEWUSESUMMARY = "eu.etaxonomy.taxeditor.editor.handledmenuitem.concept.newUseSummary";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONSENSUSSEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.consensussequence";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CREATEFIELDUNIT = "eu.etaxonomy.taxeditor.editor.handledmenuitem.createfieldunit";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CREATE_FIELD_UNIT_FOR_TAXON = "eu.etaxonomy.taxeditor.editor.handledmenuitem.create_field_unit_for_taxon";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_DELETEMEDIA = "eu.etaxonomy.taxeditor.editor.handledmenuitem.deleteMedia";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_DNASAMPLE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.dnasample";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_EXISTINGMEDIA = "eu.etaxonomy.taxeditor.editor.handledmenuitem.existingmedia";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_FACTUALDATA_ADDDESCRIPTION = "eu.etaxonomy.taxeditor.editor.handledmenuitem.factualData.addDescription";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_KEYGRAPH_APPLYLAYOUT = "eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.applylayout";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_KEYGRAPH_DELETE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_KEYGRAPH_NEWNODE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.keygraph.newnode";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MEDIASPECIMEN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.mediaspecimen";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MOVEIMAGEDOWN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.moveImageDown";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MOVEIMAGEUP = "eu.etaxonomy.taxeditor.editor.handledmenuitem.moveImageUp";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_NEWIMAGE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.newImage";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_NEWIMAGEGALLERY = "eu.etaxonomy.taxeditor.editor.handledmenuitem.newImageGallery";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_OPENGRAPH = "eu.etaxonomy.taxeditor.editor.handledmenuitem.opengraph";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_POLYTOMOUSKEYLIST_DELETE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_POLYTOMOUSKEYLIST_NEWALTERNATIVE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.newAlternative";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_POLYTOMOUSKEYLIST_NEW_AFTERCURRENT = "eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.new.aftercurrent";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_POLYTOMOUSKEYLIST_NEW_INSERTNODE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.new.insertNode";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_POLYTOMOUSKEYLIST_REFRESHNODES = "eu.etaxonomy.taxeditor.editor.handledmenuitem.polytomouskeylist.refreshNodes";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_REMOVECHARACTER = "eu.etaxonomy.taxeditor.editor.handledmenuitem.removecharacter";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_SINGLEREAD = "eu.etaxonomy.taxeditor.editor.handledmenuitem.singleread";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_SPECIMEN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_SPECIMEN_EDITOR = "eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen_editor";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_TISSUESAMPLE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.tissuesample";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITORPOPUP_DETAILS = "eu.etaxonomy.taxeditor.editor.nameEditorPopup.details";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_CHANGETOACCEPTED = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_CHANGETOMISAPPLICATION = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_DELETE = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_DELETEEMPTYNAMES = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.deleteEmptyNames";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_MOVESYNONYM = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.moveSynonym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_NEWHETEROTYPICSYNONYM = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_NEWHOMOTYPICSYNONYM = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_NEWMISAPPLICATION = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_NEWSYNONYMINHOMOTYPICGROUP = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newSynonymInHomotypicGroup";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_SETASBASIONYM = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.setAsBasionym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENUITEM_SWAPSYNONYMWITHACCPETED = "eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.swapSynonymWithAccpeted";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_NAMEEDITOR_MENUITEM_CHANGETOSYNONYM = "eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_CONCEPT = "eu.etaxonomy.taxeditor.editor.showViewMenu.concept";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_CONCEPTGRAPH = "eu.etaxonomy.taxeditor.editor.showViewMenu.conceptGraph";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_FACTUALDATA = "eu.etaxonomy.taxeditor.editor.showViewMenu.factualData";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.showViewMenu.mediaView";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_HANDLER_DEFAULTHANDLER_OPENBULKEDITORFORIDENTIFIABLEENTITYE4 = "eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDSPECIMENHANDLER = "eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSpecimenHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_SAVEHANDLER = "eu.etaxonomy.taxeditor.editor.factualData.saveHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_GROUP_AUTHORITY_E4_HANDLER_EDITCDMAUTHORITIESHANDLERE4 = "eu.etaxonomy.taxeditor.editor.group.authority.e4.handler.EditCdmAuthoritiesHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_0 = "eu.etaxonomy.taxeditor.editor.handler.0";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_1 = "eu.etaxonomy.taxeditor.editor.handler.1";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_DEFAULTHANDLER_DEFAULTOPENSPECIMENEDITORFORTYPESPECIMENHANDLER = "eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenSpecimenEditorForTypeSpecimenHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_DEFAULTHANDLER_DEFAULTOPENTAXONEDITORFORTAXONBASEHANDLER = "eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonBaseHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLER_DEFAULTHANDLER_DEFAULTOPENTAXONEDITORFORTAXONNODEHANDLER = "eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonNodeHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_E4_HANDLER_APPLYLAYOUTHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.e4.handler.ApplyLayoutHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_HANDLER_CREATECHILDNODEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateChildNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_HANDLER_CREATESIBLINGNODEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.CreateSiblingNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_HANDLER_DELETENODEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.DeleteNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_HANDLER_INSERTNEWNODEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.InsertNewNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_HANDLER_REFRESHNODENUMBERINGHANDLERE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler.RefreshNodeNumberingHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_HANDLER_SAVEHANDLER = "eu.etaxonomy.taxeditor.editor.nameEditor.handler.SaveHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CHANGESYNONYMTOACCEPTEDTAXONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeSynonymToAcceptedTaxonHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CHANGETOMISAPPLICATIONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToMisapplicationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CHANGETOSYNONYMHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.ChangeToSynonymHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CREATEHETEROTYPICSYNONYMHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHeterotypicSynonymHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CREATEHOMOTYPICSYNONYMHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateHomotypicSynonymHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CREATEMISAPPLICATIONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateMisapplicationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_CREATESYNONYMINHOMOTYPICALGROUPHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.CreateSynonymInHomotypicalGroupHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_DELETEALLEMPTYNAMESHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteAllEmptyNamesHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_DELETETAXONBASEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.DeleteTaxonBaseHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_MOVESYNONYMTOANOTHERACCEPTEDTAXONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_SETBASIONYMHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.SetBasionymHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_HANDLER_SWAPSYNONYMANDACCEPTEDHANDLERE4 = "eu.etaxonomy.taxeditor.editor.name.e4.handler.SwapSynonymAndAcceptedHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_HANDLER_OPENCHECKLISTEDITORHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.checklist.e4.handler.OpenChecklistEditorHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_HANDLER_CREATECONCEPTRELATIONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.CreateConceptRelationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_HANDLER_DELETECONCEPTRELATIONHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.DeleteConceptRelationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_HANDLER_OPENRELATEDCONCEPTINBULKEDITORHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.concept.e4.handler.OpenRelatedConceptInBulkEditorHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDCONSENSUSSEQUENCEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddConsensusSequenceHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDDNASAMPLEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddDnaSampleHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDEXISTINGMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddExistingMediaHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDMEDIASPECIMENHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddMediaSpecimenHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDSINGLEREADHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSingleReadHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDTISSUESAMPLEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddTissueSampleHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_CREATEFIELDUNITHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_DELETEDERIVATEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_OPENDERIVATIVEEDITORFORDESCRIPTIONELEMENT = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForDescriptionElement";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_OPENDERIVATIVEEDITORFORSPECIMENOROBSERVATIONBASE = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForSpecimenOrOBservationBase";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SAVEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SaveHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_COPYSINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.copySingleRead";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_REMOVESINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.removeSingleRead";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_REUSESINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.reuseSingleRead";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_TOGGLELINKWITHTAXONSELECTIONHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.ToggleLinkWithTaxonSelectionHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_CREATEDESCRIPTIONELEMENTHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_CREATEDESCRIPTIONHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_DELETEHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_MOVEDESCRIPTIONELEMENTSHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionElementsHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_MOVEDESCRIPTIONTOOTHERTAXONHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionToOtherTaxonHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_TOGGLESHOWONLYINDIVIDUALASSOCIATIONSHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.ToggleShowOnlyIndividualAssociationsHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_ADDEXISTINGMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.AddExistingMediaHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_ADDIMAGEGALLERYHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.AddImageGalleryHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_CREATEMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.CreateMediaHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_DELETEMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.DeleteMediaHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_MOVEIMAGEDOWNINLISTHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.MoveImageDownInListHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_MOVEIMAGEUPINLISTHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.MoveImageUpInListHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_USES_E4_HANDLER_CREATEUSEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_USES_E4_HANDLER_CREATEUSERECORDHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseRecordHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_USES_E4_HANDLER_CREATEUSESUMMARYHANDLERE4 = "eu.etaxonomy.taxeditor.editor.view.uses.e4.handler.CreateUseSummaryHandlerE4";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_0 = "eu.etaxonomy.taxeditor.editor.menuseparator.0";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_1 = "eu.etaxonomy.taxeditor.editor.menuseparator.1";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_10 = "eu.etaxonomy.taxeditor.editor.menuseparator.10";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_11 = "eu.etaxonomy.taxeditor.editor.menuseparator.11";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_12 = "eu.etaxonomy.taxeditor.editor.menuseparator.12";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_13 = "eu.etaxonomy.taxeditor.editor.menuseparator.13";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_14 = "eu.etaxonomy.taxeditor.editor.menuseparator.14";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_15 = "eu.etaxonomy.taxeditor.editor.menuseparator.15";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_16 = "eu.etaxonomy.taxeditor.editor.menuseparator.16";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_17 = "eu.etaxonomy.taxeditor.editor.menuseparator.17";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_18 = "eu.etaxonomy.taxeditor.editor.menuseparator.18";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_19 = "eu.etaxonomy.taxeditor.editor.menuseparator.19";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_2 = "eu.etaxonomy.taxeditor.editor.menuseparator.2";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_20 = "eu.etaxonomy.taxeditor.editor.menuseparator.20";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_3 = "eu.etaxonomy.taxeditor.editor.menuseparator.3";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_4 = "eu.etaxonomy.taxeditor.editor.menuseparator.4";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_5 = "eu.etaxonomy.taxeditor.editor.menuseparator.5";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_6 = "eu.etaxonomy.taxeditor.editor.menuseparator.6";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_7 = "eu.etaxonomy.taxeditor.editor.menuseparator.7";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_8 = "eu.etaxonomy.taxeditor.editor.menuseparator.8";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_9 = "eu.etaxonomy.taxeditor.editor.menuseparator.9";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_BEFOREDELETE = "eu.etaxonomy.taxeditor.editor.menuseparator.beforeDelete";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_ADD = "eu.etaxonomy.taxeditor.editor.menu.add";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_POLYTOMOUSKEYLIST_NEWKEYNUMBER = "eu.etaxonomy.taxeditor.editor.menu.polytomouskeylist.newkeynumber";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_SPECIMEN_EDITOR_MEDIA = "eu.etaxonomy.taxeditor.editor.menu.specimen_editor.media";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENU_CHANGETO = "eu.etaxonomy.taxeditor.editor.nameEditor.menu.changeTo";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAMEEDITOR_MENU_NEW = "eu.etaxonomy.taxeditor.editor.nameEditor.menu.new";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.showView.parameter.charactereditor";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_CONCEPTGRAPH = "eu.etaxonomy.taxeditor.editor.showView.parameter.conceptGraph";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_CONCEPTVIEW = "eu.etaxonomy.taxeditor.editor.showView.parameter.conceptview";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_FACTUALVIEW = "eu.etaxonomy.taxeditor.editor.showView.parameter.factualview";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.showView.parameter.mediaview";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_SPECIMENEDITOR = "eu.etaxonomy.taxeditor.editor.showView.parameter.specimenEditor";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_DETAILSVIEW = "eu.etaxonomy.taxeditor.store.showView.parameter.detailsView";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_GROUP_AUTHORITY_E4_CDMAUTHORITYEDITORE4 = "eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYGRAPHEDITORE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYLISTEDITORE4 = "eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_NAME_E4_TAXONNAMEEDITORE4 = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_CHECKLISTEDITORE4 = "eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_E4_CONCEPTVIEWPARTE4 = "eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CONCEPT_GRAPH_E4_CONCEPTGRAPHVIEWE4 = "eu.etaxonomy.taxeditor.editor.view.concept.graph.e4.ConceptGraphViewE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4 = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4 = "eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_USES = "eu.etaxonomy.taxeditor.editor.view.uses";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_WORKINGSET_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_CONCEPTVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.conceptview";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_FACTUALDATAVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.factualDataView";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.mediaview";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_NAMEEDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_POLYTOMOUSKEYGRAPHEDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeygrapheditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_POLYTOMOUSKEYLISTEDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeylisteditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_SPECIMENEDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.specimeneditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_USESVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.usesView";
+}
\ No newline at end of file
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPersistable;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.concept.ConceptViewPart;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
-import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
-
-/**
- * <p>EditorStateManager class.</p>
- *
- * @author n.hoffmann
- * @created Sep 30, 2010
- * @version 1.0
- */
-public class EditorStateManager extends ContextListenerAdapter {
-
- private static final String EDITORS = "editors"; //$NON-NLS-1$
-
- private static final String EDITOR = "editor"; //$NON-NLS-1$
-
- private TaxonEditorInputFactory inputFactory;
-
- /**
- * <p>Constructor for EditorStateManager.</p>
- */
- public EditorStateManager() {
- inputFactory = new TaxonEditorInputFactory();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
- /** {@inheritDoc} */
- @Override
- public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
- saveEditorState(memento);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
- /** {@inheritDoc} */
- @Override
- public void contextStop(IMemento memento, IProgressMonitor monitor) {
- EditorUtil.closeAll();
- resetConstantViews();
- }
-
- /**
- *
- */
- private void resetConstantViews() {
- AbstractCdmEditorViewPart descriptiveView = (AbstractCdmEditorViewPart) EditorUtil.getView(DescriptiveViewPart.ID, false);
- AbstractCdmEditorViewPart mediaView = (AbstractCdmEditorViewPart) EditorUtil.getView(MediaViewPart.ID, false);
- AbstractCdmEditorViewPart conceptView = (AbstractCdmEditorViewPart) EditorUtil.getView(ConceptViewPart.ID, false);
-
- if(descriptiveView != null){
- descriptiveView.showEmptyPage();
- }
- if(mediaView != null){
- mediaView.showEmptyPage();
- }
- if(conceptView != null){
- conceptView.showEmptyPage();
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
- /** {@inheritDoc} */
- @Override
- public void contextStart(IMemento memento, IProgressMonitor monitor) {
- restoreEditors(memento, monitor);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextRefresh(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void contextRefresh(IProgressMonitor monitor) {
- refreshEditors(monitor);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#workbenchShutdown(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
- /** {@inheritDoc} */
- @Override
- public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
- saveEditorState(memento);
- }
-
- /**
- * Reads taxon node UUIDs from the given memento and tries to open an editor
- * for each of the found UUIDs.
- *
- * @param memento
- */
- private void restoreEditors(final IMemento memento, IProgressMonitor monitor){
- if(memento == null){
- return;
- }
-
- IProgressMonitor subProgressMonitor = EditorUtil.getSubProgressMonitor(monitor, 1);
-
- IMemento editorMementos = memento.getChild(EDITORS);
- IMemento[] editorInputs = editorMementos.getChildren(EDITOR);
-
- String taskName = Messages.EditorStateManager_RESTORE_EDITORS;
- subProgressMonitor.beginTask(taskName, 1 + editorInputs.length * 2);
- subProgressMonitor.subTask(taskName);
- subProgressMonitor.worked(1);
-
- for(IMemento editorInput : editorInputs){
- TaxonEditorInput input = (TaxonEditorInput) inputFactory.createElement(editorInput);
- subProgressMonitor.worked(1);
- if(!subProgressMonitor.isCanceled() && input != null){
- try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(getClass(), Messages.EditorStateManager_ERROR_OPEN_WINDOW, e);
- }
- }
- subProgressMonitor.worked(1);
- }
- subProgressMonitor.done();
- }
-
- /**
- * @param monitor
- */
- private void refreshEditors(IProgressMonitor monitor) {
- IProgressMonitor subProgressMonitor = EditorUtil.getSubProgressMonitor(monitor, 1);
-
- Set<IEditorPart> openEditors = EditorUtil.getOpenEditors();
-
-
- subProgressMonitor.beginTask(Messages.EditorStateManager_REFRESH_EDITOR, openEditors.size() * 2);
-
- Set<UUID> uuids = new HashSet<UUID>();
-
- for(IEditorPart editor : openEditors){
- if(editor instanceof MultiPageTaxonEditor){
- try {
- uuids.add(((TaxonEditorInput) editor.getEditorInput()).getTaxonNode().getUuid());
-
-// ((MultiPageTaxonEditor) editor).close(false);
- EditorUtil.close((MultiPageTaxonEditor)editor);
- subProgressMonitor.worked(1);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- for(UUID uuid : uuids){
- try {
- EditorUtil.openTaxonNode(uuid);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- subProgressMonitor.worked(1);
- }
-
- subProgressMonitor.done();
- }
-
- /**
- * Saves the UUIDs
- *
- * @param memento
- */
- private void saveEditorState(IMemento memento){
- if(memento == null){
- return;
- }
-
- Set<IEditorPart> editors = EditorUtil.getOpenEditors();
-
- IMemento editorMementos = memento.createChild(EDITORS);
-
- for(IEditorPart editor : editors){
- IEditorInput input = editor.getEditorInput();
- if(input instanceof IPersistable){
- IMemento editorMemento = editorMementos.createChild(EDITOR);
- ((IPersistable) input).saveState(editorMemento);
- }
- }
- }
-}
package eu.etaxonomy.taxeditor.editor;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Collection;
import java.util.UUID;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.common.ITreeNode;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
-import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
-import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* Utility for the editor package
*/
public class EditorUtil extends AbstractUtility {
- private static boolean isSaving = false;
-
- /**
- * Opens a new editor window with the given input
- *
- * @param input
- * @param editorId
- * @return
- * @return
- * @throws PartInitException
- */
- private static IEditorPart open(final IEditorInput input,
- final String editorId) throws PartInitException {
- IEditorPart editor = getActivePage().openEditor(input, editorId);
- if(input != null &&
- editor.getEditorInput() != null &&
- input != editor.getEditorInput() &&
- input instanceof CdmEntitySessionInput) {
- ((CdmEntitySessionInput)input).dispose();
- }
- return editor;
- }
-
- /**
- * Opens a new editor window with the given TaxonEditorInput
- *
- * @param input
- * a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput}
- * object.
- * @throws org.eclipse.ui.PartInitException
- * if any.
- */
- public static void open(TaxonEditorInput input) throws PartInitException {
- open(input, MultiPageTaxonEditor.ID);
- }
-
- public static void open(PolytomousKeyEditorInput input)
- throws PartInitException {
- open(input, KeyEditor.ID);
- }
-
- public static void open(CdmAuthorityEditorInput input)
- throws PartInitException {
- open(input, CdmAuthorityEditor.ID);
- }
-
- /**
- * Opens a new ChecklistView for the given input
- * @param input a {@link ChecklistEditorInput} representing the selected checklist
- * @throws PartInitException
- */
- public static void open(ChecklistEditorInput input)
- throws PartInitException {
- open(input, ChecklistEditor.ID);
- }
+ private static final String NAME_EDITOR_ID = "eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4";
+ private static boolean isSaving = false;
/**
* Opens a new {@link DataImportEditor} for the given input
// }
// }
- /**
- * Taxon Editors may be opened by supplying a taxon node uuid. Session gets
- * initialised here and is passed to the editor
- *
- * @param taxonNodeUuid
- * a {@link java.util.UUID} object.
- * @throws java.lang.Exception
- * if any.
- */
- public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
- TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
- open(input);
+ public static void openSpecimenEditor(DerivateViewEditorInput input, EModelService modelService, EPartService partService, MApplication application){
+ MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ DerivateView derivateView = (DerivateView) part.getObject();
+ derivateView.init(input);
+ }
+
+ public static void openTaxonNodeE4(UUID taxonNodeUuid, EModelService modelService, EPartService partService, MApplication application) {
+ TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
+ openNameEditor_internal(input, modelService, partService, application);
}
- /**
- * <p>
- * openTaxonBase
- * </p>
- *
- * @param taxonBaseUuid
- * a {@link java.util.UUID} object.
- * @throws org.eclipse.ui.PartInitException
- * if any.
- */
- public static void openTaxonBase(UUID taxonBaseUuid)
- throws PartInitException {
- TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
- if (taxonBase != null && taxonBase.isOrphaned()) {
+ public static void openTaxonBaseE4(UUID taxonBaseUuid, EModelService modelService, EPartService partService, MApplication application) {
+ TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
+ openNameEditor_internal(input, modelService, partService, application);
+ }
+
+ public static void openTaxonBaseE4(UUID taxonBaseUuid) {
+ //FIXME E4 this can probably be removed when fully migrated
+ TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
+
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+ EModelService modelService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EModelService.class);
+ openNameEditor_internal(input, modelService, partService, null);
+ }
+
+ private static void openNameEditor_internal(TaxonEditorInputE4 input, EModelService modelService, EPartService partService, MApplication application) {
+ TaxonBase taxonBase = input.getTaxon();
+ if(taxonBase==null){
+ return;
+ }
+ if (taxonBase.isOrphaned()) {
if(taxonBase.isInstanceOf(Synonym.class)){
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
return;
}
else{
- MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
+ MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
return;
}
}
- TaxonEditorInput input = TaxonEditorInput
- .NewInstanceFromTaxonBase(taxonBaseUuid);
- if(input!=null && input.getTaxonNode()!=null){
- open(input);
- }
- }
- /**
- * <p>
- * findEditorByTaxonNodeUuid
- * </p>
- *
- * @param taxonNodeUuid
- * a {@link java.util.UUID} object.
- * @return a {@link org.eclipse.ui.IEditorPart} object.
- * @throws java.lang.Exception
- * if any.
- */
- public static IEditorPart findEditorByTaxonNodeUuid(UUID taxonNodeUuid)
- throws Exception {
- IEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
- return getActivePage().findEditor(input);
- }
+ Collection<MPart> parts = partService.getParts();
+ //check if part is already opened
+ for (MPart part : parts) {
+ if(part.getObject() instanceof TaxonNameEditorE4
+ && ((TaxonNameEditorE4) part.getObject()).getTaxon()!=null
+ && ((TaxonNameEditorE4) part.getObject()).getTaxon().equals(input.getTaxon())){
+ //close part to invoke refresh for new part
+ partService.hidePart(part);
+ break;
+ }
+ }
+ MPart part = partService.createPart(NAME_EDITOR_ID);
+
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
+ }
/**
* An uninitialized taxon is one that hasn't been saved yet. As such, it
* should appear in neither the list of recent names nor in the taxonomic
* tree when opened.
*
- * @throws org.eclipse.ui.PartInitException
- * if any.
* @param parentNodeUuid
* a {@link java.util.UUID} object.
*/
- public static void openEmpty(UUID parentNodeUuid) throws PartInitException {
- TaxonEditorInput input = TaxonEditorInput
+ public static void openEmptyE4(UUID parentNodeUuid) {
+ TaxonEditorInputE4 input = TaxonEditorInputE4
.NewEmptyInstance(parentNodeUuid);
- open(input, MultiPageTaxonEditor.ID);
-
- getActiveMultiPageTaxonEditor().changed(null);
-
+ EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+ MPart part = partService.createPart(NAME_EDITOR_ID);
+ part = partService.showPart(part, PartState.ACTIVATE);
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+ editor.init(input);
}
/**
return isSaving;
}
- /**
- * Returns a set of all currently open <code>MultiPageTaxonEditor</code>s.
- *
- * @return a {@link java.util.Set} object.
- */
- public static Set<IEditorPart> getOpenEditors() {
- Set<IEditorPart> taxonEditors = new HashSet<IEditorPart>();
-
- if (getActivePage() != null) {
- for (IEditorReference reference : getActivePage()
- .getEditorReferences()) {
- IEditorPart editor = reference.getEditor(false);
- if (editor instanceof MultiPageTaxonEditor) {
- taxonEditors.add(editor);
- }
- }
- }
-
- return taxonEditors;
- }
-
- /**
- * Returns the currently active taxon editor
- *
- * @return the taxon editor that has focus
- */
- public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor() {
- Object editorPart = getActiveE4Editor();
- if (editorPart != null && editorPart instanceof MultiPageTaxonEditor) {
- MultiPageTaxonEditor editor = (MultiPageTaxonEditor) editorPart;
- editor.getConversationHolder().bind();
- return editor;
- }
- return null;
- }
-
- /**
- * <p>
- * getActiveEditorPage
- * </p>
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @return a {@link org.eclipse.ui.IEditorPart} object.
- */
- public static IEditorPart getActiveEditorPage(Page page) {
- MultiPageTaxonEditor editor = getActiveMultiPageTaxonEditor();
-
- return editor != null ? editor.getPage(page) : null;
- }
-
- /**
- * Returns the selection of the currently active taxon editor
- *
- * @return a {@link org.eclipse.jface.viewers.ISelection} object.
- */
- public static ISelection getCurrentSelection() {
- if (getActiveMultiPageTaxonEditor() == null) {
- return null;
- } else {
- return getActiveMultiPageTaxonEditor().getSite()
- .getSelectionProvider().getSelection();
- }
- }
-
- /**
- * <p>
- * getUndoContext
- * </p>
- *
- * @param editor
- * a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
- * object.
- * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
- * object.
- */
- public static IUndoContext getUndoContext(MultiPageTaxonEditor editor) {
- return editor.getUndoContext();
- }
-
/**
* <p>
* getUndoContext
return true;
}
+ public static boolean forceUserSaveE4Editor(TaxonNameEditorE4 editor, Shell shell) {
+ if (editor.isDirty()) {
+
+ boolean doSave = MessageDialog
+ .openConfirm(shell, Messages.EditorUtil_COMFIRM_SAVE,
+ Messages.EditorUtil_CONFIRM_SAVE_MESSAGE);
+
+ if (!doSave) {
+ return false;
+ }
+
+ editor.save(AbstractUtility.getMonitor());
+ }
+ return true;
+ }
+
/**
* <p>
* getSelection
return TaxeditorEditorPlugin.PLUGIN_ID;
}
- public static void openPolytomousKey(UUID polytomousKeyUuid)
- throws Exception {
- PolytomousKeyEditorInput input = PolytomousKeyEditorInput
- .NewInstance(polytomousKeyUuid);
- open(input);
- }
-
-// public static void openPolytomousKeyEditor(UUID polytomousKeyUuid, String name)
-// throws Exception {
-// PolytomousKeyEditorInput input = new PolytomousKeyEditorInput(polytomousKeyUuid, name);
-// open(input);
-// }
-
- public static void openCdmAuthorities(UUID groupUuid)
- throws Exception {
- CdmAuthorityEditorInput input = CdmAuthorityEditorInput.NewInstance(groupUuid);
- open(input);
- }
-
/**
* Iterates recursively over all originals having the given specimen as a derivate.
* The first {@link DerivedUnit} with no more originals or the first {@link FieldUnit} is returned
return null;
}
- /**
- * Opens a taxon editor for the given object if the given object is a valid input.
- * @param object the object for which the editor will be opened
- * @throws PartInitException
- */
- public static void openTaxonEditor(Object object) throws PartInitException {
- if(object instanceof TaxonBase<?>){
- openTaxonBase(((TaxonBase<?>) object).getUuid());
- }
- }
-
- public static boolean closeObsoleteEditor(TaxonNode taxonNode, IWorkbenchPage activePage){
- boolean result = true;
- for (IEditorReference ref : activePage.getEditorReferences()) {
- try {
- String treeIndex = ((ITreeNode)taxonNode).treeIndex();
-
-
- IEditorInput input = ref.getEditorInput();
- if (input instanceof TaxonEditorInput) {
- TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
- //if node is a child of taxonNode then close the editor
- if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
- //if (taxonNode.equals(node)) {
- result &= activePage.closeEditor(ref.getEditor(false), true);
-
- }
+ public static void closeObsoleteEditor(TaxonNode taxonNode, EPartService partService){
+ String treeIndex = taxonNode.treeIndex();
+ Collection<MPart> parts = partService.getParts();
+ for (MPart part : parts) {
+ Object object = part.getObject();
+ if(object instanceof TaxonNameEditorE4){
+ TaxonNameEditorE4 taxonEditor = (TaxonNameEditorE4)object;
+ TaxonNode node = taxonEditor.getEditorInput().getTaxonNode();
+ if(node.treeIndex().startsWith(treeIndex)){
+ partService.hidePart(part, true);
}
- } catch (PartInitException e) {
- continue;
}
}
- return result;
}
}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor;
-
-import org.eclipse.swt.widgets.Composite;
-
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>IDropTargetable interface.</p>
- *
- * @author n.hoffmann
- * @version $Id: $
- */
-public interface IDropTargetable extends IPostOperationEnabled {
-
- /**
- * <p>getControl</p>
- *
- * @return a {@link org.eclipse.swt.widgets.Composite} object.
- */
- public Composite getControl();
-
- /**
- * <p>getNameEditor</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- */
- public TaxonNameEditor getEditor();
-
- /**
- * <p>dragEntered</p>
- */
- public void dragEntered();
-
- /**
- * <p>dragLeft</p>
- */
- public void dragLeft();
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor;
-
-import org.eclipse.ui.IEditorPart;
-
-/**
- * <p>IMultiPageTaxonEditorPage interface.</p>
- *
- * @author n.hoffmann
- * @created Jan 5, 2010
- * @version 1.0
- */
-public interface IMultiPageTaxonEditorPage extends IEditorPart {
-
- /**
- * Redraws this editor
- * return true on success
- *
- * @return a boolean.
- */
- public boolean redraw();
-
- /**
- * Redraws the editor controls
- *
- * @param focus if set to true the focus is set on the editor
- * @return true on success
- */
- public boolean redraw(boolean focus);
-
- /**
- * Whether the editor page is currently redrawing
- *
- * @return a boolean.
- */
- public boolean isRedrawing();
-
- /**
- * Sets the editor page into enabled or disabled state depending on the
- * value of the supplied parameter <code>enabled</code>.
- *
- * @param enabled
- */
- public void setEnabled(boolean enabled);
-
- /**
- * Sets the editor page into disabled state and changes the
- * appearance accordingly.
- */
- void setDisabled();
-
- /**
- * Sets the editor page into disabled state and changes the
- * appearance in order to indicate that an error has occurred.
- */
- public void setOnError();
-
-}
+++ /dev/null
-/**
- * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.UndoContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.forms.editor.FormEditor;
-
-import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
-import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.DataChangeBridge;
-import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
-import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
-import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- *
- * Generates the tabbed editor with <code>TaxonNameEditor</code> on top and tabs
- * for "Descriptions", "Concepts", "Geography", etc.
- *
- * @author p.ciardelli
- * @author n.hoffmann
- * @created 15.05.2008
- * @version 1.0
- */
-public class MultiPageTaxonEditor extends FormEditor
- implements IPartContentHasFactualData, IConversationEnabled, IPostOperationEnabled, IDirtyMarkable,
- IPartContentHasDetails, IPartContentHasSupplementalData, ISecuredEditor, IPartContentHasMedia, ITaxonEditor {
-
- /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon"{trunked}</code> */
- public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon"; //$NON-NLS-1$
-
- private boolean dirty;
-
- private ConversationHolder conversation;
- private IDataChangeBehavior dataChangeBehavior;
- private IUndoContext undoContext;
-
- private TaxonEditorInput input;
-
- /**
- * <p>
- * Constructor for MultiPageTaxonEditor.
- * </p>
- */
- public MultiPageTaxonEditor() {
- super();
- undoContext = new UndoContext();
-
- }
-
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- input.dispose();
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- super.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
- */
- /** {@inheritDoc} */
- @Override
- protected void addPages() {
- input = (TaxonEditorInput) getEditorInput();
- conversation = input.getConversationHolder();
- conversation.registerForDataStoreChanges(this);
-
- try {
- addPage(Page.NAME.getIndex(), new TaxonNameEditor(this),
- getEditorInput());
- // setPageText(Page.NAME.getIndex(), Page.NAME.getTitle());
-
- // TODO lazy create
- // addPage(Page.DESCRIPTIVE.getIndex(), new
- // TaxonDescriptionTreeEditor(this), getEditorInput());
- // setPageText(Page.DESCRIPTIVE.getIndex(),
- // Page.DESCRIPTIVE.getTitle());
-
- // EditorUtil.showPropertySheet();
-
- } catch (PartInitException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void pageChange(int newPageIndex) {
- if(getCurrentPage()==-1){
- return;
- }
- super.pageChange(newPageIndex);
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSave(IProgressMonitor monitor) {
- monitor.beginTask(Messages.MultiPageTaxonEditor_SAVING_EDITOR, 4);
- try {
- if (!conversation.isBound()) {
- conversation.bind();
- }
- monitor.worked(1);
-
- for (IEditorPart editorPage : getPages()) {
- if (editorPage instanceof TaxonNameEditor) {
- if (((TaxonNameEditor) editorPage).checkForEmptyNames()) {
- MessageDialog.openWarning(AbstractUtility.getShell(), Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED,
- Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED_MESSAGE);
- return;
- }
- }
-
- editorPage.doSave(monitor);
- monitor.worked(1);
- }
-
- // commit the conversation and start a new transaction immediately
-
- input.merge();
-
- conversation.commit(true);
- CdmApplicationState.getCurrentDataChangeService()
- .fireChangeEvent(new CdmChangeEvent(Action.Update, input.getTaxonNode() , MultiPageTaxonEditor.class), true);
- monitor.worked(1);
-
- this.setDirty(false);
- monitor.worked(1);
- } catch (Exception e) {
- setFocus();
- MessagingUtils.operationDialog(this, e, TaxeditorEditorPlugin.PLUGIN_ID,Messages.MultiPageTaxonEditor_SAVING_TAXON, Messages.MultiPageTaxonEditor_SAVING_TAXON_MESSAGE);
- disableEditor(true);
- } finally {
- monitor.done();
- }
- }
-
- private void disableEditor(boolean isOnError) {
- for (IMultiPageTaxonEditorPage editorPage : getPages()) {
- if(isOnError){
- editorPage.setOnError();
- }else {
- editorPage.setDisabled();
- }
- }
-
- conversation.unregisterForDataStoreChanges(this);
- conversation.close();
- setDirty(false);
- }
-
- private void setDirty(boolean dirty) {
- this.dirty = dirty;
- firePropertyChange(PROP_DIRTY);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.MultiPageEditorPart#isDirty()
- */
- /**
- * <p>
- * isDirty
- * </p>
- *
- * @return a boolean.
- */
- @Override
- public boolean isDirty() {
- return dirty;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged()
- */
- /** {@inheritDoc} */
- @Override
- public void editorDirtyStateChanged() {
- dirty = true;
- super.editorDirtyStateChanged();
- }
-
- /**
- * {@inheritDoc}
- *
- * Checks whether nested editors are calling
- * <code>firePropertyChange(PROP_DIRTY)</code> to signal an edit has taken
- * place before passing property change along to
- * <code>super.handlePropertyChange(int propertyId)</code>.
- */
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.MultiPageEditorPart#handlePropertyChange(int)
- */
- @Override
- protected void handlePropertyChange(int propertyId) {
- if (propertyId == PROP_DIRTY) {
- setDirty(true);
- }
- super.handlePropertyChange(propertyId);
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSaveAs() {
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
-
- if (!(input instanceof TaxonEditorInput)) {
- throw new PartInitException(
- Messages.MultiPageTaxonEditor_INVALID_INPUT);
- }
-
- this.input = (TaxonEditorInput) input;
-
-
- // try {
- // // Listen for name changes,
- // // change tab for this taxon editor accordingly
- // getTaxon().addPropertyChangeListener("name",
- // new PropertyChangeListener() {
- // public void propertyChange(PropertyChangeEvent e) {
- // setPartName();
- // }
- // });
- // } catch (NullPointerException e) {
- // EditorUtil.warn(getClass(),
- // "Caught an NPE while initing an editor. This is most " +
- // "likely due to the unsuccesful attempt to restore the former " +
- // "state of the application. We ignore this because the workbench " +
- // "will simply be reset.");
- // }
- setPartName();
-
- super.init(site, input);
- }
-
- /**
- * Calls <code>MultiPageEditorPart.setPartName(String partName)</code> with
- * text appropriate to the state of the taxon: any taxon that has been saved
- * will by necessity have a name to display; a new taxon should display
- * "New taxon" in the editor tab.
- */
- protected void setPartName() {
-
- String partName = null;
- TaxonName name = getTaxon().getName();
-
- if (name != null) {
- partName = name.getTitleCache();
- }
-
- if (partName == null || partName.equals("")) { //$NON-NLS-1$
- partName = (Messages.MultiPageTaxonEditor_NEW_TAXON);
- }
-
- setPartName(partName);
- }
-
- /**
- * {@inheritDoc}
- *
- * Editor pages call this in their postOperation to notify the
- * MultiPageTaxonEditor of unsaved changes
- */
- @Override
- public void changed(Object element) {
- // setDirty(true);
- // if the attribute is null then do not set the dirty flag -> hotfix for the problem that for tasks done in service methods the changes are saved automatically
- if (element != null){
- dirty = true;
- super.editorDirtyStateChanged();
- }
-
- if (element instanceof TaxonBase) {
- TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME);
- AbstractGroupedContainer container = page.getContainer((TaxonBase) element);
- if (container != null) {
- container.refresh();
- }
- }
- if (element instanceof TaxonRelationship) {
- TaxonNameEditor page = (TaxonNameEditor) getPage(Page.NAME);
- AbstractGroupedContainer container = page.getContainer(((TaxonRelationship) element).getFromTaxon());
- if (container != null) {
- container.refresh();
- }
- }
- //refresh part title
- //TODO: refresh taxon node in taxon navigator
- setPartName();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
- */
- @Override
- public void forceDirty() {
- changed(null);
- }
-
- /**
- * The accepted taxon that is the input for this editor
- *
- * @return the accepted taxon
- */
- @Override
- public Taxon getTaxon() {
- return input.getTaxon();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
- * ()
- */
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /**
- * <p>
- * setConversationHolder
- * </p>
- *
- * @param conversation
- * a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- public void setConversationHolder(ConversationHolder conversation) {
- this.conversation = conversation;
- }
-
- /**
- * <p>
- * Getter for the field <code>undoContext</code>.
- * </p>
- *
- * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
- * object.
- */
- public IUndoContext getUndoContext() {
- return undoContext;
- }
-
- /**
- * <p>
- * Setter for the field <code>undoContext</code>.
- * </p>
- *
- * @param undoContext
- * a {@link org.eclipse.core.commands.operations.IUndoContext}
- * object.
- */
- public void setUndoContext(IUndoContext undoContext) {
- this.undoContext = undoContext;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setFocus() {
- // logger.warn("Setting focus to editor");
- // bind the conversation
- getConversationHolder().bind();
- input.bind();
- // pass focus to the active editor page
- getActiveEditor().setFocus();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu
- * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
- */
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap events) {
- if (dataChangeBehavior == null) {
- dataChangeBehavior = new MultiPageTaxonEditorDataChangeBehaviour(this);
- }
-
- DataChangeBridge.handleDataChange(events, dataChangeBehavior);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation
- * ()
- */
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
- setDirty(true);
-
- for (IEditorPart editor : this.getPages()) {
- if (editor instanceof IPostOperationEnabled) {
- ((IPostOperationEnabled) editor).postOperation(objectAffectedByOperation);
- } else {
- MessagingUtils.warn(getClass(), Messages.MultiPageTaxonEditor_POST_OP_NOT_ENABLED + editor);
- }
- }
- MessagingUtils.warn(getClass(), Messages.MultiPageTaxonEditor_POST_OP_CALLED);
-
- return false;
- }
-
- /**
- * Returns an <code>IEditorPart</code> implementation by type
- *
- * @param page
- * the page type
- * @return a {@link eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage}
- * object.
- */
- public IMultiPageTaxonEditorPage getPage(Page page) {
- for (IEditorPart editor : this.getPages()) {
- if (editor.getClass().equals(page.getClazz())) {
- return (IMultiPageTaxonEditorPage) editor;
- }
- }
- return null;
- }
-
- /**
- * Return a list of <code>AbstractTaxonEditor</code>s registered with this
- * <code>MultiPageTaxonEditor</code>.
- *
- * @return a {@link java.util.List} object.
- */
- public List<IMultiPageTaxonEditorPage> getPages() {
- ArrayList<IMultiPageTaxonEditorPage> editors = new ArrayList<IMultiPageTaxonEditorPage>();
- for (int i = 0; i < this.getPageCount(); i++) {
-
- editors.add((IMultiPageTaxonEditorPage) this.getEditor(i));
- }
- return editors;
- }
-
- /**
- * Refreshes a certain page of the MultipageTaxonEditor
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @return a boolean.
- */
- public boolean redraw(Page page) {
- return redraw(page, true);
- }
-
- /**
- * Refreshes a certain page of the MultipageTaxonEditor and sets focus to
- * that page
- *
- * @param page
- * a {@link eu.etaxonomy.taxeditor.editor.Page} object.
- * @param focus
- * a boolean.
- * @return a boolean.
- */
- public boolean redraw(Page page, boolean focus) {
- IMultiPageTaxonEditorPage editorPage = getPage(page);
- return editorPage != null && editorPage.redraw(focus);
- }
-
- /**
- * <p>
- * onComplete
- * </p>
- *
- * @return a boolean.
- */
- @Override
- public boolean onComplete() {
- return false;
- }
-
- /**
- * Reloads the data for this
- */
- public void reload() {
- if (isDirty()) {
- MessagingUtils.warningDialog(Messages.MultiPageTaxonEditor_UNSAVED_DATA, getClass(), Messages.MultiPageTaxonEditor_UNSAVED_DATA_MESSAGE);
- } else {
- TaxonEditorInput input = (TaxonEditorInput) getEditorInput();
-
- UUID uuid = input.getTaxonNode().getUuid();
-
- conversation.clear();
-
- try {
- TaxonEditorInput newInput = TaxonEditorInput.NewInstance(uuid);
- setInput(newInput);
- for (IMultiPageTaxonEditorPage editorPart : getPages()) {
- editorPart.redraw();
- }
- } catch (Exception e) {
- MessagingUtils.messageDialog(Messages.MultiPageTaxonEditor_REFRESH_ERROR, getClass(), Messages.MultiPageTaxonEditor_REFRESH_ERROR_MESSAGE, e);
- }
- }
- }
-
- @Override
- public String toString() {
- return String.format("%s[%s]", this.getClass().getSimpleName(), getEditorInput()); //$NON-NLS-1$
- }
-
- @Override
- public boolean permissionsSatisfied() {
- IEditorPart activeEditor = getActiveEditor();
- if(activeEditor != null && ISecuredEditor.class.isAssignableFrom(activeEditor.getClass())){
- return ((ISecuredEditor)activeEditor).permissionsSatisfied();
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.IPartContentHasMedia#canAttachMedia()
- */
- @Override
- public boolean canAttachMedia() {
- return true;
- }
-
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-
-/**
- * TODO remove this class
- *
- * @author n.hoffmann
- * @version $Id: $
- */
-public class MultiPageTaxonEditorAdapterFactory implements IAdapterFactory {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- /** {@inheritDoc} */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
-
-// if((adaptableObject instanceof MultiPageTaxonEditor) && adapterType.equals(DuplicateArbitrator.class)){
-// return null;// new DuplicateArbitrator((MultiPageTaxonEditor) adaptableObject);
-// }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- /**
- * <p>getAdapterList</p>
- *
- * @return an array of {@link java.lang.Class} objects.
- */
- public Class[] getAdapterList() {
- return new Class[]{
-// DuplicateArbitrator.class
- };
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor;
-
-import java.util.Vector;
-
-import org.apache.log4j.Logger;
-
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
-import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
-
-/**
- * Implementation if {@link eu.etaxonomy.taxeditor.store.model.IDataChangeBehaviour}
- * for the {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}.
- *
- * TODO make this class a bean and thus configurable by Spring
- *
- * @author n.hoffmann
- * @created 01.04.2009
- * @version 1.0
- */
-public class MultiPageTaxonEditorDataChangeBehaviour extends AbstractDataChangeBehaviour implements
- IDataChangeBehavior {
- private static final Logger logger = Logger
- .getLogger(MultiPageTaxonEditorDataChangeBehaviour.class);
-
- private MultiPageTaxonEditor source;
-
- private TaxonEditorInput input;
-
- /**
- * <p>Constructor for MultiPageTaxonEditorDataChangeBehaviour.</p>
- *
- * @param multiPageTaxonEditor a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} object.
- */
- public MultiPageTaxonEditorDataChangeBehaviour(
- MultiPageTaxonEditor multiPageTaxonEditor) {
- source = multiPageTaxonEditor;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#reactOnDataChange()
- */
- /** {@inheritDoc} */
- public void reactOnDataChange(CdmDataChangeMap changeEvents) {
- input = (TaxonEditorInput) source.getEditorInput();
-
- // I don't know when this happens but ...
- if(input.getTaxon() == null)
- return;
-
- if(changeEvents.sizeByEventType(EventType.UPDATE) > 0){
- reactOnUpdate(changeEvents.getEvents(EventType.UPDATE));
- }
- if(changeEvents.sizeByEventType(EventType.INSERT) > 0){
- reactOnInsert(changeEvents.getEvents(EventType.INSERT));
- }
- if(changeEvents.sizeByEventType(EventType.DELETE) > 0){
- reactOnDelete(changeEvents.getEvents(EventType.DELETE));
- }
- }
-
-
- /** {@inheritDoc} */
- //we do not really need this anymore as closing the editors is
- //now run before the delete operation in DeleteHandler
- @Override
- public void reactOnDelete(Vector<CdmDataChangeEvent> events){
- for(CdmDataChangeEvent event : events){
- // close open editors
- if((event.getEntity() instanceof TaxonNode)
- && input.getTaxonNode().equals(event.getEntity())){
- //EditorUtil.close(source);
- logger.debug("Closing open editor for deleted taxon."); //$NON-NLS-1$
- }
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void reactOnUpdate(Vector<CdmDataChangeEvent> events){
-
- for(CdmDataChangeEvent event : events){
-
- // update editor title
- if(event.getEntity() instanceof TaxonName){
- if(input.getTaxon().getName().equals(event.getEntity())){
- // set the name of the editor window
- source.setPartName();
- logger.debug("Updating title of taxons editor."); //$NON-NLS-1$
- }
- }
- // TODO other stuff to happen
-
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void reactOnInsert(Vector<CdmDataChangeEvent> events){
- boolean doRedraw = false;
- for(CdmDataChangeEvent event : events){
- // refresh on synonym changes
- if(input.getTaxon().hasSynonyms() && event.getEntity() instanceof Synonym){
- Synonym synonym = (Synonym) event.getEntity();
-
- if(synonym.isSynonymOf(input.getTaxon())){
- doRedraw = true;
- break;
- }
- }
- }
-// if(doRedraw)
-// source.redraw(Page.NAME);
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor;
-
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-
-/**
- * <p>Page class.</p>
- *
- * @author n.hoffmann
- * @created 30.04.2009
- * @version 1.0
- */
-public enum Page {
- NAME ("Name", TaxonNameEditor.class, 0); //$NON-NLS-1$
-
- private String title;
- private Class<?> clazz;
- private int index;
-
- Page(String title, Class<?> clazz, int index){
- this.title = title;
- this.clazz = clazz;
- this.index = index;
- }
-
- /**
- * <p>Getter for the field <code>title</code>.</p>
- *
- * @return a {@link java.lang.String} object.
- */
- public String getTitle(){
- return this.title;
- }
-
- /**
- * <p>Getter for the field <code>clazz</code>.</p>
- *
- * @return a {@link java.lang.Class} object.
- */
- public Class<?> getClazz(){
- return this.clazz;
- }
-
- /**
- * <p>Getter for the field <code>index</code>.</p>
- *
- * @return a int.
- */
- public int getIndex(){
- return this.index;
- }
-}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.e4;
+
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class TaxonEditorInputDataChangeBehaviourE4 extends
+ AbstractDataChangeBehaviour {
+
+ private TaxonEditorInputE4 source;
+
+ public TaxonEditorInputDataChangeBehaviourE4(TaxonEditorInputE4 taxonEditorInput) {
+ source = taxonEditorInput;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void reactOnDataChange(CdmDataChangeMap events) {
+ source.update(events);
+
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.e4;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+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.editor.CdmEntitySessionInput;
+import eu.etaxonomy.taxeditor.editor.ChooseFromMultipleTaxonNodesDialog;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class TaxonEditorInputE4 extends CdmEntitySessionInput implements IConversationEnabled {
+
+ private static final String INCORRECT_STATE = Messages.TaxonEditorInput_INCORRECT_STATE;
+
+ private final ConversationHolder conversation;
+
+ private TaxonNode taxonNode;
+
+ private TaxonEditorInputDataChangeBehaviourE4 dataChangeBehavior;
+
+ private TaxonBase initiallySelectedTaxonBase;
+
+ private enum CdmType {
+ TAXON_NODE,
+ TAXON_BASE,
+ PARENT_TAXON_NODE
+ }
+
+ private TaxonEditorInputE4(UUID uuid, CdmType type) {
+ super(true);
+ this.conversation = CdmStore.createConversation();
+ switch(type) {
+ case PARENT_TAXON_NODE:
+ initForParentTaxonNode(uuid);
+ break;
+ case TAXON_BASE:
+ initForTaxonBase(uuid);
+ break;
+ case TAXON_NODE:
+ initForTaxonNode(uuid);
+ break;
+ }
+ }
+
+ private void init(TaxonNode taxonNode) {
+ this.taxonNode = taxonNode;
+ }
+
+
+ private void initForTaxonNode(UUID taxonNodeUuid) {
+
+
+ TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths());
+
+ if(taxonNode == null){
+ MessagingUtils.warningDialog(Messages.TaxonEditorInput_NOT_IMPLEMENTED, TaxonEditorInputE4.class, Messages.TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE);
+ }
+ init(taxonNode);
+ setInitiallySelectedTaxonBase(getTaxon());
+
+ }
+
+ private void initForTaxonBase(UUID taxonBaseUuid) {
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths());
+ if (taxonBase != null){
+ if(taxonBase.isInstanceOf(Taxon.class)){
+ Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+ setInitiallySelectedTaxonBase(taxon);
+
+ if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){
+ // TODO get accepted taxon
+ MessagingUtils.info(Messages.TaxonEditorInput_OPEN_MISSAPPLIED_NAME);
+
+ Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
+ Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
+ for(TaxonRelationship relation : relations){
+ if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+ acceptedTaxa.add(relation.getToTaxon());
+ }
+ }
+ setInputForMultipleTaxa(conversation, acceptedTaxa);
+
+ }else{
+ setInputForMultipleNodes(conversation, taxon.getTaxonNodes());
+ }
+ }else if(taxonBase instanceof Synonym){
+ Synonym synonym = (Synonym) taxonBase;
+
+ Set<Taxon> taxa = new HashSet<>();
+ Taxon taxon = synonym.getAcceptedTaxon();
+ if (taxon != null){
+ taxa.add(taxon);
+ }
+ setInputForMultipleTaxa(conversation, taxa);
+ setInitiallySelectedTaxonBase(synonym);
+ }
+ }
+ }
+
+
+ private void initForParentTaxonNode(UUID parentNodeUuid){
+
+
+ TaxonName name = PreferencesUtil.getPreferredNomenclaturalCode().getNewTaxonNameInstance(null);
+ ITaxonTreeNode parentNode = CdmStore.getService(IClassificationService.class).getTreeNodeByUuid(parentNodeUuid);
+
+ Taxon newTaxon = Taxon.NewInstance(name, parentNode.getReference());
+ TaxonNode newTaxonNode = parentNode.addChildTaxon(newTaxon, parentNode.getReference(), parentNode.getMicroReference());
+
+ // add the new taxon to the editors persistence context
+ UUID newTaxonNodeUuid = CdmStore.getService(ITaxonNodeService.class).save(newTaxonNode).getUuid();
+
+ initForTaxonNode(newTaxonNodeUuid);
+ }
+
+ private void setInputForMultipleNodes(ConversationHolder conversation, Set<TaxonNode> taxonNodes){
+ if(taxonNodes.size() == 1){
+ TaxonNode taxonNode = taxonNodes.iterator().next();
+ init(taxonNode);
+ }else if(taxonNodes.size() > 1){
+ TaxonNode taxonNode = ChooseFromMultipleTaxonNodesDialog.choose(taxonNodes);
+ if(taxonNode != null){
+ init(taxonNode);
+ }
+ } else if (taxonNodes.size() == 0) {
+ // this is an undesired state
+ MessagingUtils.warningDialog(INCORRECT_STATE,TaxonEditorInputE4.class,Messages.TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION);
+ }
+ }
+
+ private void setInputForMultipleTaxa(ConversationHolder conversation, Set<Taxon> taxa){
+ if(taxa.size() == 1){
+ Taxon taxon = taxa.iterator().next();
+ Set<TaxonNode> nodes = taxon.getTaxonNodes();
+ setInputForMultipleNodes(conversation, nodes);
+ }else if(taxa.size() > 1){
+ Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
+ for ( Taxon taxon : taxa ){
+ taxonNodes.addAll(taxon.getTaxonNodes());
+ }
+ setInputForMultipleNodes(conversation, taxonNodes);
+ }else if(taxa.size() == 0){
+ // this is an undesired state
+ MessagingUtils.warningDialog(INCORRECT_STATE, TaxonEditorInputE4.class, Messages.TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT);
+ }
+ }
+
+ public static TaxonEditorInputE4 NewInstance(UUID taxonNodeUuid) {
+ return new TaxonEditorInputE4(taxonNodeUuid, CdmType.TAXON_NODE);
+
+ }
+
+ public static TaxonEditorInputE4 NewInstanceFromTaxonBase(UUID taxonBaseUuid){
+ return new TaxonEditorInputE4(taxonBaseUuid, CdmType.TAXON_BASE);
+ }
+
+
+ public static TaxonEditorInputE4 NewEmptyInstance(UUID parentNodeUuid){
+ return new TaxonEditorInputE4(parentNodeUuid, CdmType.PARENT_TAXON_NODE);
+ }
+
+ public Object getAdapter(Class adapter) {
+
+ if (adapter == Taxon.class) {
+ return getTaxon();
+ }
+
+ if (adapter == TaxonNode.class) {
+ return taxonNode;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Overrides equals to ensure that a taxon can only be edited by
+ * one editor at a time.
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (TaxonEditorInputE4.class.equals(obj.getClass())
+ && getTaxon() != null
+ && getTaxon().equals(((TaxonEditorInputE4) obj).getTaxon())) {
+ if (((TaxonEditorInputE4) obj).getInitiallySelectedTaxonBase() != null){
+ setInitiallySelectedTaxonBase(((TaxonEditorInputE4) obj).getInitiallySelectedTaxonBase());
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public Taxon getTaxon(){
+ if(taxonNode!=null){
+ Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon(), Taxon.class);
+ return taxon;
+ }
+ return null;
+ }
+
+ public TaxonNode getTaxonNode() {
+ return taxonNode;
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap events) {
+ if(dataChangeBehavior == null){
+ dataChangeBehavior = new TaxonEditorInputDataChangeBehaviourE4(this);
+ }
+
+ DataChangeBridge.handleDataChange(events, dataChangeBehavior);
+ }
+
+ public void setInitiallySelectedTaxonBase(TaxonBase taxonBase) {
+ this.initiallySelectedTaxonBase = taxonBase;
+ }
+
+ public TaxonBase getInitiallySelectedTaxonBase() {
+ return initiallySelectedTaxonBase;
+ }
+
+ @Override
+ public List<TaxonNode> getRootEntities() {
+ return Arrays.asList(taxonNode);
+ }
+
+ @Override
+ public void merge() {
+ CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ return null;
+ }
+
+ private List<String> getTaxonNodePropertyPaths() {
+ List<String> taxonNodePropertyPaths = new ArrayList<String>();
+ for(String propertyPath : getTaxonBasePropertyPaths()) {
+ taxonNodePropertyPaths.add("taxon." + propertyPath); //$NON-NLS-1$
+ }
+ return taxonNodePropertyPaths;
+ }
+
+ private List<String> getTaxonBasePropertyPaths() {
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "sec", //$NON-NLS-1$
+ "createdBy", //$NON-NLS-1$
+ "updatedBy", //$NON-NLS-1$
+ "annotations", //$NON-NLS-1$
+ "markers", //$NON-NLS-1$
+ "credits", //$NON-NLS-1$
+ "extensions", //$NON-NLS-1$
+ "rights", //$NON-NLS-1$
+ "sources", //$NON-NLS-1$
+ "descriptions", //$NON-NLS-1$
+ "relationsToThisTaxon", //$NON-NLS-1$
+ "relationsFromThisTaxon", //$NON-NLS-1$
+ "taxonNodes", //$NON-NLS-1$
+ "descriptions.descriptionElements.feature", //$NON-NLS-1$
+ "descriptions.descriptionElements.area", //$NON-NLS-1$
+ "descriptions.descriptionElements.status", //$NON-NLS-1$
+ "descriptions.markers", //$NON-NLS-1$
+ "name.descriptions", //$NON-NLS-1$
+ "name.typeDesignations", //$NON-NLS-1$
+ "name.status", //$NON-NLS-1$
+ "name.nomenclaturalReference.inReference", //$NON-NLS-1$
+ "name.taxonBases.taxonNodes", //$NON-NLS-1$
+ "name.relationsFromThisName", //$NON-NLS-1$
+ "name.relationsToThisName", //$NON-NLS-1$
+ "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status", //$NON-NLS-1$
+ "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName", //$NON-NLS-1$
+ "synonymRelations.synonym.name.status.type", //$NON-NLS-1$
+ "synonymRelations.synonym.name.relationsToThisName.fromName", //$NON-NLS-1$
+ "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship", //$NON-NLS-1$
+ "synonymRelations.synonym.name.nomenclaturalReference.authorship", //$NON-NLS-1$
+ "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations" //$NON-NLS-1$
+ });
+
+ return taxonBasePropertyPaths;
+ }
+
+}
import java.util.Collection;
import java.util.UUID;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
*
*/
-public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
+public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IConversationEnabled {
private ConversationHolder conversation;
private Group group;
return new CdmAuthorityEditorInput(conversation, group);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
public Object getAdapter(Class adapter) {
if (adapter == Group.class) {
return this.group;
public ConversationHolder getConversationHolder() {
return this.conversation;
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- @Override
- public boolean exists() {
- return group != null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
public String getName() {
return group.getName();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- @Override
- public IPersistableElement getPersistable() {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
@Override
public void merge() {
group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
-
+
}
}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.group.authority.e4;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.model.application.ui.basic.MPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeViewer;
+
+/**
+ * Editor responsible for editing authorities related to a particular {@link Group} entity.
+ *
+ * @author cmathew
+ * @created Mar 28, 2013
+ *
+ */
+public class CdmAuthorityEditorE4 implements IConversationEnabled, IDirtyMarkable {
+
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.group.authority"; //$NON-NLS-1$
+
+ @Inject
+ private MDirtyable dirty;
+ private ConversationHolder conversation;
+ private CdmAuthorityCompositeViewer viewer;
+
+ private CdmAuthorityEditorInput input;
+
+ @Inject
+ private MPart thisPart;
+
+ private Composite container;
+
+ @Inject
+ public CdmAuthorityEditorE4() {
+
+ }
+
+ /**
+ * Create contents of the editor part.
+ * @param parent
+ */
+ @PostConstruct
+ public void createPartControl(Composite parent) {
+ container = new Composite(parent, SWT.NONE);
+ container.setLayout(new FillLayout(SWT.HORIZONTAL));
+ }
+
+ @Focus
+ public void setFocus() {
+ if(input!=null){
+ input.bind();
+ }
+ }
+
+ @Persist
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ monitor.beginTask(Messages.CdmAuthorityEditor_SAVING_AUTHORITY_EDITOR, 1);
+ getConversationHolder().commit(true);
+ input.merge();
+ dirty.setDirty(false);
+ monitor.worked(1);
+ } finally {
+ monitor.done();
+ viewer.save();
+ }
+ }
+
+ public void init(CdmAuthorityEditorInput input) {
+ this.input = input;
+
+ conversation = input.getConversationHolder();
+
+ this.viewer = new CdmAuthorityCompositeViewer(container, this,input.getGroup());
+
+ thisPart.setLabel(input.getName());
+ }
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ }
+
+ @Override
+ public void changed(Object element) {
+ //FIXME : should be optimised to split changes into adding / removing authorities
+ // vs updating authorites
+ dirty.setDirty(viewer.isDirty());
+ // if the change has happened on the group then refresh the table
+ if(element instanceof Group) {
+ //FIXME: activating (setting focus) on the editor happens on every change
+ // This should be changed to only when the drop is successful
+ //FIXME E4 migrate/delete
+// getSite().getPage().activate(this);
+ }
+
+ }
+
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ @PreDestroy
+ public void dispose() {
+ if(conversation!=null){
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.close();
+ }
+ if(input!=null){
+ input.getCdmEntitySession().dispose();
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.group.authority.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
+import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
+import eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ * Handler which opens an instance of the {@link CdmAuthorityEditor} for a2
+ * particluar group.
+ *
+ * @author cmathew
+ * @created Mar 28, 2013
+ *
+ */
+
+public class EditCdmAuthoritiesHandlerE4 {
+
+ private static final String OPENING_CDM_AUTHORITIES = Messages.EditCdmAuthoritiesHandler_OPEN_AUTHORITIES;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) CdmBase selection,
+ EPartService partService) {
+ Job job = new Job(OPENING_CDM_AUTHORITIES) {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(OPENING_CDM_AUTHORITIES, 1);//selection.size());
+
+ if (selection instanceof Group) {
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ CdmAuthorityEditorE4 editor = (CdmAuthorityEditorE4) part.getObject();
+ editor.init(CdmAuthorityEditorInput.NewInstance(((Group) selection).getUuid()));
+ } catch (Exception e) {
+ MessagingUtils.warningDialog(
+ Messages.EditCdmAuthoritiesHandler_COULD_NOT_OPEN_AUTHORITIES,
+ EditorUtil.class, e.getMessage());
+ }
+ }
+
+ });
+ monitor.worked(1);
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
+
+ @CanExecute
+ public boolean execute(@Named(IServiceConstants.ACTIVE_SELECTION) CdmBase selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection instanceof Group;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+
+ }
+}
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.LineSelection;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- BulkEditor editor = (BulkEditor) EditorUtil.getActiveE4Editor();
+ BulkEditor editor = (BulkEditor) AbstractUtility.getActiveEditor();
ISelection selection = editor.getSite().getSelectionProvider().getSelection();
if(selection instanceof LineSelection){
@Override
public void run() {
try {
- EditorUtil.openCdmAuthorities(((Group)selectedObject).getUuid());
+// EditorUtil.openCdmAuthorities(((Group)selectedObject).getUuid());
} catch (Exception e) {
MessagingUtils.warningDialog(Messages.EditCdmAuthoritiesHandler_COULD_NOT_OPEN_AUTHORITIES, EditorUtil.class, e.getMessage());
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$
-
- try {
- EditorUtil.openEmpty(null);
- } catch (PartInitException e) {
- e.printStackTrace();
- }
+
+ EditorUtil.openEmptyE4(null);
return null;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
+ EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW);
- partService.showPart(part, PartState.ACTIVATE);
+ part = partService.showPart(part, PartState.ACTIVATE);
DerivateView derivateView = (DerivateView) part.getObject();
derivateView.init(new DerivateViewEditorInput());
return null;
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-
-/**
- * <p>OpenParentHandler class.</p>
- *
- * @author n.hoffmann
- * @created 03.06.2009
- * @version 1.0
- */
-public class OpenParentHandler extends AbstractHandler implements IHandler {
-
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- throw new RuntimeException("Open parent not supported anymore"); //$NON-NLS-1$
-// Taxon parent = EditorUtil.getActiveMultiPageTaxonEditor().getTaxon().getTaxonomicParent();
-//
-// if(parent != null){
-// try {
-// EditorUtil.openTaxonNode(parent.getUuid());
-// } catch (PartInitException e) {
-// throw new RuntimeException("Error opening parent taxon", e);
-// } catch (Exception e) {
-// MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
-// }
-// }
-//
-// return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.ui.IEditorPart;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-
-/**
- * <p>SaveAllHandler class.</p>
- *
- * @author n.hoffmann
- * @created 06.02.2009
- * @version 1.0
- */
-public class SaveAllHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger.getLogger(SaveAllHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$
-
- // TODO what is this for?
- EditorUtil.setSaving(true);
-
- for (IEditorPart editor : EditorUtil.getOpenEditors()) {
- if (editor.isDirty()) {
- editor.doSave(EditorUtil.getMonitor());
- }
- }
-
- EditorUtil.setSaving(false);
- // TODO: delete undoHistory
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-
-/**
- * <p>SaveTaxonHandler class.</p>
- *
- * @author n.hoffmann
- * @created 23.03.2009
- * @version 1.0
- */
-public class SaveTaxonHandler extends AbstractHandler {
- private static final Logger logger = Logger
- .getLogger(SaveTaxonHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- MultiPageTaxonEditor editor = EditorUtil.getActiveMultiPageTaxonEditor();
-
- return EditorUtil.getActivePage().saveEditor(editor, false);
-
- }
-}
/**
* 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.
*/
package eu.etaxonomy.taxeditor.editor.handler.create;
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.newWizard.NewNonViralNameWizard;
/**
- * <p>NewNameHandler class.</p>
*
- * @author n.hoffmann
- * @created Jun 1, 2010
- * @version 1.0
+ * @author pplitzner
+ * @date 10.10.2017
+ *
*/
-public class NewNameHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger.getLogger(NewNameHandler.class);
+public class NewNameHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
NewNonViralNameWizard wizard = new NewNonViralNameWizard();
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
-
- return null;
+
}
}
/**
* 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.
*/
package eu.etaxonomy.taxeditor.editor.handler.create;
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.newWizard.NewPersonWizard;
/**
- * <p>NewPersonHandler class.</p>
*
- * @author n.hoffmann
- * @created Jun 1, 2010
- * @version 1.0
+ * @author pplitzner
+ * @date 10.10.2017
+ *
*/
-public class NewPersonHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger
- .getLogger(NewPersonHandler.class);
+public class NewPersonHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
NewPersonWizard wizard = new NewPersonWizard();
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
-
- return null;
}
}
/**
* 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.
*/
package eu.etaxonomy.taxeditor.editor.handler.create;
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.newWizard.NewReferenceWizard;
/**
- * <p>NewReferenceHandler class.</p>
*
- * @author n.hoffmann
- * @created Jun 1, 2010
- * @version 1.0
+ * @author pplitzner
+ * @date 10.10.2017
+ *
*/
-public class NewReferenceHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger
- .getLogger(NewReferenceHandler.class);
+public class NewReferenceHandler {
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
NewReferenceWizard wizard = new NewReferenceWizard();
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
-
- return null;
}
-
}
/**
* 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.
*/
package eu.etaxonomy.taxeditor.editor.handler.create;
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
/**
- * <p>NewTeamHandler class.</p>
*
- * @author n.hoffmann
- * @created Jun 1, 2010
- * @version 1.0
+ * @author pplitzner
+ * @date 10.10.2017
+ *
*/
-public class NewTeamHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger.getLogger(NewTeamHandler.class);
+public class NewTeamHandler {
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
NewTeamWizard wizard = new NewTeamWizard();
wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
-
- return null;
}
}
package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
import eu.etaxonomy.taxeditor.editor.AppModelId;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
public class DefaultOpenSpecimenEditorForTypeSpecimenHandler extends
- DefaultOpenHandlerBase<SpecimenTypeDesignation> {
+ DefaultOpenHandlerBaseE4<SpecimenTypeDesignation> {
@Override
protected SpecimenTypeDesignation getEntity(UUID uuid) {
}
@Override
- protected void open(ExecutionEvent event, SpecimenTypeDesignation entity) {
+ protected void open(SpecimenTypeDesignation entity, Shell shell, EPartService partService) {
DerivateViewEditorInput input = new DerivateViewEditorInput(entity.getUuid());
- MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
+ MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).showPart(
AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
DerivateView derivateView = (DerivateView) part.getObject();
derivateView.init(input);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(SpecimenTypeDesignation entity) {
+ return true;
+ }
+
}
package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
-public class DefaultOpenTaxonEditorForTaxonBaseHandler extends DefaultOpenHandlerBase<TaxonBase> {
+public class DefaultOpenTaxonEditorForTaxonBaseHandler extends DefaultOpenHandlerBaseE4<TaxonBase> {
@Override
protected TaxonBase getEntity(UUID uuid) {
}
@Override
- protected void open(ExecutionEvent event, TaxonBase entity) {
- try {
- EditorUtil.openTaxonBase(entity.getUuid());
- } catch (PartInitException e) {
- MessagingUtils.error(DefaultOpenTaxonEditorForTaxonBaseHandler.class, Messages.DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN+entity, e);
- }
+ protected void open(TaxonBase entity, Shell shell, EPartService partService) {
+ EditorUtil.openTaxonBaseE4(entity.getUuid(), modelService, partService, application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(TaxonBase entity) {
+ return true;
}
}
package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
-public class DefaultOpenTaxonEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
+public class DefaultOpenTaxonEditorForTaxonNodeHandler extends DefaultOpenHandlerBaseE4<TaxonNode> {
@Override
protected TaxonNode getEntity(UUID uuid) {
}
@Override
- protected void open(ExecutionEvent event, TaxonNode entity) {
- TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(entity.getTaxon().getUuid());
+ protected void open(TaxonNode entity, Shell shell, EPartService partService) {
try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, Messages.DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN+input.getTaxon(), e);
+ EditorUtil.openTaxonNodeE4(entity.getUuid(), modelService, partService, application);
+ } catch (Exception e) {
+ MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, Messages.DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN+entity.getTaxon(), e);
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(TaxonNode entity) {
+ return entity.getTaxon()!=null;
+ }
+
}
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
-import eu.etaxonomy.taxeditor.editor.EditorStateManager;
import eu.etaxonomy.taxeditor.editor.UseObjectManager;
import eu.etaxonomy.taxeditor.editor.validation.ValidationContextListener;
import eu.etaxonomy.taxeditor.store.CdmStore;
/** Constant <code>logger</code> */
public static final Logger logger = Logger.getLogger(TaxeditorEditorPlugin.class);
-
+
// The plug-in ID
/** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.editor"</code> */
public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.editor"; //$NON-NLS-1$
// The shared instance
private static TaxeditorEditorPlugin plugin;
-
+
/**
* The constructor
*/
}
/** {@inheritDoc} */
- public void start(BundleContext context) throws Exception {
+ @Override
+ public void start(BundleContext context) throws Exception {
super.start(context);
-
- EditorStateManager stateManager = new EditorStateManager();
- CdmStore.getContextManager().addContextListener(stateManager);
-
- UseObjectManager useManager = new UseObjectManager();
+
+ UseObjectManager useManager = new UseObjectManager();
CdmStore.getContextManager().addContextListener(useManager);
-
+
ValidationContextListener vcl = new ValidationContextListener();
// CdmStore.getContextManager().addContextListener(vcl);
-
+
plugin = this;
logger.trace("Plugin started: " + this.getBundle().getSymbolicName()); //$NON-NLS-1$
}
/** {@inheritDoc} */
- public void stop(BundleContext context) throws Exception {
+ @Override
+ public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
logger.trace("Plugin stopped"); //$NON-NLS-1$
throws PartInitException {
setSite(site);
setInput(input);
- formFactory = new CdmFormFactory(site.getShell().getDisplay());
+// formFactory = new CdmFormFactory(site.getShell().getDisplay());
}
/*
*/
package eu.etaxonomy.taxeditor.editor.key;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.description.IIdentificationKey;
*
*/
public abstract class AbstractIdentificationEditorInput<T extends IIdentificationKey>
- extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
+ extends CdmEntitySessionInput implements IConversationEnabled {
private final ConversationHolder conversation;
this.conversation = conversation;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- @Override
- public boolean exists() {
- return getKey() != null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- @Override
- public IPersistableElement getPersistable() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return getName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return getKey().toString();
- }
-
@Override
public ConversationHolder getConversationHolder() {
return conversation;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
* @author n.hoffmann
conversation = polytomousKeyEditorInput.getConversationHolder();
conversation.registerForDataStoreChanges(this);
- try {
- addPage(0, new PolytomousKeyListEditor(this), polytomousKeyEditorInput);
- setPageText(0, Messages.KeyEditor_LIST);
- addPage(1, new PolytomousKeyGraphEditor(this), polytomousKeyEditorInput);
- setPageText(1, Messages.KeyEditor_GRAPH);
- } catch (PartInitException e) {
- MessagingUtils.error(getClass(), e);
- }
+// try {
+// addPage(0, new PolytomousKeyListEditor(this), polytomousKeyEditorInput);
+// setPageText(0, Messages.KeyEditor_LIST);
+// addPage(1, new PolytomousKeyGraphEditor(this), polytomousKeyEditorInput);
+// setPageText(1, Messages.KeyEditor_GRAPH);
+// } catch (PartInitException e) {
+// MessagingUtils.error(getClass(), e);
+// }
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.key.e4;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.zest.core.viewers.AbstractZoomableViewer;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.viewers.IZoomableWorkbenchPart;
+import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
+
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.IIdentificationKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ * @param <T>
+ */
+public abstract class AbstractGraphKeyEditorE4<T extends IIdentificationKey>
+implements IConversationEnabled, IE4SavablePart,
+ IZoomableWorkbenchPart, IPostOperationEnabled,
+ IDirtyMarkable {
+
+ protected CdmFormFactory formFactory;
+ protected Composite container;
+ protected GraphViewer viewer;
+
+ private LayoutAlgorithm layoutAlgoritm;
+ private ZoomContributionViewItem zoomContributionViewItem;
+
+ private IToolBarManager toolBarManager;
+
+ private PolytomousKeyEditorInput input;
+
+ @Inject
+ protected ESelectionService selService;
+
+ @Inject
+ private MDirtyable dirty;
+
+ protected ISelectionChangedListener selectionChangedListener;
+
+ @Inject
+ private MPart thisPart;
+
+ @Persist
+ public void save(IProgressMonitor monitor) {
+ getConversationHolder().commit(true);
+ setDirty(false);
+ viewer.refresh();
+ }
+
+ public void init(PolytomousKeyEditorInput input) {
+ this.input = input;
+
+
+ viewer.setInput(getKey());
+ if(getKey()!=null){
+ thisPart.setLabel(getKey().toString());
+ }
+ }
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ public PolytomousKeyEditorInput getEditorInput() {
+ return input;
+ }
+
+ //FIXME E4 migrate
+// private void createToolbar() {
+// getToolBarManager().add(getZoomContributionViewItem());
+// }
+
+ protected abstract IBaseLabelProvider getLabelProvider();
+
+ protected abstract IContentProvider getContentProvider();
+
+ /**
+ * Return the key that this editor
+ *
+ * @return
+ */
+ public abstract T getKey();
+
+ @Focus
+ public void setFocus() {
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().setFocus();
+ }
+ }
+
+ public void refresh() {
+ viewer.refresh();
+ }
+
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+
+ }
+
+ @Override
+ public AbstractZoomableViewer getZoomableViewer() {
+ return viewer;
+ }
+
+ protected LayoutAlgorithm getLayoutAlgoritm() {
+ if (layoutAlgoritm == null) {
+ // layoutAlgoritm = new CompositeLayoutAlgorithm(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING,
+ // new LayoutAlgorithm[] {
+ // new TreeLayoutAlgorithm(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING),
+ // new HorizontalShift(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
+
+ layoutAlgoritm = new TreeLayoutAlgorithm(
+ LayoutStyles.NO_LAYOUT_NODE_RESIZING);
+ layoutAlgoritm.setEntityAspectRatio(0.5);
+ }
+ return layoutAlgoritm;
+ }
+
+ private ZoomContributionViewItem getZoomContributionViewItem() {
+ if (zoomContributionViewItem == null) {
+ zoomContributionViewItem = new ZoomContributionViewItem(this);
+ }
+ return new ZoomContributionViewItem(this);
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ setDirty(true);
+ refresh();
+
+ if (objectAffectedByOperation instanceof PolytomousKeyNode) {
+ viewer.setSelection(new StructuredSelection(
+ objectAffectedByOperation), true);
+ }
+
+ return true;
+ }
+
+ //FIXME E4 migrate
+// private IToolBarManager getToolBarManager() {
+// if (toolBarManager == null) {
+// toolBarManager = getEditorSite().getActionBars()
+// .getToolBarManager();
+// }
+// return toolBarManager;
+// }
+
+ public void applyLayout() {
+ viewer.applyLayout();
+ }
+
+ @Override
+ public boolean onComplete() {
+ return true;
+ }
+
+ public void setDirty(boolean dirty) {
+ this.dirty.setDirty(dirty);
+ }
+
+ @Override
+ public void changed(Object element) {
+ setDirty(true);
+ viewer.update(element, null);
+ }
+
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.key.e4;
+
+import java.util.Vector;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
+
+/**
+ * @author n.hoffmann
+ * @created May 5, 2011
+ * @version 1.0
+ */
+public class KeyEditorDataChangeBehaviourE4 extends AbstractDataChangeBehaviour {
+
+ private final PolytomousKeyListEditorE4 source;
+ private PolytomousKeyEditorInput input;
+
+ public KeyEditorDataChangeBehaviourE4(PolytomousKeyListEditorE4 keyEditor) {
+ source = keyEditor;
+ }
+
+ @Override
+ public void reactOnDataChange(CdmDataChangeMap changeEvents) {
+ input = source.getEditorInput();
+
+ if(changeEvents.sizeByEventType(EventType.UPDATE) > 0){
+ reactOnUpdate(changeEvents.getEvents(EventType.UPDATE));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void reactOnUpdate(Vector<CdmDataChangeEvent> events){
+
+ for(CdmDataChangeEvent event : events){
+
+ // update editor title
+ if(event.getEntity() instanceof PolytomousKey){
+ if(input.getKey().equals(event.getEntity())){
+ // set the name of the editor window
+ source.setPartName();
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.key.e4.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
+
+/**
+ * @author n.hoffmann
+ *
+ */
+public class ApplyLayoutHandlerE4 extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+
+ if(editor instanceof AbstractGraphKeyEditor){
+ ((AbstractGraphKeyEditor) editor).applyLayout();
+ }
+
+ return null;
+ }
+
+}
public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<PolytomousKey> {
private final String name;
- private final UUID keyUuid;
private PolytomousKey key;
protected PolytomousKeyEditorInput(ConversationHolder conversation,
UUID polytomousKeyUuid) {
super(conversation);
- this.keyUuid = polytomousKeyUuid;
List<String> propertyPath = new ArrayList<>();
propertyPath.add("root");
propertyPath.add("root.*");
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return name;
- }
-
@Override
public PolytomousKey getKey() {
return key;
@Override
public void merge() {
key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
-
+
}
@Override
* @created Mar 30, 2011
* @version 1.0
*/
-class PolytomousKeyGraphContentProvider implements IGraphContentProvider {
+public class PolytomousKeyGraphContentProvider implements IGraphContentProvider {
private List<PolytomousKeyRelationship> relations;
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
- *
+ *
* @author n.hoffmann
* @created Mar 30, 2011
* @version 1.0
*/
-class PolytomousKeyLabelProvider extends LabelProvider implements
+public class PolytomousKeyLabelProvider extends LabelProvider implements
IEntityStyleProvider {
public static final String LEAF_BUT_NO_TAXON = Messages.PolytomousKeyLabelProvider_LEAF_BUT_NO_TAXON;
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#fisheyeNode(java.lang
* .Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getBackgroundColour
* (java.lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderColor(java
* .lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderHighlightColor
* (java.lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderWidth(java
* .lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getForegroundColour
* (java.lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getNodeHighlightColor
* (java.lang.Object)
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.zest.core.viewers.IEntityStyleProvider#getTooltip(java.lang
* .Object)
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
* @author n.hoffmann
if (selectedColumn == 5) {
Taxon taxon = getItemTaxon(node);
if (taxon != null) {
- try {
- EditorUtil.openTaxonBase((taxon).getUuid());
- } catch (PartInitException e) {
- MessagingUtils.error(getClass(), e);
- }
+ EditorUtil.openTaxonBaseE4((taxon).getUuid());
}
}
}
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.IFormPart;
import org.eclipse.ui.forms.IManagedForm;
// layoutComposite.setBackground(Display.getDefault().getSystemColor(
// SWT.COLOR_CYAN));
- this.entity = (PolytomousKeyNode) HibernateProxyHelper.deproxy(entity);
+ this.entity = HibernateProxyHelper.deproxy(entity);
Label label_nodeNumber = new Label(getLayoutComposite(), SWT.NULL);
label_nodeNumber.setText(getItemNumber());
linkSelectionListener = new SelectionAdapter() {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.swt.events.SelectionAdapter#widgetSelected(org
* .eclipse.swt.events.SelectionEvent)
Object data = e.widget.getData();
if (data instanceof Taxon) {
- try {
- EditorUtil.openTaxonBase(((Taxon) data).getUuid());
- } catch (PartInitException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+ EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid());
}
}
};
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
* )
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#isDirty()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#commit(boolean)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#setFocus()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#isStale()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#refresh()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.ui.forms.IFormPart#dispose()
*/
@Override
public PolytomousKeyNode getEntity() {
return entity;
}
-
+
@Override
public void setSelected(boolean selected) {
setBackground(selected ? SELECTED : getPersistentBackground());
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.ZestStyles;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.editor.key.e4.AbstractGraphKeyEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphContentProvider;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyLabelProvider;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
+/**
+ * @author n.hoffmann
+ *
+ */
+public class PolytomousKeyGraphEditorE4 extends
+ AbstractGraphKeyEditorE4<PolytomousKey> implements
+ IPolytomousKeyEditorPage, IPartContentHasDetails {
+
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.graph"; //$NON-NLS-1$
+
+ @Inject
+ public PolytomousKeyGraphEditorE4() {
+ }
+
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ if(!CdmStore.isActive()){
+ return;
+ }
+
+ formFactory = new CdmFormFactory(shell.getDisplay());
+ container = formFactory.createComposite(parent);
+
+ container.setLayout(new FillLayout());
+ viewer = new GraphViewer(container, SWT.NONE);
+
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+
+ viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
+
+ viewer.setLayoutAlgorithm(getLayoutAlgoritm(), false);
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeygrapheditor");
+
+ //FIXME E4 migrate
+// createToolbar();
+
+ container.addControlListener(new ControlListener() {
+
+ @Override
+ public void controlResized(ControlEvent e) {
+ // applyLayout();
+ }
+
+ @Override
+ public void controlMoved(ControlEvent e) {
+
+ }
+ });
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return getEditorInput()
+ .getConversationHolder();
+ }
+
+ @Override
+ public PolytomousKey getKey() {
+ return getEditorInput().getKey();
+ }
+
+ @Override
+ protected IBaseLabelProvider getLabelProvider() {
+ return new PolytomousKeyLabelProvider();
+ }
+
+ @Override
+ protected IContentProvider getContentProvider() {
+ return new PolytomousKeyGraphContentProvider();
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4;
+
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.di.Persist;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.e4.KeyEditorDataChangeBehaviourE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListContentProvider;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListLabelProvider;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ */
+public class PolytomousKeyListEditorE4 implements
+ IConversationEnabled, IDirtyMarkable, IPartContentHasDetails, IPartContentHasSupplementalData,
+ IPolytomousKeyEditorPage, IE4SavablePart{
+
+ private class LinkListener extends MouseAdapter {
+
+ @Override
+ public void mouseUp(MouseEvent event) {
+
+ if(event.button == 1 && event.count == 2) {
+ Table table = (Table) event.widget;
+ // Determine where the mouse was clicked
+ Point point = new Point(event.x, event.y);
+
+ int selectedColumn = getSelectedColumn(table, point);
+
+ if (table == null || point == null ){
+ return;
+ }
+
+ TableItem item = getTableItem(
+ table, point);
+ PolytomousKeyNode node ;
+ if (item != null){
+ node =(PolytomousKeyNode) item.getData();
+ } else{
+ return;
+ }
+ if (selectedColumn == 4) {
+ PolytomousKeyNode linkData = getItemLinkData(node);
+ if (linkData != null) {
+ viewer.setSelection(new StructuredSelection(linkData), true);
+ }
+ }
+ if (selectedColumn == 5) {
+ Taxon taxon = getItemTaxon(node);
+ if (taxon != null) {
+ EditorUtil.openTaxonBaseE4((taxon).getUuid(), modelService, partService, application);
+ }
+ }
+ }
+ }
+
+ private int getSelectedColumn(Table table, Point point) {
+ TableItem item = getTableItem(table, point);
+ if (item != null) {
+ for (int i = 0, n = table.getColumnCount(); i < n; i++) {
+ Rectangle rect = item.getBounds(i);
+ if (rect.contains(point)) {
+ // This is the selected column
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ private TableItem getTableItem(Table table, Point point) {
+ return table.getItem(point);
+ }
+
+ private PolytomousKeyNode getItemLinkData(PolytomousKeyNode node) {
+ return node.getChildren().isEmpty() ? null : node
+ .getChildAt(0);
+ }
+
+ private Taxon getItemTaxon(PolytomousKeyNode node) {
+ return node.getTaxon();
+ }
+ }
+
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.list"; //$NON-NLS-1$
+
+ private TableViewer viewer;
+
+ private KeyEditorDataChangeBehaviourE4 dataChangeBehavior;
+
+ private PolytomousKeyEditorInput input;
+
+ @Inject
+ private ESelectionService selService;
+
+ @Inject
+ private MDirtyable dirty;
+
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private EPartService partService;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ @Inject
+ private MPart thisPart;
+
+ @Inject
+ public PolytomousKeyListEditorE4() {
+ }
+
+ @Override
+ public void update(CdmDataChangeMap map) {
+ if(dataChangeBehavior == null){
+ dataChangeBehavior = new KeyEditorDataChangeBehaviourE4(this);
+ }
+ DataChangeBridge.handleDataChange(map, dataChangeBehavior);
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return input.getConversationHolder();
+ }
+
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor) {
+ try {
+ monitor.beginTask(Messages.KeyEditor_SAVING, 1);
+ getConversationHolder().bind();
+ getConversationHolder().commit(true);
+ input.merge();
+ dirty.setDirty(false);
+ monitor.worked(1);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ public void init(PolytomousKeyEditorInput input) {
+ this.input = input;
+
+ PolytomousKey key = input.getKey();
+ key = HibernateProxyHelper.deproxy(key, PolytomousKey.class);
+ key.setRoot(HibernateProxyHelper.deproxy(key.getRoot(), PolytomousKeyNode.class));
+ thisPart.setLabel(key.getTitleCache());
+
+ viewer.setInput(input);
+ }
+
+ public PolytomousKeyEditorInput getEditorInput() {
+ return input;
+ }
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService) {
+
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginWidth = 0;
+ fillLayout.marginHeight = 0;
+ fillLayout.type = SWT.VERTICAL;
+ parent.setLayout(fillLayout);
+
+ viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION);
+
+ createColumns(viewer);
+ viewer.getControl().addMouseListener(new LinkListener());
+ viewer.setContentProvider(new PolytomousKeyListContentProvider());
+ viewer.setLabelProvider(new PolytomousKeyListLabelProvider());
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.polytomouskeylisteditor");
+ }
+
+ public int getTableItemCount() {
+ if (viewer != null && viewer.getTable() != null) {
+ return viewer.getTable().getItemCount();
+ }
+ return 0;
+ }
+
+ public PolytomousKey getViewerInputKey() {
+ return ((PolytomousKeyEditorInput) viewer.getInput()).getKey();
+ }
+
+ // This will create the columns for the table
+ private void createColumns(TableViewer viewer) {
+ Table table = viewer.getTable();
+ String[] titles = { Messages.PolytomousKeyListEditor_NODE, Messages.PolytomousKeyListEditor_QUESTION, Messages.PolytomousKeyListEditor_EDGE, Messages.PolytomousKeyListEditor_STATEMENT, Messages.PolytomousKeyListEditor_LINK, Messages.PolytomousKeyListEditor_TAXON };
+ int[] bounds = { 50, 200, 50, 200, 100, 200 };
+
+ for (int i = 0; i < titles.length; i++) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ column.getColumn().setText(titles[i]);
+ column.getColumn().setWidth(bounds[i]);
+ column.getColumn().setResizable(true);
+ column.getColumn().setMoveable(true);
+ }
+ table.setHeaderVisible(true);
+ table.setLinesVisible(false);
+
+ }
+
+ @Focus
+ public void setFocus() {
+ if(viewer!=null && viewer.getControl()!=null){
+ viewer.getControl().setFocus();
+ }
+ if(input!=null){
+ input.bind();
+ }
+ }
+
+ @Override
+ public void changed(Object element) {
+ if(element != null) {
+ viewer.update(element, null);
+
+ }
+
+ if (element instanceof PolytomousKeyNode) {
+ List<PolytomousKeyNode> children = ((PolytomousKeyNode) element)
+ .getParent().getChildren();
+ for (PolytomousKeyNode child : children) {
+ viewer.update(child, null);
+ }
+ }
+ dirty.setDirty(true);
+ viewer.refresh();
+
+ }
+
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ viewer.refresh();
+
+ if (objectAffectedByOperation != null) {
+ viewer.setSelection(new StructuredSelection(
+ objectAffectedByOperation), true);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return true;
+ }
+
+ public void setPartName() {
+ PolytomousKey key = input.getKey();
+ thisPart.setLabel(key.getTitleCache());
+ }
+
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ */
+public class CreateChildNodeHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+
+ if(editor.getTableItemCount() == 0) {
+ PolytomousKey pk = editor.getViewerInputKey();
+ String label = menuItem.getLocalizedLabel();
+ IUndoContext undoContext = EditorUtil.getUndoContext();
+ editor.changed(null);
+
+ AbstractPostOperation operation = new CreateNodeOperation(
+ label, undoContext, pk.getRoot(), editor);
+ AbstractUtility.executeOperation(operation, sync);
+ } else {
+
+ String label = menuItem.getLocalizedLabel();
+ IUndoContext undoContext = EditorUtil.getUndoContext();
+
+ PolytomousKeyNode keyNode = (PolytomousKeyNode) selection
+ .getFirstElement();
+ editor.changed(null);
+ AbstractPostOperation operation = new CreateNodeOperation(
+ label, undoContext, keyNode, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection!=null
+ && !selection.isEmpty()
+ && selection.getFirstElement() instanceof PolytomousKeyNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ * Handler responsible for creating sibling nodes of Polytomous Key Nodes
+ *
+ * @author c.mathew
+ *
+ */
+
+public class CreateSiblingNodeHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+
+ String label = menuItem.getLocalizedLabel();
+ IUndoContext undoContext = EditorUtil.getUndoContext();
+
+ PolytomousKeyNode keyNode = (PolytomousKeyNode) selection.getFirstElement();
+ editor.changed(null);
+ AbstractPostOperation operation = new CreateNodeOperation(label, undoContext, keyNode.getParent(),
+ editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection!=null
+ && !selection.isEmpty()
+ && selection.getFirstElement() instanceof PolytomousKeyNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.DeleteNodeOperation;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+
+/**
+ * @author n.hoffmann
+ * @created Dec 6, 2010
+ * @version 1.0
+ */
+public class DeleteNodeHandlerE4 extends RemotingCdmHandlerE4 {
+
+
+ private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE = Messages.DeleteNodeHandler_REALLY_DELETE;
+ private static final String CONFIRM_DELETION_OF_CHILDREN = Messages.DeleteNodeHandler_CONFIRM_DELETE;
+ private static final String NO = Messages.DeleteNodeHandler_NO;
+ private static final String CANCEL = Messages.DeleteNodeHandler_CANCEL;
+ private static final String YES = Messages.DeleteNodeHandler_YES;
+ PolytomousKeyNode nodeToBeDeleted;
+ boolean deleteChildren;
+
+ public DeleteNodeHandlerE4(String label) {
+ super(label);
+ }
+
+ public DeleteNodeHandlerE4() {
+ super(PolytomousKeyEditorLabels.DELETE_NODE_POLYTOMOUS_KEY_NODE_LABEL);
+ }
+
+ @Override
+ public IStatus allowOperations(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ if (selection.getFirstElement() instanceof PolytomousKeyNode) {
+ label = menuItem.getLocalizedLabel();
+ PolytomousKeyNode node = (PolytomousKeyNode)selection.getFirstElement();
+ nodeToBeDeleted = node;
+ MessageDialog dialog;
+ if (node.getChildren().size()>0){
+ String[] buttonLables = {YES, NO,CANCEL};
+ dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE+Messages.DeleteNodeHandler_NODE_HAS_CHILDREN, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+ int returnCode = dialog.open();
+
+ if (returnCode == 0){
+ deleteChildren = false;
+ } else if (returnCode == 1){
+ deleteChildren = true;
+ } else{
+ return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$
+ null);
+ }
+
+
+ }else{
+ String[] buttonLables = {YES, CANCEL};
+ dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 1);
+ int returnCode = dialog.open();
+
+ if (returnCode == 0){
+ deleteChildren = false;
+ } else if (returnCode == 1){
+ return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$
+ null);
+ }
+ }
+ } else {
+ MessageDialog.openInformation(
+ shell,
+ PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED,
+ PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE
+ );
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public AbstractOperation prepareOperation(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ IUndoContext undoContext = EditorUtil.getUndoContext();
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+ if (editor.isDirty()){
+ boolean proceed = MessageDialog.openQuestion(null,
+ Messages.DeleteNodeHandler_SAVE_CHANGES_TITLE, Messages.DeleteNodeHandler_SAVE_CHANGES_MESSAGE);
+ if (!proceed) {
+ return null;
+ }else{
+ editor.save(AbstractUtility.getMonitor());
+ }
+ }
+
+ label = menuItem.getLocalizedLabel();
+ DeleteNodeOperation operation ;
+ if (deleteChildren){
+ operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, true);
+ }else{
+ operation = new DeleteNodeOperation(label, undoContext, nodeToBeDeleted, editor, false);
+ }
+ return operation;
+ }
+
+ @Override
+ public void onComplete() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection!=null && !selection.isEmpty();
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Copyright (C) 2016 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.InsertPolytomousKeyNodeOperation;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+
+/**
+ * @author k.luther
+ * @date 17.11.2016
+ *
+ */
+public class InsertNewNodeHandlerE4 extends RemotingCdmHandlerE4{
+
+ private PolytomousKeyNode parentNode ;
+
+
+ public InsertNewNodeHandlerE4() {
+ super(PolytomousKeyEditorLabels.INSERT_NODE_POLYTOMOUS_KEY_NODE_LABEL);
+ }
+
+ @Override
+ public IStatus allowOperations(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+
+ if(editor.getTableItemCount() == 0) {
+ PolytomousKey pk = editor.getViewerInputKey();
+ parentNode = pk.getRoot();
+
+ } else {
+ if (selection.getFirstElement() instanceof PolytomousKeyNode) {
+ parentNode = ((PolytomousKeyNode) selection.getFirstElement()).getParent();
+ } else {
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public AbstractOperation prepareOperation(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem) {
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+ editor.changed(null);
+ return new InsertPolytomousKeyNodeOperation(getTrigger(), false, parentNode, editor);
+ }
+
+ @Override
+ public void onComplete() {
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
+}
--- /dev/null
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+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.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+
+public class OpenPolytomousGraphEditorHandler {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyGraphEditorE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ PolytomousKeyGraphEditorE4 graphEditor = (PolytomousKeyGraphEditorE4) part.getObject();
+ PolytomousKeyListEditorE4 listEditor = (PolytomousKeyListEditorE4) activePart.getObject();
+ graphEditor.init(listEditor.getEditorInput());
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.RefreshNodeNumberingOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+public class RefreshNodeNumberingHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync){
+
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) activePart.getObject();
+
+ if (selection.getFirstElement() instanceof PolytomousKeyNode) {
+ String label = menuItem.getLocalizedLabel();
+ IUndoContext undoContext = EditorUtil.getUndoContext();
+
+ PolytomousKeyNode keyNode = (PolytomousKeyNode) selection
+ .getFirstElement();
+
+ AbstractPostOperation operation = new RefreshNodeNumberingOperation(
+ label, undoContext, keyNode, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+ }
+
+}
AbstractPostOperation operation = new CreateNodeOperation(
label, undoContext, pk.getRoot(), editorPage);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
AbstractPostOperation operation = new CreateNodeOperation(
label, undoContext, keyNode, editorPage);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
AbstractPostOperation operation = new CreateNodeOperation(
label, undoContext, keyNode.getParent(), editorPage);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation;
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.RefreshNodeNumberingOperation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
.getActiveEditor();
if (editorPage instanceof PolytomousKeyListEditor) {
-
+
IStructuredSelection selection = (IStructuredSelection) HandlerUtil
.getCurrentSelection(event);
AbstractPostOperation operation = new RefreshNodeNumberingOperation(
label, undoContext, keyNode, editorPage);
- EditorUtil.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
- }
+ }
}
- }
+ }
return null;
}
public static String OpenChecklistEditorHandler_CHOOSE_AREA;
public static String OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE;
public static String OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE;
- public static String OpenChecklistEditorHandler_FAILED_TO_OPEN;
public static String OpenChecklistEditorHandler_GOTO_PREFERENCES;
public static String OpenChecklistEditorHandler_NO_AREAS;
public static String OpenDerivateEditorForTaxonHandler_COULD_NOT_OPEN_EDITOR;
OpenChecklistEditorHandler_CHOOSE_AREA=Please choose the areas you want to display.
OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE=Could not open Distribution Editor.
OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE=Could not open Distribution Editor
-OpenChecklistEditorHandler_FAILED_TO_OPEN=Failed to open Editor
OpenChecklistEditorHandler_GOTO_PREFERENCES=For this go to the preferences, choose the Checklist Editor and choose the areas in the Distribution Selection Wizard.
OpenChecklistEditorHandler_NO_AREAS=No Areas to display
OpenDerivateViewHandler_COULD_NOT_OPEN=Specimen editor could not be opened
OpenChecklistEditorHandler_CHOOSE_AREA=Bitte wählen Sie das Gebiet aus, das dargestellt werden soll
OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE=Der Verbreitungs-Editor konnte nicht geöffnet werden
OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE=Der Verbreitungs-Editor konnte nicht geöffnet werden
-OpenChecklistEditorHandler_FAILED_TO_OPEN=Der Editor konnte nicht geöffnet werden
OpenChecklistEditorHandler_GOTO_PREFERENCES=Hierfür gehen Sie zu den Preferences, wählen Sie Checklist Editor und dann die Gebiete in dem Verbreitungs-Wizard.
OpenChecklistEditorHandler_NO_AREAS=Keine Gebiete, die angezeigt werden können
OpenDerivateViewHandler_COULD_NOT_OPEN=Specimen-Editor konnte nicht geöffnet werden.
TaxonEditorInput_NOT_IMPLEMENTED=Noch nicht implementiert
TaxonEditorInput_NOT_IMPLEMENTED_MESSAGE=Ausgewähltes Element ist nicht vom Typ TaxonBase.
TaxonEditorInput_OPEN_MISSAPPLIED_NAME=Öffnen einer Misapplikation
-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.
+TaxonEditorInput_TAXON_NOT_IN_CLASSIFICATION=Das akzeptierte Taxon ist in keiner Klassifikation vorhanden. Editieren mit dem Namens-Editor ist noch nicht implementiert. 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=Mit Taxonauswahl verknüpfen
+++ /dev/null
-/**
- * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.editor.name;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang.StringUtils;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.ManagedForm;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-import org.eclipse.ui.part.EditorPart;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.IDropTargetable;
-import eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage;
-import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.SimpleSelectionProvider;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
-import eu.etaxonomy.taxeditor.editor.name.container.AcceptedGroup;
-import eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer;
-import eu.etaxonomy.taxeditor.editor.name.container.ContainerFactory;
-import eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup;
-import eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup;
-import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDropTargetListener;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.IPartChangeListener;
-import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.TaxeditorPartService;
-import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.security.RequiredPermissions;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * <p>
- * TaxonNameEditor class.
- * </p>
- *
- * @author p.ciardelli
- * @author n.hoffmann
- * @created 15.05.2008
- * @version 1.0
- */
-public class TaxonNameEditor extends EditorPart implements
- IMultiPageTaxonEditorPage, IConversationEnabled,
- IPartContentHasDetails, IPartChangeListener,
- ISelectionListener, IDropTargetable, ISecuredEditor {
-
- /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon.name"</code> */
- public static final String ID = "eu.etaxonomy.taxeditor.editor.taxon.name"; //$NON-NLS-1$
-
- private Taxon taxon;
-
- private ManagedForm managedForm;
- private ScrolledForm scrolledForm;
- private Composite parent;
- private ISelectionProvider simpleSelectionProvider;
-
- private final MultiPageTaxonEditor editor;
-
- private TaxonBase selection;
-
- private final ConversationHolder conversation;
-
- private MenuManager menuManager;
- private Menu menu;
-
- private AcceptedGroup acceptedGroup;
- private List<HomotypicalSynonymGroup> heterotypicSynonymGroups = new ArrayList<HomotypicalSynonymGroup>();
- private MisappliedGroup misappliedGroup;
-
- private DropTarget target;
-
- private ISelectionService selectionService;
-
- private TaxonBase objectAffectedByLastOperation;
-
- private ICdmEntitySession cdmEntitySession;
-
- /**
- * <p>
- * Constructor for TaxonNameEditor.
- * </p>
- *
- * @param editor
- * a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
- * object.
- */
- public TaxonNameEditor(MultiPageTaxonEditor editor) {
- this.editor = editor;
- conversation = editor.getConversationHolder();
- }
-
- /**
- * <p>
- * getUndoContext
- * </p>
- *
- * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
- * object.
- */
- public IUndoContext getUndoContext() {
- return editor.getUndoContext();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
- * .Composite)
- */
- /** {@inheritDoc} */
- @Override
- public void createPartControl(Composite composite) {
- selectionService = getSite().getWorkbenchWindow().getSelectionService();
- selectionService.addSelectionListener(this);
-
- createManagedForm(composite);
-
- TaxeditorPartService.getInstance().addListener(
- TaxeditorPartService.PART_ACTIVATED, this);
- }
-
- /**
- * <p>
- * createManagedForm
- * </p>
- *
- * @param composite
- * a {@link org.eclipse.swt.widgets.Composite} object.
- */
- protected void createManagedForm(Composite composite) {
-
- managedForm = new ManagedForm(composite) {
-
- @Override
- public void dirtyStateChanged() {
- firePropertyChange(PROP_DIRTY);
- }
-
- @Override
- public boolean setInput(Object input) {
- if (input instanceof AbstractGroupedContainer) {
- selection = ((AbstractGroupedContainer) input).getData();
- getSite().getSelectionProvider().setSelection(new StructuredSelection(selection));
- }else if(input == null){
- selection = null;
- getSite().getSelectionProvider().setSelection(new StructuredSelection());
- }
-
-
- return super.setInput(input);
- }
- };
-
- scrolledForm = managedForm.getForm();
- parent = scrolledForm.getBody();
-
- // register the context menu
- menuManager = new MenuManager();
- ISelectionProvider selectionProvider = getSite().getSelectionProvider();
- getSite().registerContextMenu(TaxonNameEditor.ID, menuManager,
- selectionProvider);
- menuManager.setRemoveAllWhenShown(true);
-
- parent.setData(taxon);
-
- TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = 0;
- layout.rightMargin = 0;
- layout.topMargin = 0;
- layout.bottomMargin = 0;
-
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
-
- parent.setLayout(layout);
- parent.setBackground(AbstractUtility
- .getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-
- createOrUpdateNameComposites();
-
- createDragSupport();
-
- setFocus();
- }
-
- /**
- * <p>
- * createNameComposites
- * </p>
- */
- public void createOrUpdateNameComposites() {
-// this.taxon = (Taxon)CdmStore.getService(ITaxonService.class).load(this.getTaxon().getUuid());
- ContainerFactory.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
- ContainerFactory.createOrUpdateHeterotypicSynonymyGroups(this);
- ContainerFactory.createOrUpdateMisapplicationsGroup(this);
-
-
- // Redraw composite
- managedForm.reflow(true);
- }
-
- /**
- * <p>
- * Getter for the field <code>taxon</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- */
- public Taxon getTaxon() {
- return HibernateProxyHelper.deproxy(taxon);
- }
-
- /**
- * <p>
- * setDirty
- * </p>
- */
- public void setDirty() {
- managedForm.dirtyStateChanged();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- /** {@inheritDoc} */
- @Override
- public void setFocus() {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
- if (getSelectedContainer() == null) {
- throw new IllegalStateException(
- Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE);
- }
- getSelectedContainer().setSelected();
-
- // check permissions
- boolean doEnable = permissionsSatisfied();
- setEnabled(doEnable);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.ISecuredEditorPart#permissionsSatisfied()
- */
- @Override
- public boolean permissionsSatisfied() {
- TaxonNode taxonNode = ((TaxonEditorInput)getEditorInput()).getTaxonNode();
- boolean doEnable = CdmStore.currentAuthentiationHasPermission(taxonNode, RequiredPermissions.TAXONNODE_EDIT);
- return doEnable;
- }
-
- /** {@inheritDoc} */
- @Override
- public void setInput(IEditorInput input) {
- this.setInputWithNotify(input);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
- * ()
- */
- /**
- * <p>
- * getConversationHolder
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
- * object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu
- * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
- */
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap events) {
- // redraw();
- }
-
- /**
- * Redraws this editor return true on success
- *
- * @return a boolean.
- */
- @Override
- public boolean redraw() {
- return redraw(true);
- }
-
- /**
- * {@inheritDoc}
- *
- * Redraws the editor controls
- */
- @Override
- public boolean redraw(boolean focus) {
-
- createOrUpdateNameComposites();
-
- if (focus) {
- setFocus();
- }
-
- return true;
- }
-
- /**
- * <p>
- * getMultiPageTaxonEditor
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
- * object.
- */
- public MultiPageTaxonEditor getMultiPageTaxonEditor() {
- return editor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation
- * ()
- */
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
-
- editor.changed(objectAffectedByOperation);
-
- redraw(false);
-
- if (objectAffectedByOperation instanceof TaxonBase) {
- objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
- }
-
- return true;
- }
-
- /**
- * <p>
- * Getter for the field <code>managedForm</code>.
- * </p>
- *
- * @return the managedForm
- */
- public ManagedForm getManagedForm() {
- return managedForm;
- }
-
- /**
- * <p>
- * getControl
- * </p>
- *
- * @return a {@link org.eclipse.swt.widgets.Composite} object.
- */
- @Override
- public Composite getControl() {
- return this.getManagedForm().getForm().getBody();
- }
-
- /**
- * <p>
- * Getter for the field <code>menu</code>.
- * </p>
- *
- * @return the menu
- */
- public Menu getMenu() {
- if (menu == null || menu.isDisposed()) {
- // Creating the menu because it was either not initialised or
- // disposed while refreshing the editor
- menu = menuManager.createContextMenu(parent);
- }
- return menu;
- }
-
- /**
- * <p>
- * checkForEmptyNames
- * </p>
- *
- * @return true if there are empty names
- */
- public boolean checkForEmptyNames() {
- for (AbstractGroupedContainer container : getGroupedContainers()) {
- if (container.getName() == null
- || StringUtils.isEmpty(container.getName().getTitleCache())) {
- return true;
- }
- }
- return false;
- }
-
- public Set<AbstractGroupedContainer> getEmptyContainers() {
- Set<AbstractGroupedContainer> containersWithEmptyNames = new HashSet<AbstractGroupedContainer>();
-
- for (AbstractGroupedContainer container : getGroupedContainers()) {
- if (container.getName() == null
- || StringUtils.isEmpty(container.getName().getTitleCache())) {
- containersWithEmptyNames.add(container);
- }
- }
-
- return containersWithEmptyNames;
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSave(IProgressMonitor monitor) {
-
- monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size());
-
- try {
- // check for empty names
- for (AbstractGroupedContainer container : getGroupedContainers()) {
-
- monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES
- + container.getTaxonBase().getTitleCache());
- container.persistName();
-
- // In case the progress monitor was canceled throw an exception.
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- // Otherwise declare this step as done.
- monitor.worked(1);
- }
- } finally {
-
- // Stop the progress monitor.
- monitor.done();
- }
-
- }
-
- /** {@inheritDoc} */
- @Override
- public void doSaveAs() {
- }
-
- /** {@inheritDoc} */
- @Override
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
-
- if (!(input != null)) {
- throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT);
- }
-
- if (input.getAdapter(Taxon.class) != null) {
- taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class);
- } else {
- throw new PartInitException(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL);
- }
-
- setSite(site);
- setInput(input);
-
- simpleSelectionProvider = new SimpleSelectionProvider();
- getSite().setSelectionProvider(simpleSelectionProvider);
- }
-
-
- /**
- *
- */
- private void createDragSupport() {
- // Listen for names being dragged outside of existing homotypic groups -
- // user wants to create a new group
- Transfer[] types = new Transfer[] { CdmDataTransfer.getInstance() };
- int operations = DND.DROP_MOVE;
- if (target == null) {
- target = new DropTarget(parent, operations);
- target.setTransfer(types);
- target.addDropListener(new NameEditorDropTargetListener(this));
- }
- }
-
- /**
- * <p>
- * Getter for the field <code>acceptedNameContainer</code>.
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer}
- * object.
- */
- public AcceptedNameContainer getAcceptedNameContainer() {
- return getAcceptedGroup().getAcceptedNameContainer();
- }
-
- /**
- * <p>
- * getSynonymGroup
- * </p>
- *
- * @param homotypicalGroup
- * a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
- * object.
- */
- public HomotypicalSynonymGroup getHomotypicalGroupContainer(
- HomotypicalGroup homotypicalGroup) {
- for (HomotypicalSynonymGroup group : getHeterotypicSynonymGroups()) {
- if (group.getGroup().equals(homotypicalGroup)) {
- return group;
- }
- }
-
- return null;
- }
-
- /**
- * <p>
- * getDirtyNames
- * </p>
- *
- * @return a Set containing all composites that have been edited
- */
- public Set<AbstractGroupedContainer> getDirtyNames() {
- Set<AbstractGroupedContainer> dirtyNames = new HashSet<AbstractGroupedContainer>();
-
- for (AbstractGroupedContainer composite : getGroupedContainers()) {
- if (composite.isDirty()) {
- dirtyNames.add(composite);
- }
- }
-
- return dirtyNames;
- }
-
- /**
- * <p>
- * getGroupedContainers
- * </p>
- *
- * @return a {@link java.util.List} object.
- */
- public List<AbstractGroupedContainer> getGroupedContainers() {
- List<AbstractGroupedContainer> groupedComposites = new ArrayList<AbstractGroupedContainer>();
-
- for (AbstractGroup group : getAllGroups()) {
- groupedComposites.addAll(group.getGroupedContainers());
- }
-
- return groupedComposites;
- }
-
- /**
- * <p>
- * getAllGroups
- * </p>
- *
- * @return a {@link java.util.List} object.
- */
- public List<AbstractGroup> getAllGroups() {
- List<AbstractGroup> allGroups = new ArrayList<AbstractGroup>();
-
- allGroups.add(getAcceptedGroup());
-
-// List<HomotypicalSynonymGroup> grps = getHeterotypicSynonymGroups(); // UNUSED => remove
-
- heterotypicSynonymGroups = getHeterotypicSynonymGroups();
-
- if (heterotypicSynonymGroups != null) {
- allGroups.addAll(heterotypicSynonymGroups);
- }
-
- if (misappliedGroup != null) {
- allGroups.add(misappliedGroup);
- }
-
- return allGroups;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.EditorPart#isDirty()
- */
- /** {@inheritDoc} */
- @Override
- public boolean isDirty() {
- return editor.isDirty();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.WorkbenchPart#dispose()
- */
- /** {@inheritDoc} */
- @Override
- public void dispose() {
- conversation.unregisterForDataStoreChanges(this);
- super.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
- */
- /** {@inheritDoc} */
- @Override
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.
- * IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
- */
- /** {@inheritDoc} */
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-
- }
-
- /**
- * <p>
- * getNameEditor
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor}
- * object.
- */
- @Override
- public TaxonNameEditor getEditor() {
- return this;
- }
-
- /**
- * <p>
- * Getter for the field <code>selectedObject</code>.
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer}
- * object.
- */
- public AbstractGroupedContainer getSelectedContainer() {
-
- TaxonBase selectedTaxonBase = null;
-
- TaxonEditorInput input = (TaxonEditorInput) editor.getEditorInput();
- if (input.getInitiallySelectedTaxonBase() != null) {
- selectedTaxonBase = input.getInitiallySelectedTaxonBase();
- } else {
- if (selection != null) {
- selectedTaxonBase = selection;
- }
- }
-
- return (selectedTaxonBase != null) ? getContainer(selectedTaxonBase)
- : getAcceptedNameContainer();
- }
-
- /**
- * <p>
- * dragEntered
- * </p>
- */
- @Override
- public void dragEntered() {
- // TODO change this
- getControl().setBackground(
- AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
- }
-
- /**
- * <p>
- * dragLeft
- * </p>
- */
- @Override
- public void dragLeft() {
- getControl().setBackground(
- AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
- }
-
-
- /**
- * <p>
- * setMisapplicationsGroup
- * </p>
- *
- * @param misappliedGroup
- * a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
- * object.
- */
- public void setMisapplicationsGroup(MisappliedGroup misappliedGroup) {
- this.misappliedGroup = misappliedGroup;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#isRedrawing()
- */
- /**
- * <p>
- * isRedrawing
- * </p>
- *
- * @return a boolean.
- */
- @Override
- public boolean isRedrawing() {
- return false;
- }
-
- /**
- * <p>
- * getToolkit
- * </p>
- *
- * @return a {@link org.eclipse.ui.forms.widgets.FormToolkit} object.
- */
- public FormToolkit getToolkit() {
- return managedForm.getToolkit();
- }
-
- /**
- * <p>
- * getHeterotypicSynonymGroups
- * </p>
- *
- * @return a {@link java.util.List} object.
- */
- public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups() {
- return heterotypicSynonymGroups;
- }
-
- /**
- * <p>
- * addHeterotypicSynonymGroup
- * </p>
- *
- * @param group
- * a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
- * object.
- */
- public void addHeterotypicSynonymGroup(HomotypicalSynonymGroup group) {
- heterotypicSynonymGroups.add(group);
- }
-
- /**
- * <p>
- * getHomotypicSynonymGroup
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
- * object.
- */
- public AcceptedGroup getAcceptedGroup() {
- return acceptedGroup;
- }
-
- /**
- *
- * @param acceptedGroup
- */
- public void setAcceptedGroup(AcceptedGroup acceptedGroup) {
- this.acceptedGroup = acceptedGroup;
- }
-
- /**
- * <p>
- * Getter for the field <code>misappliedGroup</code>.
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
- * object.
- */
- public MisappliedGroup getMisappliedGroup() {
- return misappliedGroup;
- }
-
- // TODO not very useful at the moment
- /**
- * <p>
- * isActive
- * </p>
- *
- * @return a boolean.
- */
- public boolean isActive() {
- return editor.equals(AbstractUtility.getActiveE4Part());
- }
-
- /**
- * <p>
- * onComplete
- * </p>
- *
- * @return a boolean.
- */
- @Override
- public boolean onComplete() {
- getContainer(objectAffectedByLastOperation).setSelected();
- return true;
- }
-
- /** {@inheritDoc} */
- @Override
- public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
- if (!partRef.getPart(false).equals(editor)) {
- // getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
- }
- }
-
- /**
- * @param retainedGroup
- */
- public void removeGroup(AbstractGroup group) {
- if (group != null) {
- group.dispose();
-
- //if (heterotypicSynonymGroups != null) {
- heterotypicSynonymGroups.remove(group);
- //}
- }
- }
-
- /**
- * @param element
- * @return
- */
- public AbstractGroupedContainer getContainer(TaxonBase taxonBase) {
- List<AbstractGroupedContainer> groupedContainers = getGroupedContainers();
- for (AbstractGroupedContainer container : groupedContainers) {
- if (container.getData().equals(taxonBase)
- && container.getNameViewer().getTextWidget() != null) {
- return container;
- }
- }
- return getAcceptedNameContainer();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#setOnError()
- */
- @Override
- public void setOnError() {
- Color disabledColor = AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
- setEnabled(false, disabledColor);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#setDisabled()
- */
- @Override
- public void setDisabled(){
- Color disabledColor = AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
- setEnabled(false);
- }
-
- protected void setEnabled(boolean enabled, Color background) {
-
- for(AbstractGroupedContainer groupedContainer : getGroupedContainers()){
- groupedContainer.setEnabled(enabled);
- }
-
- // send an empty selection to the current provider - TODO only on error ???
- if (!enabled) {
- getManagedForm().setInput(null);
-
- for (AbstractGroupedContainer groupedContainer : getGroupedContainers()) {
- groupedContainer.setBackground(background);
- }
- }
- getControl().setBackground(background);
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- Color background = AbstractUtility.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
- setEnabled(enabled, background);
- }
-
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Color;
-
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
-/**
- * @author n.hoffmann
- * @created Jan 20, 2011
- * @version 1.0
- */
-public class AcceptedGroup extends AbstractHomotypicalGroupContainer {
-
- private AcceptedNameContainer acceptedContainer;
-
- /**
- * @param editor
- * @param group
- */
- public AcceptedGroup(TaxonNameEditor editor, HomotypicalGroup group) {
- super(editor, group);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragEntered()
- */
- @Override
- public void dragEntered() {
- Color color = EditorUtil.getColor(Resources.COLOR_DRAG_ENTER);
- acceptedContainer.setBackground(color);
- super.dragEntered();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#dragLeft()
- */
- @Override
- public void dragLeft() {
- acceptedContainer.restoreColor();
- super.dragLeft();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup#getGroupedContainers()
- */
- @Override
- public List<AbstractGroupedContainer> getGroupedContainers() {
- List<AbstractGroupedContainer> containers = new ArrayList<AbstractGroupedContainer>();
- containers.add(getAcceptedNameContainer());
- containers.addAll(super.getGroupedContainers());
- return containers;
- }
-
- /**
- *
- */
- protected void createContainers() {
- this.acceptedContainer = new AcceptedNameContainer(getEditor().getTaxon());
- acceptedContainer.setGroup(this);
-
- acceptedContainer.createContent();
-
- createSynonymContainer();
- }
-
- protected void createSynonymContainer(){
- for(Synonym synonym : getSynonyms()){
- SynonymContainer container = new SynonymContainer(this, synonym);
- this.add(container);
- container.createContent();
- }
- }
-
- /**
- * @param acceptedNameContainer
- */
- public void setAcceptedNameContainer(AcceptedNameContainer acceptedNameContainer) {
- this.acceptedContainer = acceptedNameContainer;
- acceptedContainer.setGroup(this);
- }
-
- public AcceptedNameContainer getAcceptedNameContainer(){
- return acceptedContainer;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#emptyGroup()
- */
- @Override
- protected void emptyGroup() {
- acceptedContainer.dispose();
- acceptedContainer = null;
- super.emptyGroup();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractHomotypicalGroupContainer#redrawNeeded(eu.etaxonomy.cdm.model.name.HomotypicalGroup)
- */
- @Override
- protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup) {
- if(! acceptedContainer.getData().equals(getEditor().getTaxon())){
- return true;
- }
- return super.redrawNeeded(homotypicalGroup);
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import org.eclipse.swt.graphics.Font;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
-/**
- * <p>AcceptedNameContainer class.</p>
- *
- * @author p.ciardelli
- * @created 13.01.2009
- * @version 1.0
- */
-public class AcceptedNameContainer extends AbstractGroupedContainer<Taxon> {
-
- private AcceptedGroup acceptedGroup;
-
-
- /**
- * <p>Constructor for AcceptedNameContainer.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
- */
- public AcceptedNameContainer(Taxon taxon) {
- super(taxon);
- }
-
-
- /**
- * <p>initializeComposite</p>
- */
- public void initializeComposite(){
- setFont(getViewerFont());
-
- initTextViewer();
- }
-
- /** {@inheritDoc} */
- @Override
- protected Font getViewerFont() {
- return EditorUtil.getFont(Resources.ACCEPTED_TAXON_FONT);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#setGroup(eu.etaxonomy.taxeditor.editor.name.AbstractGroup)
- */
- public void setGroup(AcceptedGroup group) {
- this.acceptedGroup = group;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#getGroup()
- */
- @Override
- public AbstractGroup getGroup() {
- return acceptedGroup;
- }
-
- /** {@inheritDoc} */
- @Override
- protected void updateNonEditableInfo() {
- // not needed
- }
-
-
- @Override
- protected void updateIcon() {
- setIcon(ACCEPTED_ICON);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
- */
- @Override
- protected void updateIndent() {
- setIndent(ACCEPTED_INDENT);
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import org.eclipse.swt.graphics.Font;
-
-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.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
-/**
- * <p>ConceptContainer class.</p>
- *
- * @author p.ciardelli
- * @created 26.01.2009
- * @version 1.0
- */
-public class ConceptContainer extends AbstractGroupedContainer<Taxon> {
-
- private final TaxonRelationshipType relationshipType;
-
-
- private ConceptContainer(TaxonNameEditor editor, AbstractGroup group,
- Taxon relatedTaxon, TaxonRelationshipType relationshipType,
- boolean acceptedTaxonIsFromTaxon) {
- super(relatedTaxon);
-
- // FIXME the acceptedTaxonIsFromTaxon is never used and
- // I can't remember what is was used for in the first place
-
- this.relationshipType = relationshipType;
- showRelationshipType();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.NameComposite#initializeComposite()
- */
- /** {@inheritDoc} */
- @Override
- protected void initializeComposite() {
-
- setIsDraggable(true);
- setFont(getViewerFont());
-
- showSec();
-
- initTextViewer();
- }
-
- @Override
- protected void updateIcon() {
- setIcon(CONCEPT_ICON);
- }
-
- private void showRelationshipType() {
- setNonEditableInfo(relationshipType.getLabel(), true);
- }
-
- private void showSec() {
- if (getTaxonBase() == null) {
- return;
- }
-
- if (getTaxonBase().getSec() == null) {
- setNonEditableInfo("sec. ???", false); //$NON-NLS-1$
- } else {
- setNonEditableInfo("sec. " + getTaxonBase().getSec().getTitleCache(), false); //$NON-NLS-1$
- }
- }
-
- /**
- * <p>getNewInstance</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
- * @param relationship a {@link eu.etaxonomy.cdm.model.taxon.TaxonRelationship} object.
- * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.ConceptContainer} object.
- */
- public static ConceptContainer getNewInstance(TaxonNameEditor editor, AbstractGroup group, TaxonRelationship relationship){
-
- TaxonRelationshipType relationshipType = relationship.getType();
-
- if (relationship.getToTaxon().equals(editor.getTaxon())) {
- return new ConceptContainer (editor, group,
- relationship.getFromTaxon(), relationshipType, false);
- } else {
- return new ConceptContainer (editor, group,
- relationship.getToTaxon(), relationshipType, true);
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.GroupedComposite#getViewerFont()
- */
- /** {@inheritDoc} */
- @Override
- protected Font getViewerFont() {
- return EditorUtil.getFont(Resources.CONCEPT_FONT);
- }
-
- /**
- * <p>getRelatedTaxon</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- */
- public Taxon getRelatedTaxon() {
- return getTaxonBase();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer#showAnnotations()
- */
- @Override
- public void showAnnotations() {
- if(getData().getSec() == null){
- getNameViewer().addAnnotation(
- new EditorAnnotation(0, Messages.ConceptContainer_SEC_REQUIRED));
- }
- super.showAnnotations();
- }
-
- /** {@inheritDoc} */
- @Override
- protected void updateNonEditableInfo() {
- showSec();
- showRelationshipType();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
- */
- @Override
- protected void updateIndent() {
- setIndent(CONCEPT_INDENT);
- }
-}
-
-
-
-
-
-
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-
-/**
- * <p>ConceptGroup class.</p>
- *
- * @author p.ciardelli
- * @created 21.01.2009
- * @version 1.0
- */
-public class ConceptGroup extends AbstractGroup {
-
- /**
- * <p>Constructor for ConceptGroup.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- */
- public ConceptGroup(TaxonNameEditor editor) {
- super(editor);
- }
-
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#createContents()
- */
- @Override
- protected void createContainers() {
- // TODO Auto-generated method stub
-
- }
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-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.editor.name.TaxonNameEditor;
-
-/**
- * <p>ContainerFactory class.</p>
- *
- * @author n.hoffmann
- * @version $Id: $
- */
-public class ContainerFactory {
-
- /**
- * @param taxonNameEditor
- */
- public static void createOrUpdateAcceptedTaxonsHomotypicGroup(
- TaxonNameEditor taxonNameEditor) {
-
- if(taxonNameEditor.getAcceptedGroup() == null){
- taxonNameEditor.setAcceptedGroup(new AcceptedGroup(taxonNameEditor, taxonNameEditor.getTaxon().getHomotypicGroup()));
- }
- else{
- taxonNameEditor.getAcceptedGroup().redraw(taxonNameEditor.getTaxon().getHomotypicGroup());
- }
-
- }
-
- /**
- * @param taxonNameEditor
- */
- public static void createOrUpdateHeterotypicSynonymyGroups(
- TaxonNameEditor taxonNameEditor) {
- List<HomotypicalSynonymGroup> retainedGroups = new ArrayList<HomotypicalSynonymGroup>();
-
- List<HomotypicalSynonymGroup> heterotypicSynonymGroups = taxonNameEditor.getHeterotypicSynonymGroups();
-
- if (heterotypicSynonymGroups != null) {
-
- for(HomotypicalSynonymGroup group : heterotypicSynonymGroups){
- retainedGroups.add(group);
- }
- }
-
- for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
- HomotypicalSynonymGroup group = createOrUpdateHeterotypicSynonymyGroup(taxonNameEditor, homotypicalGroup);
-
- retainedGroups.remove(group);
- }
-
- for(HomotypicalSynonymGroup retainedGroup : retainedGroups){
- taxonNameEditor.removeGroup(retainedGroup);
- }
- }
-
-
- public static HomotypicalSynonymGroup createOrUpdateHeterotypicSynonymyGroup(
- TaxonNameEditor taxonNameEditor, HomotypicalGroup homotypicalGroup){
- HomotypicalSynonymGroup group = null;
- if(taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup) == null){
- group = new HomotypicalSynonymGroup(taxonNameEditor, homotypicalGroup);
- taxonNameEditor.addHeterotypicSynonymGroup(group);
- if(taxonNameEditor.getMisappliedGroup() != null){
- group.getControl().moveAbove(taxonNameEditor.getMisappliedGroup().getControl());
- }
- }
- else{
- group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
- group.redraw(homotypicalGroup);
- }
-
- return group;
- }
-
- /**
- * @param taxonNameEditor
- */
- public static void createOrUpdateMisapplicationsGroup(
- TaxonNameEditor taxonNameEditor) {
- MisappliedGroup group = taxonNameEditor.getMisappliedGroup();
- Taxon taxon = HibernateProxyHelper.deproxy(taxonNameEditor.getTaxon(), Taxon.class);
- if(taxon.getMisappliedNames().isEmpty()){
- taxonNameEditor.removeGroup(group);
- taxonNameEditor.setMisapplicationsGroup(null);
- }else{
- if(group == null){
- taxonNameEditor.setMisapplicationsGroup(new MisappliedGroup(taxonNameEditor));
- }else{
- group.redraw();
- }
- }
-
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import org.eclipse.swt.graphics.Image;
-
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-
-/**
- * <p>HomotypicalSynonymGroup class.</p>
- *
- * @author p.ciardelli
- * @created 13.01.2009
- * @version 1.0
- */
-public class HomotypicalSynonymGroup extends AbstractHomotypicalGroupContainer {
-
- /**
- * <p>Constructor for HomotypicalSynonymGroup.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- * @param group a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
- */
- public HomotypicalSynonymGroup(TaxonNameEditor editor, HomotypicalGroup group) {
- super(editor, group);
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#createContents()
- */
- @Override
- protected void createContainers() {
- createSynonymContainer();
- }
-
- protected void createSynonymContainer(){
- int i = 0;
- int indent = IContainerConstants.SYNONYM_INDENT;
- Image icon = IContainerConstants.HETEROTYPIC_SYNONYM_ICON;
- for(Synonym synonym : getSynonyms()){
- if(i > 0){
- indent = IContainerConstants.HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_INDENT;
- icon = IContainerConstants.HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON;
- }
- SynonymContainer container = new SynonymContainer(this, synonym, indent, icon);
- this.add(container);
- container.createContent();
- i++;
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractHomotypicalGroupContainer#redrawNeeded(eu.etaxonomy.cdm.model.name.HomotypicalGroup)
- */
- @Override
- protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup) {
- return super.redrawNeeded(homotypicalGroup);
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.container;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-
-/**
- * <p>MisappliedGroup class.</p>
- *
- * @author p.ciardelli
- * @created 13.01.2009
- * @version 1.0
- */
-public class MisappliedGroup extends AbstractGroup{
-
- /**
- * <p>Constructor for MisappliedGroup.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- */
- public MisappliedGroup(TaxonNameEditor editor) {
- super(editor);
-
- createContent();
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroup#createContents()
- */
- @Override
- protected void createContainers() {
- for(Taxon misapplication : getEditor().getTaxon().getMisappliedNames()){
- MisapplicationContainer container = new MisapplicationContainer(this, misapplication);
- this.add(container);
- container.createContent();
- }
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup#redraw()
- */
- @Override
- public void redraw() {
- if(redrawNeeded()){
- super.redraw();
- }
- }
-
- /**
- * @return
- */
- private boolean redrawNeeded() {
- Set<Taxon> misapplications = getEditor().getTaxon().getMisappliedNames();
-
- Set<Taxon> presentMisapplication = new HashSet<Taxon>();
-
- for (AbstractGroupedContainer<Taxon> container : getGroupedContainers()){
- presentMisapplication.add(container.getData());
- }
- return ! (presentMisapplication.containsAll(misapplications) && misapplications.containsAll(presentMisapplication));
- }
-}
/**
* 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.
*/
* @version 1.0
*/
public class NameViewer extends SourceViewer {
-
+
/** Constant <code>RULER_WIDTH=16</code> */
public static final int RULER_WIDTH = 16;
-
+
private final IVerticalRuler ruler;
private final AnnotationModel annotationModel;
*/
public NameViewer(Composite parent) {
super(parent, new RulerWithIcon(RULER_WIDTH), SWT.WRAP | SWT.MULTI | SWT.RESIZE);
-
+
this.ruler = getVerticalRuler();
-
+
setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
-
+
Canvas canvas = (Canvas) getControl();
TableWrapLayout layout = (TableWrapLayout) canvas.getLayout();
layout.topMargin = 0;
layout.leftMargin = 0;
layout.verticalSpacing = 10;
layout.horizontalSpacing = 0;
-
+
canvas.setLayout(layout);
-
+
// Lay out the viewer's widgets
TableWrapData twdata = new TableWrapData(TableWrapData.FILL_GRAB);
getControl().setLayoutData(twdata);
-
+
twdata = new TableWrapData(TableWrapData.FILL_GRAB);
getTextWidget().setLayoutData(twdata);
getTextWidget().setLineSpacing(5);
-
- // Default implementation adds ruler after the text widget, then
+
+ // Default implementation adds ruler after the text widget, then
// uses a custom layout to display it before the text widget
ruler.getControl().moveAbove(getTextWidget());
annotationModel = new AnnotationModel();
this.setDocument(new Document(""), annotationModel); //$NON-NLS-1$
-
+
createAnnotationPainter();
- this.configure(new ViewerConfiguration());
-
+ this.configure(new ViewerConfiguration());
+
// setDecorationSupport();
// DocumentUndoManagerRegistry.connect(this.getDocument());
// IDocumentUndoManager docUndoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(this.getDocument());
-
+
/**
getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.UNDO.getId(), new UndoActionHandler(getSite(), undoContext));
- getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), new RedoActionHandler(getSite(), undoContext));
+ getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REDO.getId(), new RedoActionHandler(getSite(), undoContext));
**/
}
-
+
/**
* <p>setBackground</p>
*
* @param color a {@link org.eclipse.swt.graphics.Color} object.
*/
public void setBackground(Color color) {
-
+
// Set background color of ruler
ruler.getControl().setBackground(color);
// Set background color of text widget
getTextWidget().setBackground(color);
-
+
// Set background color of strip between ruler and textWidget
- getTextWidget().getParent().setBackground(color);
+ getTextWidget().getParent().setBackground(color);
}
-
+
/**
* <p>getRulerControl</p>
*
throw new IllegalStateException("Viewer's IVerticalRuler is not an instance of RulerWithIcon."); //$NON-NLS-1$
}
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewer#createLayout()
*/
layout.verticalSpacing = 0;
return layout;
}
-
+
private void createAnnotationPainter(){
// Annotations section
IAnnotationAccess fAnnotationAccess = new DefaultMarkerAnnotationAccess();
-
+
// To paint the annotations
AnnotationPainter annotationPainter = new AnnotationPainter(this, fAnnotationAccess);
// Default SquigglesStrategy doesn't recognize line wraps
annotationPainter.addDrawingStrategy(LineWrapSquigglesStrategy.ID, new LineWrapSquigglesStrategy());
-
+
// Add ability to paint red squigglies
annotationPainter.addAnnotationType(EditorAnnotationType.ERROR.name(), LineWrapSquigglesStrategy.ID);
- annotationPainter.setAnnotationTypeColor(EditorAnnotationType.ERROR.image,
+ annotationPainter.setAnnotationTypeColor(EditorAnnotationType.ERROR.image,
new Color(Display.getDefault(), EditorAnnotationType.ERROR.color));
// Add ability to paint yellow squigglies
annotationPainter.addAnnotationType(EditorAnnotationType.WARNING.name(), LineWrapSquigglesStrategy.ID);
- annotationPainter.setAnnotationTypeColor(EditorAnnotationType.WARNING.image,
+ annotationPainter.setAnnotationTypeColor(EditorAnnotationType.WARNING.image,
new Color(Display.getDefault(), EditorAnnotationType.WARNING.color));
-
+
this.addPainter(annotationPainter);
}
public void clearAnnotations() {
Iterator<Annotation> annotations = this.getAnnotationModel().getAnnotationIterator();
while (annotations.hasNext()) {
- Annotation annotation = annotations.next();
+ Annotation annotation = annotations.next();
this.getAnnotationModel().removeAnnotation(annotation);
}
}
-
+
/**
* If <code>name.hasProblem()</code> is <code>true</code>, underlines section
* of text bounded by <code>name.getProblemStarts()</code> and
* @param name a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
*/
// public void setShowParsingErrors(TaxonNameBase<?, ?> name) {
-//
+//
// String text = this.getTextWidget().getText();
-//
+//
// if (name.hasProblem() && text.length() > 0) {
// int start = name.getProblemStarts();
// int length = name.getProblemEnds() - start;
-//
+//
// if (start == -1 || name.getProblemEnds() == -1) {
// return;
// }
-//
+//
// // Don't let squigglies try to draw beyond the end of the text
// if (text.length() < start + length) {
// length = text.length() - start;
// }
-//
+//
// for (ParserProblem problem : name.getParsingProblems()) {
-//
+//
// String type = null;
// if (problem.isWarning()) {
// type = EditorAnnotation.WARNING_TYPE;
// continue;
// }
// this.getAnnotationModel().addAnnotation(
-// new EditorAnnotation(type, 0, problem.getMessage()),
+// new EditorAnnotation(type, 0, problem.getMessage()),
// new Position(start, length));
// }
-//
+//
// }
// }
-
+
public void addAnnotation(EditorAnnotation annotation){
addAnnotation(annotation, null);
}
-
+
public void addAnnotation(EditorAnnotation annotation, Position position){
if(position == null){
position = new Position(0, 0);
}
-
+
this.getAnnotationModel().addAnnotation(annotation, position);
}
-
+
/**
* <p>setText</p>
*
throw e;
}
}
-
+
/**
* <p>setMenu</p>
*
*/
public void setCursorToEOL() {
getTextWidget().setCaretOffset(getTextWidget().getText().length());
- getTextWidget().setFocus();
}
-
+
/**
* <p>getCursorPosition</p>
*
public int getCursorPosition(){
return getTextWidget().getCaretOffset();
}
-
+
/**
* <p>setCursorPosition</p>
*
IUndoManager undoManager = new TextViewerUndoManager(25);
this.setUndoManager(undoManager);
undoManager.connect(this);
-
+
// IUndoContext workbenchUndoContext = UiUtil.getWorkbenchUndoContext();
-
+
IUndoContext workbenchUndoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
-
+
OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, workbenchUndoContext);
// undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
undoAction.setActionDefinitionId(ActionFactory.UNDO.getId());
-
+
// Create the redo action.
OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, workbenchUndoContext);
// redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
// actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
-
- }
-
+
+ }
+
// actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
// actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
}
-
+
/**
* <p>createUndoSupport_</p>
*
IUndoContext undoContext;
if (undoManager instanceof IUndoManagerExtension) {
undoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
-
+
OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, undoContext);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(undoAction, IAbstractTextEditorHelpContextIds.UNDO_ACTION);
undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
-
+
// Create the redo action.
OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, undoContext);
// PlatformUI.getWorkbench().getHelpSystem().setHelp(redoAction, IAbstractTextEditorHelpContextIds.REDO_ACTION);
if (actionBars != null) {
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.UNDO, undoAction);
actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
-
+
}
}
}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.name.dnd;
-
-import org.eclipse.swt.dnd.DropTargetEffect;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.widgets.Control;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.IDropTargetable;
-import eu.etaxonomy.taxeditor.preference.Resources;
-
-/**
- * <p>NameEditorDropTargetEffect class.</p>
- *
- * @author n.hoffmann
- * @version $Id: $
- */
-public class NameEditorDropTargetEffect extends DropTargetEffect {
-
- /**
- * <p>Constructor for NameEditorDropTargetEffect.</p>
- *
- * @param control a {@link org.eclipse.swt.widgets.Control} object.
- */
- public NameEditorDropTargetEffect(Control control) {
- super(control);
- }
-
- /** {@inheritDoc} */
- public void dragEnter(DropTargetEvent dropTargetEvent) {
-
-
-
- if(dropTargetEvent.widget instanceof IDropTargetable){
- ((IDropTargetable) dropTargetEvent.widget).dragEntered();
- }
-
-// if(! EditorUtil.getActiveMultiPageTaxonEditor().equals(editor.getMultiPageTaxonEditor())){
-// editor.getMultiPageTaxonEditor().setFocus();
-// }
- }
-
- /** {@inheritDoc} */
- public void dragLeave(DropTargetEvent dropTargetEvent) {
-
-
-
- if(dropTargetEvent.widget instanceof Control){
- ((Control) dropTargetEvent.widget).setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
- }
- }
-
-}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.name.e4;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public interface IDropTargetableE4 extends IPostOperationEnabled {
+
+ public Composite getControl();
+
+ public TaxonNameEditorE4 getEditor();
+
+ public void dragEntered();
+
+ public void dragLeft();
+
+ public IEclipseContext getContext();
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.name.e4;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.UndoContext;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.events.IEventBroker;
+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.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.forms.ManagedForm;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
+import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AcceptedNameContainerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.ContainerFactoryE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.HomotypicalSynonymGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListenerE4;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.model.IPartChangeListener;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.model.TaxeditorPartService;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.security.RequiredPermissions;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class TaxonNameEditorE4 implements IConversationEnabled, IDirtyMarkable, IPartContentHasDetails,
+ IPartContentHasSupplementalData, IPartContentHasMedia, IPartContentHasFactualData, IPartChangeListener,
+ ISelectionListener, ISecuredEditor, IPostOperationEnabled, IE4SavablePart, ITaxonEditor, IDropTargetableE4 {
+
+ private Taxon taxon;
+
+ private ManagedForm managedForm;
+ private ScrolledForm scrolledForm;
+ private Composite parent;
+ private ISelectionProvider simpleSelectionProvider;
+
+ private TaxonBase selection;
+
+ private ConversationHolder conversation;
+
+ private AcceptedGroupE4 acceptedGroup;
+ private List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = new ArrayList<>();
+ private MisappliedGroupE4 misappliedGroup;
+
+ private DropTarget target;
+
+ private TaxonBase objectAffectedByLastOperation;
+
+ @Inject
+ private EMenuService menuService;
+
+ @Inject
+ private ESelectionService selService;
+
+ @Inject
+ private IEclipseContext context;
+
+ @Inject
+ private MDirtyable dirty;
+
+ private MPart thisPart;
+
+ private TaxonEditorInputE4 input;
+
+ private UndoContext undoContext;
+
+ @Inject
+ private IEventBroker eventBroker;
+
+ @Inject
+ public TaxonNameEditorE4() {
+ undoContext = new UndoContext();
+ }
+
+
+ @PostConstruct
+ public void createPartControl(Composite parent, MPart thisPart) {
+ this.thisPart = thisPart;
+ if (CdmStore.isActive()){
+ if(conversation == null){
+ conversation = CdmStore.createConversation();
+ }
+ }
+ else{
+ return;
+ }
+
+ createManagedForm(parent);
+
+ TaxeditorPartService.getInstance().addListener(
+ TaxeditorPartService.PART_ACTIVATED, this);
+
+ }
+
+ protected void createManagedForm(Composite composite) {
+
+ managedForm = new ManagedForm(composite) {
+
+ @Override
+ public void dirtyStateChanged() {
+ dirty.setDirty(true);
+ }
+
+ @Override
+ public boolean setInput(Object input) {
+ if (input instanceof AbstractGroupedContainerE4) {
+ TaxonBase newSelection = ((AbstractGroupedContainerE4) input).getData();
+ if(selection!=newSelection){
+ selection = newSelection;
+ selService.setSelection(new StructuredSelection(selection));
+ }
+ }else if(input == null){
+ selection = null;
+ selService.setSelection(new StructuredSelection());
+ }
+
+
+ return super.setInput(input);
+ }
+ };
+
+ scrolledForm = managedForm.getForm();
+ parent = scrolledForm.getBody();
+
+ parent.setData(taxon);
+
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = 0;
+ layout.rightMargin = 0;
+ layout.topMargin = 0;
+ layout.bottomMargin = 0;
+
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+
+ parent.setLayout(layout);
+ parent.setBackground(AbstractUtility
+ .getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+ }
+
+ public void createOrUpdateNameComposites() {
+ ContainerFactoryE4.createOrUpdateAcceptedTaxonsHomotypicGroup(this);
+ ContainerFactoryE4.createOrUpdateHeterotypicSynonymyGroups(this);
+ ContainerFactoryE4.createOrUpdateMisapplicationsGroup(this);
+
+
+ // Redraw composite
+ managedForm.reflow(true);
+ managedForm.refresh();
+ }
+
+ @Override
+ public Taxon getTaxon() {
+ return HibernateProxyHelper.deproxy(taxon);
+ }
+
+ public void setDirty() {
+ managedForm.dirtyStateChanged();
+ }
+
+ @Focus
+ public void setFocus() {
+ //make sure to bind again if maybe in another view the conversation was unbound
+ if(conversation!=null && !conversation.isBound()){
+ conversation.bind();
+ }
+ if(input!=null){
+ if (getSelectedContainer() == null) {
+ throw new IllegalStateException(
+ Messages.TaxonNameEditor_THERE_SHOULD_ALWAYS_BE);
+ }
+ getSelectedContainer().setSelected();
+
+ // check permissions
+ boolean doEnable = permissionsSatisfied();
+ managedForm.getForm().setEnabled(doEnable);
+ }
+ eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this);
+ }
+
+ @Override
+ public boolean permissionsSatisfied() {
+ TaxonNode taxonNode = input.getTaxonNode();
+ boolean doEnable = CdmStore.currentAuthentiationHasPermission(taxonNode, RequiredPermissions.TAXONNODE_EDIT);
+ return doEnable;
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap events) {
+ // redraw();
+ }
+
+ /**
+ * Redraws this editor return true on success
+ *
+ * @return a boolean.
+ */
+ public boolean redraw() {
+ return redraw(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Redraws the editor controls
+ */
+ public boolean redraw(boolean focus) {
+
+ createOrUpdateNameComposites();
+
+ if (focus) {
+ setFocus();
+ }
+
+ return true;
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+
+ changed(objectAffectedByOperation);
+
+ redraw(false);
+
+ if (objectAffectedByOperation instanceof TaxonBase) {
+ objectAffectedByLastOperation = (TaxonBase) objectAffectedByOperation;
+ }
+
+ return true;
+ }
+
+ public ManagedForm getManagedForm() {
+ return managedForm;
+ }
+
+
+ /**
+ * <p>
+ * checkForEmptyNames
+ * </p>
+ *
+ * @return true if there are empty names
+ */
+ public boolean checkForEmptyNames() {
+ for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
+ if (container.getName() == null
+ || StringUtils.isEmpty(container.getName().getTitleCache())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Set<AbstractGroupedContainerE4> getEmptyContainers() {
+ Set<AbstractGroupedContainerE4> containersWithEmptyNames = new HashSet<>();
+
+ for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
+ if (container.getName() == null
+ || StringUtils.isEmpty(container.getName().getTitleCache())) {
+ containersWithEmptyNames.add(container);
+ }
+ }
+
+ return containersWithEmptyNames;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor) {
+
+ monitor.beginTask(Messages.TaxonNameEditor_SAVING_NAMES, getGroupedContainers().size());
+ if (!conversation.isBound()) {
+ conversation.bind();
+ }
+ monitor.worked(1);
+
+ // check for empty names
+ if (checkForEmptyNames()) {
+ MessageDialog.openWarning(AbstractUtility.getShell(), Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED,
+ Messages.MultiPageTaxonEditor_NO_NAME_SPECIFIED_MESSAGE);
+ return;
+ }
+ for (AbstractGroupedContainerE4 container : getGroupedContainers()) {
+
+ monitor.subTask(Messages.TaxonNameEditor_SAVING_COMPOSITES
+ + container.getTaxonBase().getTitleCache());
+ container.persistName();
+
+ // In case the progress monitor was canceled throw an exception.
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ // Otherwise declare this step as done.
+ monitor.worked(1);
+
+ }
+ input.merge();
+ // commit the conversation and start a new transaction immediately
+ conversation.commit(true);
+
+
+ dirty.setDirty(false);
+
+ // Stop the progress monitor.
+ monitor.done();
+ }
+
+ public void init(TaxonEditorInputE4 input) {
+
+ if (!(input != null)) {
+ MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT));
+ return;
+ }
+
+ if (input.getAdapter(Taxon.class) != null) {
+ taxon = CdmBase.deproxy(input.getAdapter(Taxon.class), Taxon.class);
+ } else {
+ MessagingUtils.error(this.getClass(), new Exception(Messages.TaxonNameEditor_INVALID_INPUT_TAXON_NULL));
+ return;
+ }
+
+ this.input = input;
+
+ createOrUpdateNameComposites();
+
+ createDragSupport();
+
+ setPartName();
+
+ //set initial selection
+ TaxonBase initiallySelectedTaxonBase = input.getInitiallySelectedTaxonBase();
+ if(initiallySelectedTaxonBase!=null){
+ selService.setSelection(new StructuredSelection(initiallySelectedTaxonBase));
+ getContainer(initiallySelectedTaxonBase).setSelected();
+ }
+ }
+
+ private void createDragSupport() {
+ // Listen for names being dragged outside of existing homotypic groups -
+ // user wants to create a new group
+ Transfer[] types = new Transfer[] { CdmDataTransfer.getInstance() };
+ int operations = DND.DROP_MOVE;
+ if (target == null) {
+ target = new DropTarget(parent, operations);
+ target.setTransfer(types);
+ target.addDropListener(new NameEditorDropTargetListenerE4(this));
+ }
+ }
+
+ public AcceptedNameContainerE4 getAcceptedNameContainer() {
+ return getAcceptedGroup().getAcceptedNameContainer();
+ }
+
+ public HomotypicalSynonymGroupE4 getHomotypicalGroupContainer(
+ HomotypicalGroup homotypicalGroup) {
+ for (HomotypicalSynonymGroupE4 group : getHeterotypicSynonymGroups()) {
+ if (group.getGroup().equals(homotypicalGroup)) {
+ return group;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * <p>
+ * getDirtyNames
+ * </p>
+ *
+ * @return a Set containing all composites that have been edited
+ */
+ public Set<AbstractGroupedContainerE4> getDirtyNames() {
+ Set<AbstractGroupedContainerE4> dirtyNames = new HashSet<>();
+
+ for (AbstractGroupedContainerE4 composite : getGroupedContainers()) {
+ if (composite.isDirty()) {
+ dirtyNames.add(composite);
+ }
+ }
+
+ return dirtyNames;
+ }
+
+ public List<AbstractGroupedContainerE4> getGroupedContainers() {
+ List<AbstractGroupedContainerE4> groupedComposites = new ArrayList<>();
+
+ for (AbstractGroupE4 group : getAllGroups()) {
+ if (group!= null){
+ groupedComposites.addAll(group.getGroupedContainers());
+ }
+ }
+
+ return groupedComposites;
+ }
+
+ public List<AbstractGroupE4> getAllGroups() {
+ List<AbstractGroupE4> allGroups = new ArrayList<>();
+
+ allGroups.add(getAcceptedGroup());
+
+ heterotypicSynonymGroups = getHeterotypicSynonymGroups();
+
+ if (heterotypicSynonymGroups != null) {
+ allGroups.addAll(heterotypicSynonymGroups);
+ }
+
+ if (misappliedGroup != null) {
+ allGroups.add(misappliedGroup);
+ }
+
+ return allGroups;
+ }
+
+ @Override
+ public IEclipseContext getContext() {
+ return context;
+ }
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ @PreDestroy
+ public void dispose() {
+ if(conversation!=null){
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.close();
+ }
+ eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ }
+
+ public AbstractGroupedContainerE4 getSelectedContainer() {
+ return (selection != null) ? getContainer(selection)
+ : getAcceptedNameContainer();
+ }
+
+ @Override
+ public void dragEntered() {
+ // TODO change this
+ getControl().setBackground(
+ AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
+ }
+
+ @Override
+ public void dragLeft() {
+ getControl().setBackground(
+ AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+ }
+
+
+ public void setMisapplicationsGroup(MisappliedGroupE4 misappliedGroup) {
+ this.misappliedGroup = misappliedGroup;
+ }
+
+ public FormToolkit getToolkit() {
+ return managedForm.getToolkit();
+ }
+
+ public List<HomotypicalSynonymGroupE4> getHeterotypicSynonymGroups() {
+ return heterotypicSynonymGroups;
+ }
+
+ public void addHeterotypicSynonymGroup(HomotypicalSynonymGroupE4 group) {
+ heterotypicSynonymGroups.add(group);
+ }
+
+ public AcceptedGroupE4 getAcceptedGroup() {
+ return acceptedGroup;
+ }
+
+ public void setAcceptedGroup(AcceptedGroupE4 acceptedGroup) {
+ this.acceptedGroup = acceptedGroup;
+ }
+
+ public MisappliedGroupE4 getMisappliedGroup() {
+ return misappliedGroup;
+ }
+
+ public boolean isActive() {
+ return this.equals(AbstractUtility.getActivePart());
+ }
+
+ @Override
+ public boolean onComplete() {
+ getContainer(objectAffectedByLastOperation).setSelected();
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
+ if (!partRef.getPart(false).equals(this)) {
+ // getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
+ }
+ }
+
+ public void removeGroup(AbstractGroupE4 group) {
+ if (group != null) {
+ group.dispose();
+
+ //if (heterotypicSynonymGroups != null) {
+ heterotypicSynonymGroups.remove(group);
+ //}
+ }
+ }
+
+ public AbstractGroupedContainerE4 getContainer(TaxonBase taxonBase) {
+ List<AbstractGroupedContainerE4> groupedContainers = getGroupedContainers();
+ for (AbstractGroupedContainerE4 container : groupedContainers) {
+ if (container.getData().equals(taxonBase)
+ && container.getNameViewer().getTextWidget() != null) {
+ return container;
+ }
+ }
+ return getAcceptedNameContainer();
+ }
+
+ public void setOnError() {
+ Color disabledColor = AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
+ setEnabled(false, disabledColor);
+ }
+
+ public void setDisabled(){
+ Color disabledColor = AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
+ setEnabled(false, disabledColor);
+ }
+
+ protected void setEnabled(boolean enabled, Color background) {
+
+ for(AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()){
+ groupedContainer.setEnabled(enabled);
+ }
+
+ // send an empty selection to the current provider - TODO only on error ???
+ if (!enabled) {
+ getManagedForm().setInput(null);
+
+ for (AbstractGroupedContainerE4 groupedContainer : getGroupedContainers()) {
+ groupedContainer.setBackground(background);
+ }
+ }
+ getControl().setBackground(background);
+ }
+
+ @Override
+ public void changed(Object element) {
+ // setDirty(true);
+ // if the attribute is null then do not set the dirty flag -> hotfix for the problem that for tasks done in service methods the changes are saved automatically
+ if (element != null){
+ dirty.setDirty(true);
+ //refresh part title
+ //TODO: refresh taxon node in taxon navigator
+ setPartName();
+ }
+
+ if (element instanceof TaxonBase) {
+ AbstractGroupedContainerE4 container = getContainer((TaxonBase) element);
+ if (container != null) {
+ container.refresh();
+ }
+ }
+ if (element instanceof TaxonRelationship) {
+ AbstractGroupedContainerE4 container = getContainer(((TaxonRelationship) element).getFromTaxon());
+ if (container != null) {
+ container.refresh();
+ }
+ }
+ }
+
+ public void setPartName(){
+ thisPart.setLabel(this.taxon.getName().getFullTitleCache());
+ }
+
+ @Override
+ public void forceDirty() {
+ setDirty();
+ }
+
+
+ public IUndoContext getUndoContext() {
+ return undoContext;
+ }
+
+ @Override
+ public Composite getControl(){
+ return managedForm.getForm().getBody();
+ }
+
+ public EMenuService getMenuService() {
+ return menuService;
+ }
+
+ public ESelectionService getSelectionService() {
+ return selService;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean canAttachMedia() {
+ return true;
+ }
+
+ public TaxonEditorInputE4 getEditorInput() {
+ return input;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public TaxonNameEditorE4 getEditor() {
+ return this;
+ }
+
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.editor.name.container;
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.IDropTargetable;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDropTargetEffect;
-import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDropTargetListener;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetEffect;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDropTargetListenerE4;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.Resources;
/**
- * <p>Abstract AbstractGroup class.</p>
*
- * @author p.ciardelli
- * @author n.hoffmann
- * @created 25.06.2008
- * @version 1.0
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
*/
-public abstract class AbstractGroup implements IDropTargetable{
+public abstract class AbstractGroupE4 implements IDropTargetableE4{
private Composite control;
- private final List<AbstractGroupedContainer> groupedContainers = new ArrayList<AbstractGroupedContainer>();
+ private IEclipseContext context;
+
+ private final List<AbstractGroupedContainerE4> groupedContainers = new ArrayList<>();
- protected TaxonNameEditor editor;
+ protected TaxonNameEditorE4 editor;
private DropTarget target;
private DropTargetListener dropListener;
- /**
- * <p>Constructor for AbstractGroup.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- * @param <T> a T object.
- */
- public AbstractGroup(TaxonNameEditor editor){
+ public AbstractGroupE4(TaxonNameEditorE4 editor){
this.editor = editor;
+ this.context = editor.getContext();
}
protected void createContent(){
editor.getManagedForm().reflow(true);
}
- /**
- * <p>createControl</p>
- */
protected void createControl() {
control = editor.getToolkit().createComposite(editor.getControl());
control.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
}
- /**
- * <p>add</p>
- *
- * @param groupedContainer a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer} object.
- */
- public void add(AbstractGroupedContainer groupedContainer){
+ public void add(AbstractGroupedContainerE4 groupedContainer){
groupedContainers.add(groupedContainer);
- groupedContainer.setGroup(this);
}
- /**
- * <p>remove</p>
- *
- * @param groupedContainer a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer} object.
- */
- public void remove(AbstractGroupedContainer groupedContainer){
+ public void remove(AbstractGroupedContainerE4 groupedContainer){
groupedContainer.dispose();
groupedContainers.remove(groupedContainer);
- if(!(this instanceof AcceptedGroup) && groupedContainers.isEmpty()){
+ if(!(this instanceof AcceptedGroupE4) && groupedContainers.isEmpty()){
getEditor().removeGroup(this);
}
}
- /**
- * <p>Getter for the field <code>groupedContainers</code>.</p>
- *
- * @return a {@link java.util.List} object.
- */
- public List<AbstractGroupedContainer> getGroupedContainers(){
+ public List<AbstractGroupedContainerE4> getGroupedContainers(){
return groupedContainers;
}
- /**
- * <p>setDroppable</p>
- *
- * @param droppable a boolean.
- */
public void setDroppable(boolean droppable) {
if (droppable) {
Transfer[] types = new Transfer[] {CdmDataTransfer.getInstance()};
int operations = DND.DROP_MOVE;
target = new DropTarget(control, operations);
target.setTransfer(types);
- dropListener = new NameEditorDropTargetListener(this);
+ dropListener = new NameEditorDropTargetListenerE4(this);
target.addDropListener(dropListener);
target.setDropTargetEffect(new NameEditorDropTargetEffect(control));
}
}
- /**
- * <p>getNameEditor</p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- */
@Override
- public TaxonNameEditor getEditor() {
+ public IEclipseContext getContext() {
+ return context;
+ }
+
+ @Override
+ public TaxonNameEditorE4 getEditor() {
return editor;
}
- /**
- * <p>dragEntered</p>
- */
@Override
public void dragEntered() {
- Color color = EditorUtil.getColor(Resources.COLOR_DRAG_ENTER);
+ Color color = AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER);
- for(AbstractGroupedContainer container : groupedContainers){
+ for(AbstractGroupedContainerE4 container : groupedContainers){
container.setBackground(color);
}
}
- /**
- * <p>dragLeft</p>
- */
@Override
public void dragLeft() {
- for(AbstractGroupedContainer container : groupedContainers){
+ for(AbstractGroupedContainerE4 container : groupedContainers){
container.restoreColor();
}
}
/** {@inheritDoc} */
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
- editor.getMultiPageTaxonEditor().changed(objectAffectedByOperation);
+ editor.changed(objectAffectedByOperation);
redraw();
return true;
}
- /**
- * <p>redraw</p>
- */
public void redraw(){
emptyGroup();
createContainers();
protected abstract void createContainers();
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.IDropTargetable#getControl()
- */
@Override
public Composite getControl() {
return control;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#onComplete()
- */
@Override
public boolean onComplete() {
return true;
public void dispose(){
if(getControl() != null){
- for(AbstractGroupedContainer container : getGroupedContainers()){
+ for(AbstractGroupedContainerE4 container : getGroupedContainers()){
container.dispose();
}
getControl().setMenu(null);
}
}
- /**
- * @param object
- */
- public void setMenu(Menu menu) {
- getControl().setMenu(menu);
- for(AbstractGroupedContainer container : getGroupedContainers()){
- container.setMenu(menu);
- }
-
- }
-
protected void emptyGroup(){
- for(AbstractGroupedContainer container : groupedContainers){
+ for(AbstractGroupedContainerE4 container : groupedContainers){
container.dispose();
}
groupedContainers.clear();
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.editor.name.container;
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.window.DefaultToolTip;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.forms.IFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.TableWrapData;
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;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation;
import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation.EditorAnnotationType;
-import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDragListener;
-import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDragSourceEffect;
+import eu.etaxonomy.taxeditor.editor.name.container.IContainerConstants;
+import eu.etaxonomy.taxeditor.editor.name.container.LineBreakListener;
+import eu.etaxonomy.taxeditor.editor.name.container.LineWrapSupport;
+import eu.etaxonomy.taxeditor.editor.name.container.NameViewer;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDragListenerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.dnd.NameEditorDragSourceEffect;
import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
-import eu.etaxonomy.taxeditor.labels.ILabelImageStrategy;
-import eu.etaxonomy.taxeditor.labels.LabelImageProvider;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IElementHasDetails;
import eu.etaxonomy.taxeditor.model.NameHelper;
import eu.etaxonomy.taxeditor.model.TextHelper;
* The <code>IManagedForm</code> can also used for drawing borders by calling
* the method <code>createBorderSupport()</code>.
* </p>
+ * @author pplitzner
+ * @date Aug 24, 2017
*
- * @author p.ciardelli
- * @author n.hoffmann
- * @created 02.06.2008
+ * @param <T>
*/
-abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
+abstract public class AbstractGroupedContainerE4<T extends TaxonBase> implements
IFormPart, IContainerConstants, IElementHasDetails {
protected ParseHandler parseHandler;
protected NameViewer nameViewer;
- private AbstractGroup group;
+ private AbstractGroupE4 group;
private Label nonEditableInfoLabel;
private DefaultToolTip nonEditableInfoHover;
- private static AbstractGroupedContainer selection;
+ private static AbstractGroupedContainerE4 selection;
private FocusListener focusListener;
private LineBreakListener lineBreakListener;
private Color backgroundColor;
private boolean isDirty;
- /**
- * <p>
- * Constructor for AbstractGroupedContainer.
- * </p>
- *
- * @param editor
- * a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor}
- * object.
- * @param group
- * a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup}
- * object.
- * @param taxonBase
- * a T object.
- * @param <T>
- * a T object.
- */
- public AbstractGroupedContainer(T taxonBase) {
+ private ISelectionChangedListener selectionChangedListener;
+
+ public AbstractGroupedContainerE4(AbstractGroupE4 group, T taxonBase) {
setData(taxonBase);
+ this.group = group;
parseHandler = ParseHandler.NewInstance(taxonBase.getName());
}
createLineWrapSupport();
createLineBreakListener();
- setMenu(getEditor().getMenu());
+ setMenu();
setDraggableControl(new Control[] { getControl(),
getNameViewer().getRulerControl() });
enableFreeText();
}
- /**
- * <p>
- * createListener
- * </p>
- */
protected void createListener() {
nameCompositeModifyListener = new ModifyListener() {
};
nameCompositeFocusListener = new FocusAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.FocusAdapter#focusLost(org.eclipse.swt
- * .events.FocusEvent)
- */
@Override
public void focusLost(FocusEvent e) {
super.focusLost(e);
*/
protected abstract void initializeComposite();
- /**
- * <p>
- * getEmptyTextPrompt
- * </p>
- *
- * @return a {@link java.lang.String} object.
- */
protected String getEmptyTextPrompt() {
return EMPTY_NAME_PROMPT;
}
- /**
- *
- */
- private void showNameRelations() {
- TaxonName name = getName();
- if (name == null) {
- return;
- }
-
- ILabelImageStrategy strategy = LabelImageProvider
- .getLabelStrategy(name);
- LabelImageProvider labelProvider = new LabelImageProvider(strategy);
-
- Set<NameRelationship> nameRelations = name.getNameRelations();
- if (nameRelations.size() == 0) {
- return;
- }
- // for (NameRelationship nameRelation : nameRelations) {
- // String typeLabel = null;
- // TaxonName relatedName = null;
- //
- // if (name.equals(nameRelation.getFromName())) {
- // typeLabel = labelProvider.getNameRelationTypeLabel(
- // nameRelation.getType());
- // relatedName = nameRelation.getToName();
- // } else {
- // typeLabel = labelProvider.getNameRelationTypeInverseLabel(
- // nameRelation.getType());
- // relatedName = nameRelation.getFromName();
- // }
- //
- // setNonEditableInfo(typeLabel + " " +
- // NameHelper.getDisplayName(relatedName));
- // }
- }
-
- /**
- * <p>
- * initTextViewer
- * </p>
- */
protected void initTextViewer() {
- // showNameRelations();
-
updateIndent();
updateIcon();
calculateAnnotations();
}
- /**
- * <p>
- * calculateErrors
- * </p>
- */
synchronized protected void calculateAnnotations() {
getNameViewer().clearAnnotations();
showAnnotations();
}
- /**
- *
- */
public void showAnnotations() {
if (getName() != null && getName().hasProblem()) {
}
- /**
- *
- */
private void showParsingProblems() {
- String text = getNameViewer().getTextWidget().getText();
-
TaxonName name = getName();
if (name == null){
return;
return null;
}
- /**
- * <p>
- * handleSplitText
- * </p>
- *
- * @param text
- * a {@link java.lang.String} object.
- */
protected void handleSplitText(String text) {
// Create a synonym in a new homotypic group using text as name
TaxonName synonymName = TaxonName.castAndDeproxy(
ParseHandler.parseReferencedName(text, null));
- EditorUtil.executeOperation(new CreateSynonymInNewGroupOperation(
+ AbstractUtility.executeOperation(new CreateSynonymInNewGroupOperation(
Messages.AbstractGroupedContainer_NEW_HETERO_SYNONYM, getEditor().getUndoContext(),
- getEditor().getTaxon(), synonymName, getEditor()));
+ getEditor().getTaxon(), synonymName, getEditor()), group.getContext().get(UISynchronize.class));
}
/**
enableFreeText();
}
- /**
- *
- */
protected abstract void updateIcon();
protected abstract void updateIndent();
- /**
- * <p>
- * updateNonEditableInfo
- * </p>
- */
protected abstract void updateNonEditableInfo();
- /**
- *
- */
protected void enableFreeText() {
setEnabled(isFreetextEditingAllowed());
+
}
/**
Set<TaxonBase> taxonBases = name.getTaxonBases();
Iterator<TaxonBase> tbItr = taxonBases.iterator();
int nonOrphanedTaxonBaseCount = taxonBases.size();
-
+
while(tbItr.hasNext()) {
TaxonBase<?> tb = tbItr.next();
if(tb.isOrphaned()) {
calculateAnnotations();
}
- /**
- * <p>
- * getTaxonBase
- * </p>
- *
- * @return the taxonBase
- */
public T getTaxonBase() {
return getData();
}
- /**
- * <p>
- * getName
- * </p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- */
public TaxonName getName() {
return CdmBase.deproxy(getTaxonBase().getName());
}
- /**
- * <p>
- * persistName
- * </p>
- */
public void persistName() {
if (isDirty()) {
getNameViewer().getTextWidget().setEnabled(false);
final String unparsedNameString = getNameViewer().getTextWidget()
.getText();
- // Job job = new Job("Persisting Name"){
- //
- // @Override
- // protected IStatus run(IProgressMonitor monitor) {
- //
final TaxonName name = (TaxonName)parseHandler
.parseAndResolveDuplicates(unparsedNameString);
- //
- // Display.getDefault().asyncExec(new Runnable(){
- // public void run() {
getTaxonBase().setName(name);
getTaxonBase().setTitleCache((getTaxonBase().generateTitle()));
setDirty(false);
getNameViewer().getTextWidget().setEnabled(true);
- // };
- // });
- //
- //
- // return Status.OK_STATUS;
- // }
- //
- // };
- //
- // job.setPriority(Job.DECORATE);
- // job.schedule();
}
}
- /**
- * <p>
- * Getter for the field <code>group</code>.
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup}
- * object.
- */
- public AbstractGroup getGroup() {
+ public AbstractGroupE4 getGroup() {
if (group == null) {
throw new IllegalStateException("Group shall not be null."); //$NON-NLS-1$
}
return group;
}
- /**
- * <p>
- * remove
- * </p>
- */
public void remove() {
getGroup().remove(this);
}
- /**
- * <p>
- * createControl
- * </p>
- */
protected void createControl() {
control = getEditor().getToolkit().createComposite(
getGroup().getControl());
}
- /**
- * @return
- */
- protected TaxonNameEditor getEditor() {
+ protected TaxonNameEditorE4 getEditor() {
return getGroup().getEditor();
}
- /**
- * <p>
- * Getter for the field <code>control</code>.
- * </p>
- *
- * @return a {@link org.eclipse.swt.widgets.Composite} object.
- */
public Composite getControl() {
return control;
}
- /**
- * <p>
- * createLineWrapSupport
- * </p>
- */
protected void createLineWrapSupport() {
new LineWrapSupport(getNameViewer(), getEditor().getManagedForm());
}
- /**
- * <p>
- * createTextViewer
- * </p>
- */
protected void createTextViewer() {
nameViewer = new NameViewer(control);
focusListener = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
- if(!enabled){
- return;
- }
- for (AbstractGroupedContainer container : getEditor()
+ if (getEditor()
+ .getGroupedContainers().isEmpty()){
+ return;
+ }
+
+ for (AbstractGroupedContainerE4 container : getEditor()
.getGroupedContainers()) {
container.colorSelected(NOT_SELECTED);
}
getEditor().getManagedForm().setInput(
- AbstractGroupedContainer.this);
+ AbstractGroupedContainerE4.this);
placeCursor();
colorSelected(SELECTED_FOCUS);
}
};
nameViewer.getTextWidget().addFocusListener(focusListener);
- //
MouseAdapter mouseListener = new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
nameViewer.getTextWidget().addMouseListener(mouseListener);
}
- /**
- * <p>
- * setIcon
- * </p>
- *
- * @param icon
- * a {@link org.eclipse.swt.graphics.Image} object.
- */
public void setIcon(Image icon) {
getNameViewer().setIcon(icon);
}
- /**
- * <p>
- * setIndent
- * </p>
- *
- * @param indent
- * a int.
- */
public void setIndent(int indent) {
if (control.getLayout() instanceof TableWrapLayout) {
TableWrapLayout layout = ((TableWrapLayout) control.getLayout());
control.setLayout(layout);
control.layout();
} else {
- new RuntimeException(
+ throw new RuntimeException(
"Couldn't indent - composite's layout must be TableWrapLayout."); //$NON-NLS-1$
}
}
- /**
- * <p>
- * setSelected
- * </p>
- */
public void setSelected() {
getNameViewer().getTextWidget().setFocus();
}
- /**
- * <p>
- * isSelected
- * </p>
- *
- * @return a boolean.
- */
public boolean isSelected() {
return getEditor().getSelectedContainer() == this;
}
- /**
- * <p>
- * colorSelected
- * </p>
- *
- * @param mode
- * a int.
- */
public void colorSelected(int mode) {
if (!control.isDisposed()) {
String colorString = null;
colorString = Resources.COLOR_COMPOSITE_BACKGROUND;
}
- backgroundColor = EditorUtil.getColor(colorString);
+ backgroundColor = AbstractUtility.getColor(colorString);
setBackground(backgroundColor);
}
}
- /**
- * <p>
- * setDelayedSelection
- * </p>
- */
protected void setDelayedSelection() {
// TODO this might be done better
// this is the quickest solution i could come up with and it improves
}
- /**
- * <p>
- * setBackground
- * </p>
- *
- * @param color
- * a {@link org.eclipse.swt.graphics.Color} object.
- */
public void setBackground(Color color) {
control.setBackground(color);
getNameViewer().setBackground(color);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.widgets.Control#setFont(org.eclipse.swt.graphics.Font)
- */
- /**
- * <p>
- * setFont
- * </p>
- *
- * @param font
- * a {@link org.eclipse.swt.graphics.Font} object.
- */
public void setFont(Font font) {
getNameViewer().getTextWidget().setFont(font);
}
- /**
- * <p>
- * Getter for the field <code>nameViewer</code>.
- * </p>
- *
- * @return a {@link eu.etaxonomy.taxeditor.editor.name.container.NameViewer}
- * object.
- */
public NameViewer getNameViewer() {
if (nameViewer == null) {
throw new RuntimeException(
return nameViewer;
}
- /**
- * If <code>textViewer</code> has already been set, it will show a
- * <code>prompt</code> along the lines of
- * "Click here to start entering data" when empty.
- *
- * @param prompt
- * a {@link java.lang.String} object.
- */
public void createEmptyViewerPrompt(final String prompt) {
Assert.isNotNull(getNameViewer());
textControl.addFocusListener(getFocusListener());
if (document.getLength() == 0) {
- textControl.setFont(EditorUtil
+ textControl.setFont(AbstractUtility
.getFont(Resources.FONT_DEFAULT_PROMPT));
document.set(prompt);
}
}
- /**
- * <p>
- * getViewerFont
- * </p>
- *
- * @return a {@link org.eclipse.swt.graphics.Font} object.
- */
abstract protected Font getViewerFont();
- /**
- * <p>
- * initEmptyText
- * </p>
- */
protected void initEmptyText() {
- Font defaultFont = EditorUtil.getFont(Resources.FONT_DEFAULT_PROMPT);
+ Font defaultFont = AbstractUtility.getFont(Resources.FONT_DEFAULT_PROMPT);
getNameViewer().getTextWidget().setFont(defaultFont);
getNameViewer().getDocument().set(getEmptyTextPrompt());
placeCursor();
}
- /**
- * <p>
- * Setter for the field <code>focusListener</code>.
- * </p>
- *
- * @param focusListener
- * a {@link org.eclipse.swt.events.FocusListener} object.
- */
protected void setFocusListener(FocusListener focusListener) {
this.focusListener = focusListener;
}
return focusListener;
}
- /**
- * <p>
- * setDirty
- * </p>
- *
- * @param isDirty
- * a boolean.
- */
public void setDirty(boolean isDirty) {
if (isDirty) {
getEditor().getManagedForm().dirtyStateChanged();
this.isDirty = isDirty;
}
- /**
- * <p>
- * isDirty
- * </p>
- *
- * @return a boolean.
- */
@Override
public boolean isDirty() {
return isDirty;
}
- /**
- * <p>
- * setMenu
- * </p>
- *
- * @param menu
- * a {@link org.eclipse.swt.widgets.Menu} object.
- */
- public void setMenu(Menu menu) {
- control.setMenu(menu);
-
- getNameViewer().setMenu(menu);
+ public void setMenu() {
+ getEditor().getMenuService().registerContextMenu(getNameViewer().getTextWidget(), "eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor");
}
private Control[] draggableControls;
- /**
- * <p>
- * setDraggableControl
- * </p>
- *
- * @param controls
- * an array of {@link org.eclipse.swt.widgets.Control} objects.
- */
protected void setDraggableControl(Control[] controls) {
draggableControls = controls;
}
- /**
- * <p>
- * setIsDraggable
- * </p>
- *
- * @param draggable
- * a boolean.
- */
public void setIsDraggable(boolean draggable) {
if (draggable) {
operations);
dragSource.setTransfer(types);
- dragSource.addDragListener(new NameEditorDragListener(this));
+ dragSource.addDragListener(new NameEditorDragListenerE4(this));
dragSource.setDragSourceEffect(new NameEditorDragSourceEffect(
control));
}
private T data;
- private boolean enabled;
-
/**
* nonEditableInfo is a label displayed underneath a GroupedComposite's
* input field. For instance, NameComposites display things like name
calculateAnnotations();
}
- /**
- * <p>
- * Getter for the field <code>data</code>.
- * </p>
- *
- * @return a T object.
- */
@Override
public T getData() {
return data;
}
- /**
- * <p>
- * Setter for the field <code>data</code>.
- * </p>
- *
- * @param data
- * a T object.
- */
public void setData(T data) {
this.data = HibernateProxyHelper.deproxy(data);
}
lineBreakListener = new LineBreakListener() {
@Override
public void handleSplitText(String text) {
- AbstractGroupedContainer.this.handleSplitText(text);
+ AbstractGroupedContainerE4.this.handleSplitText(text);
}
};
}
}
- /**
- * <p>
- * storeCursor
- * </p>
- */
public void storeCursor() {
this.cursorPosition = getNameViewer().getCursorPosition();
}
}
}
- /**
- * <p>
- * Setter for the field <code>group</code>.
- * </p>
- *
- * @param group
- * a
- * {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup}
- * object.
- */
- public void setGroup(AbstractGroup group) {
- this.group = group;
- }
-
- /**
- * <p>
- * restoreColor
- * </p>
- */
public void restoreColor() {
setBackground(backgroundColor);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
- * )
- */
@Override
public void initialize(IManagedForm form) {
// TODO Auto-generated method stub
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#dispose()
- */
@Override
public void dispose() {
if (getControl() != null) {
- setMenu(null);
+ setMenu();
getControl().dispose();
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
- */
@Override
public void commit(boolean onSave) {
if (isDirty()) {
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
- */
@Override
public boolean setFormInput(Object input) {
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#setFocus()
- */
@Override
public void setFocus() {
getNameViewer().getControl().setFocus();
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.forms.IFormPart#isStale()
- */
@Override
public boolean isStale() {
return false;
}
public void setDisabled(boolean disabled) {
- this.enabled = !disabled;
- setEnabled(enabled);
+ setEnabled(!disabled);
}
public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- Color color = enabled ? control.getForeground() : EditorUtil.getColor(Resources.COLOR_DISABLED_EDITOR);
+ Color color = enabled ? control.getForeground() : AbstractUtility.getColor(Resources.COLOR_DISABLED_EDITOR);
getNameViewer().getTextWidget().setEditable(enabled);
- getNameViewer().getTextWidget().setEnabled(enabled);
getNameViewer().getTextWidget().setForeground(color);
}
- public boolean isEnabled(){
- return enabled;
- }
+
}
/**
* 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.
*/
-package eu.etaxonomy.taxeditor.editor.name.container;
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
import java.util.ArrayList;
import java.util.List;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
/**
- * @author n.hoffmann
- * @created Jan 21, 2011
- * @version 1.0
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
*/
-public abstract class AbstractHomotypicalGroupContainer extends AbstractGroup {
+public abstract class AbstractHomotypicalGroupContainerE4 extends AbstractGroupE4 {
private HomotypicalGroup group;
-
- /**
- * @param editor
- */
- public AbstractHomotypicalGroupContainer(TaxonNameEditor editor, HomotypicalGroup group) {
+
+ public AbstractHomotypicalGroupContainerE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
super(editor);
this.group = group;
}
protected abstract void createSynonymContainer();
-
+
protected List<Synonym> getSynonyms(){
Taxon taxon = getEditor().getTaxon();
return taxon.getSynonymsInGroup(getGroup());
}
-
- /**
- * @param group the group to set
- */
+
public void setGroup(HomotypicalGroup group) {
this.group = group;
}
}
}
- /**
- *
- * @param homotypicalGroup
- * @return
- */
protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup) {
Taxon taxon = getEditor().getTaxon();
homotypicalGroup = HibernateProxyHelper.deproxy(homotypicalGroup, HomotypicalGroup.class);
List<Synonym> synonyms = taxon.getSynonymsInGroup(homotypicalGroup);
-
+
List<Synonym> presentSynonyms = new ArrayList<Synonym>();
-
- for(AbstractGroupedContainer container : getGroupedContainers()){
+
+ for(AbstractGroupedContainerE4 container : getGroupedContainers()){
if(container.getData() instanceof Synonym){
presentSynonyms.add((Synonym) container.getData());
}
}
-
+
boolean result = ! (presentSynonyms.containsAll(synonyms) && synonyms.containsAll(presentSynonyms));
-
+
return result;
}
-
- /**
- * @return the group
- */
+
public HomotypicalGroup getGroup() {
return group;
}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class AcceptedGroupE4 extends AbstractHomotypicalGroupContainerE4 {
+
+ private AcceptedNameContainerE4 acceptedContainer;
+
+ public AcceptedGroupE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
+ super(editor, group);
+ }
+
+ @Override
+ public void dragEntered() {
+ Color color = AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER);
+ acceptedContainer.setBackground(color);
+ super.dragEntered();
+ }
+
+ @Override
+ public void dragLeft() {
+ acceptedContainer.restoreColor();
+ super.dragLeft();
+ }
+
+ @Override
+ public List<AbstractGroupedContainerE4> getGroupedContainers() {
+ List<AbstractGroupedContainerE4> containers = new ArrayList<>();
+ containers.add(getAcceptedNameContainer());
+ containers.addAll(super.getGroupedContainers());
+ return containers;
+ }
+
+ @Override
+ protected void createContainers() {
+ this.acceptedContainer = new AcceptedNameContainerE4(this, getEditor().getTaxon());
+
+ acceptedContainer.createContent();
+
+ createSynonymContainer();
+ }
+
+ @Override
+ protected void createSynonymContainer(){
+ for(Synonym synonym : getSynonyms()){
+ SynonymContainerE4 container = new SynonymContainerE4(this, synonym);
+ this.add(container);
+ container.createContent();
+ }
+ }
+
+ public AcceptedNameContainerE4 getAcceptedNameContainer(){
+ return acceptedContainer;
+ }
+
+ @Override
+ protected void emptyGroup() {
+ acceptedContainer.dispose();
+ acceptedContainer = null;
+ super.emptyGroup();
+ }
+
+ @Override
+ protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup) {
+ if(! acceptedContainer.getData().equals(getEditor().getTaxon())){
+ return true;
+ }
+ return super.redrawNeeded(homotypicalGroup);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import org.eclipse.swt.graphics.Font;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+public class AcceptedNameContainerE4 extends AbstractGroupedContainerE4<Taxon> {
+
+ public AcceptedNameContainerE4(AcceptedGroupE4 group, Taxon taxon) {
+ super(group, taxon);
+ }
+
+ @Override
+ public void initializeComposite(){
+ setFont(getViewerFont());
+
+ initTextViewer();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected Font getViewerFont() {
+ return AbstractUtility.getFont(Resources.ACCEPTED_TAXON_FONT);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void updateNonEditableInfo() {
+ // not needed
+ }
+
+
+ @Override
+ protected void updateIcon() {
+ setIcon(ACCEPTED_ICON);
+ }
+
+ @Override
+ protected void updateIndent() {
+ setIndent(ACCEPTED_INDENT);
+ }
+
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class ContainerFactoryE4 {
+
+ public static void createOrUpdateAcceptedTaxonsHomotypicGroup(
+ TaxonNameEditorE4 taxonNameEditor) {
+
+ if(taxonNameEditor.getAcceptedGroup() == null){
+ taxonNameEditor.setAcceptedGroup(new AcceptedGroupE4(taxonNameEditor, taxonNameEditor.getTaxon().getHomotypicGroup()));
+ }
+ else{
+ taxonNameEditor.getAcceptedGroup().redraw(taxonNameEditor.getTaxon().getHomotypicGroup());
+ }
+
+ }
+
+ public static void createOrUpdateHeterotypicSynonymyGroups(
+ TaxonNameEditorE4 taxonNameEditor) {
+ List<HomotypicalSynonymGroupE4> retainedGroups = new ArrayList<>();
+
+ List<HomotypicalSynonymGroupE4> heterotypicSynonymGroups = taxonNameEditor.getHeterotypicSynonymGroups();
+
+ if (heterotypicSynonymGroups != null) {
+
+ for(HomotypicalSynonymGroupE4 group : heterotypicSynonymGroups){
+ retainedGroups.add(group);
+ }
+ }
+
+ for(HomotypicalGroup homotypicalGroup : taxonNameEditor.getTaxon().getHeterotypicSynonymyGroups()){
+ HomotypicalSynonymGroupE4 group = createOrUpdateHeterotypicSynonymyGroup(taxonNameEditor, homotypicalGroup);
+
+ retainedGroups.remove(group);
+ }
+
+ for(HomotypicalSynonymGroupE4 retainedGroup : retainedGroups){
+ taxonNameEditor.removeGroup(retainedGroup);
+ }
+ }
+
+
+ public static HomotypicalSynonymGroupE4 createOrUpdateHeterotypicSynonymyGroup(
+ TaxonNameEditorE4 taxonNameEditor, HomotypicalGroup homotypicalGroup){
+ HomotypicalSynonymGroupE4 group = null;
+ if(taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup) == null){
+ group = new HomotypicalSynonymGroupE4(taxonNameEditor, homotypicalGroup);
+ taxonNameEditor.addHeterotypicSynonymGroup(group);
+ if(taxonNameEditor.getMisappliedGroup() != null){
+ group.getControl().moveAbove(taxonNameEditor.getMisappliedGroup().getControl());
+ }
+ }
+ else{
+ group = taxonNameEditor.getHomotypicalGroupContainer(homotypicalGroup);
+ group.redraw(homotypicalGroup);
+ }
+
+ return group;
+ }
+
+ public static void createOrUpdateMisapplicationsGroup(
+ TaxonNameEditorE4 taxonNameEditor) {
+ MisappliedGroupE4 group = taxonNameEditor.getMisappliedGroup();
+ Taxon taxon = HibernateProxyHelper.deproxy(taxonNameEditor.getTaxon(), Taxon.class);
+ if(taxon.getMisappliedNames().isEmpty()){
+ taxonNameEditor.removeGroup(group);
+ taxonNameEditor.setMisapplicationsGroup(null);
+ }else{
+ if(group == null){
+ taxonNameEditor.setMisapplicationsGroup(new MisappliedGroupE4(taxonNameEditor));
+ }else{
+ group.redraw();
+ }
+ }
+
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.taxeditor.editor.name.container.IContainerConstants;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class HomotypicalSynonymGroupE4 extends AbstractHomotypicalGroupContainerE4 {
+
+ public HomotypicalSynonymGroupE4(TaxonNameEditorE4 editor, HomotypicalGroup group) {
+ super(editor, group);
+ }
+
+ @Override
+ protected void createContainers() {
+ createSynonymContainer();
+ }
+
+ @Override
+ protected void createSynonymContainer(){
+ int i = 0;
+ int indent = IContainerConstants.SYNONYM_INDENT;
+ Image icon = IContainerConstants.HETEROTYPIC_SYNONYM_ICON;
+ for(Synonym synonym : getSynonyms()){
+ if(i > 0){
+ indent = IContainerConstants.HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_INDENT;
+ icon = IContainerConstants.HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON;
+ }
+ SynonymContainerE4 container = new SynonymContainerE4(this, synonym, indent, icon);
+ this.add(container);
+ container.createContent();
+ i++;
+ }
+ }
+
+ @Override
+ protected boolean redrawNeeded(HomotypicalGroup homotypicalGroup) {
+ return super.redrawNeeded(homotypicalGroup);
+ }
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.editor.name.container;
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.graphics.Font;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.cdm.strategy.cache.reference.DefaultReferenceCacheStrategy;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.NameHelper;
import eu.etaxonomy.taxeditor.preference.Resources;
/**
- * <p>MisapplicationContainer class.</p>
*
- * @author p.ciardelli
- * @created 13.01.2009
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
*/
-public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
+public class MisapplicationContainerE4 extends AbstractGroupedContainerE4<Taxon> {
TaxonRelationship misapplication;
- /**
- * <p>Constructor for MisapplicationContainer.</p>
- *
- * @param editor a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
- * @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
- * @param misappliedName a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- */
- public MisapplicationContainer(AbstractGroup group, Taxon misappliedName) {
- super(misappliedName);
-
+ public MisapplicationContainerE4(AbstractGroupE4 group, Taxon misappliedName) {
+ super(group, misappliedName);
+
}
/** {@inheritDoc} */
protected void initializeComposite() {
setIsDraggable(true);
setFont(getViewerFont());
- TaxonNameEditor editor = getEditor();
+ TaxonNameEditorE4 editor = getEditor();
Taxon taxon = editor.getTaxon();
for (TaxonRelationship rel: taxon.getTaxonRelations(getMisappliedName())){
if (rel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
title = getMisappliedName().getAppendedPhrase();
}else{
title = "auct.";
-
+
}
-
+
} else {
String sec = " sensu ";
if (getMisappliedName().getAppendedPhrase() != null ){
sec = getMisappliedName().getAppendedPhrase() + " " + sec;
}
-
+
title += sec + getMisappliedName().getSec().getCacheStrategy().getCitation(getMisappliedName().getSec());
}
title += author;
setNonEditableInfo(title, false);
}
- /**
- * <p>getMisappliedName</p>
- *
- * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- */
public Taxon getMisappliedName() {
return getTaxonBase();
}
/** {@inheritDoc} */
@Override
protected Font getViewerFont() {
- return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
+ return AbstractUtility.getFont(Resources.MISAPPLIEDNAME_FONT);
}
@Override
protected void updateIndent() {
setIndent(MISAPPLIEDNAME_INDENT);
}
-
- /**
- * <p>
- * initTextViewer
- * </p>
- */
+
@Override
protected void initTextViewer() {
}
calculateAnnotations();
}
-
+
@Override
public void refresh() {
// showNameRelations();
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class MisappliedGroupE4 extends AbstractGroupE4{
+
+ public MisappliedGroupE4(TaxonNameEditorE4 editor) {
+ super(editor);
+
+ createContent();
+ }
+
+ @Override
+ protected void createContainers() {
+ for(Taxon misapplication : getEditor().getTaxon().getMisappliedNames()){
+ MisapplicationContainerE4 container = new MisapplicationContainerE4(this, misapplication);
+ this.add(container);
+ container.createContent();
+ }
+ }
+
+ @Override
+ public void redraw() {
+ if(redrawNeeded()){
+ super.redraw();
+ }
+ }
+
+ private boolean redrawNeeded() {
+ Set<Taxon> misapplications = getEditor().getTaxon().getMisappliedNames();
+
+ Set<Taxon> presentMisapplication = new HashSet<Taxon>();
+
+ for (AbstractGroupedContainerE4<Taxon> container : getGroupedContainers()){
+ presentMisapplication.add(container.getData());
+ }
+ return ! (presentMisapplication.containsAll(misapplications) && misapplications.containsAll(presentMisapplication));
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IUndoManager;
+import org.eclipse.jface.text.IUndoManagerExtension;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TextViewerUndoManager;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationModel;
+import org.eclipse.jface.text.source.AnnotationPainter;
+import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.SourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import org.eclipse.ui.operations.OperationHistoryActionHandler;
+import org.eclipse.ui.operations.RedoActionHandler;
+import org.eclipse.ui.operations.UndoActionHandler;
+import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
+import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
+
+import eu.etaxonomy.taxeditor.editor.ViewerConfiguration;
+import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation;
+import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation.EditorAnnotationType;
+import eu.etaxonomy.taxeditor.editor.name.container.LineWrapSquigglesStrategy;
+import eu.etaxonomy.taxeditor.editor.name.container.RulerWithIcon;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 25, 2017
+ *
+ */
+public class NameViewerE4 extends SourceViewer {
+
+ public static final int RULER_WIDTH = 16;
+
+ private final IVerticalRuler ruler;
+ private final AnnotationModel annotationModel;
+
+ public NameViewerE4(Composite parent) {
+ super(parent, new RulerWithIcon(RULER_WIDTH), SWT.WRAP | SWT.MULTI | SWT.RESIZE);
+
+ this.ruler = getVerticalRuler();
+
+ setBackground(AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+
+ Canvas canvas = (Canvas) getControl();
+ TableWrapLayout layout = (TableWrapLayout) canvas.getLayout();
+ layout.topMargin = 0;
+ layout.rightMargin = 0;
+ layout.bottomMargin = 0;
+ layout.leftMargin = 0;
+ layout.verticalSpacing = 10;
+ layout.horizontalSpacing = 0;
+
+ canvas.setLayout(layout);
+
+ // Lay out the viewer's widgets
+ TableWrapData twdata = new TableWrapData(TableWrapData.FILL_GRAB);
+ getControl().setLayoutData(twdata);
+
+ twdata = new TableWrapData(TableWrapData.FILL_GRAB);
+ getTextWidget().setLayoutData(twdata);
+ getTextWidget().setLineSpacing(5);
+
+ // Default implementation adds ruler after the text widget, then
+ // uses a custom layout to display it before the text widget
+ ruler.getControl().moveAbove(getTextWidget());
+
+ annotationModel = new AnnotationModel();
+ this.setDocument(new Document(""), annotationModel); //$NON-NLS-1$
+
+ createAnnotationPainter();
+
+ this.configure(new ViewerConfiguration());
+
+ }
+
+ public void setBackground(Color color) {
+
+ // Set background color of ruler
+ ruler.getControl().setBackground(color);
+
+ // Set background color of text widget
+ getTextWidget().setBackground(color);
+
+ // Set background color of strip between ruler and textWidget
+ getTextWidget().getParent().setBackground(color);
+ }
+
+ public Control getRulerControl() {
+ return ruler.getControl();
+ }
+
+ public void setIcon(Image icon) {
+ if (ruler instanceof RulerWithIcon) {
+ ((RulerWithIcon) ruler).setIcon(icon);
+ } else {
+ throw new IllegalStateException("Viewer's IVerticalRuler is not an instance of RulerWithIcon."); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ protected Layout createLayout() {
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.numColumns = 2;
+ layout.verticalSpacing = 0;
+ return layout;
+ }
+
+ private void createAnnotationPainter(){
+ // Annotations section
+ IAnnotationAccess fAnnotationAccess = new DefaultMarkerAnnotationAccess();
+
+ // To paint the annotations
+ AnnotationPainter annotationPainter = new AnnotationPainter(this, fAnnotationAccess);
+
+ // Default SquigglesStrategy doesn't recognize line wraps
+ annotationPainter.addDrawingStrategy(LineWrapSquigglesStrategy.ID, new LineWrapSquigglesStrategy());
+
+ // Add ability to paint red squigglies
+ annotationPainter.addAnnotationType(EditorAnnotationType.ERROR.name(), LineWrapSquigglesStrategy.ID);
+ annotationPainter.setAnnotationTypeColor(EditorAnnotationType.ERROR.image,
+ new Color(Display.getDefault(), EditorAnnotationType.ERROR.color));
+
+ // Add ability to paint yellow squigglies
+ annotationPainter.addAnnotationType(EditorAnnotationType.WARNING.name(), LineWrapSquigglesStrategy.ID);
+ annotationPainter.setAnnotationTypeColor(EditorAnnotationType.WARNING.image,
+ new Color(Display.getDefault(), EditorAnnotationType.WARNING.color));
+
+ this.addPainter(annotationPainter);
+ }
+
+
+ public void clearAnnotations() {
+ Iterator<Annotation> annotations = this.getAnnotationModel().getAnnotationIterator();
+ while (annotations.hasNext()) {
+ Annotation annotation = annotations.next();
+ this.getAnnotationModel().removeAnnotation(annotation);
+ }
+ }
+
+ public void addAnnotation(EditorAnnotation annotation){
+ addAnnotation(annotation, null);
+ }
+
+ public void addAnnotation(EditorAnnotation annotation, Position position){
+ if(position == null){
+ position = new Position(0, 0);
+ }
+
+ this.getAnnotationModel().addAnnotation(annotation, position);
+ }
+
+ public void setText(String text) {
+ if (text == null) {
+ text = ""; //$NON-NLS-1$
+ }
+ try {
+ Assert.isNotNull(text);
+ // TODO figure out why getTextWidget() returns null!
+ if (this.getTextWidget() == null) {
+ return;
+ }
+ Assert.isNotNull(this.getTextWidget());
+ this.getTextWidget().setText(text);
+ } catch (RuntimeException e) {
+ throw e;
+ }
+ }
+
+ public void setMenu(Menu menu) {
+ getRulerControl().setMenu(menu);
+ getTextWidget().setMenu(menu);
+ }
+
+ public void setCursorToEOL() {
+ getTextWidget().setCaretOffset(getTextWidget().getText().length());
+ getTextWidget().setFocus();
+ }
+
+ public int getCursorPosition(){
+ return getTextWidget().getCaretOffset();
+ }
+
+ public void setCursorPosition(int offset){
+ try{
+ getTextWidget().setCaretOffset(offset);
+ }catch(IllegalArgumentException e){
+ // do nothing
+ }
+ }
+
+ public void createUndoSupport(IEditorSite editorSite) {
+
+ IUndoManager undoManager = new TextViewerUndoManager(25);
+ this.setUndoManager(undoManager);
+ undoManager.connect(this);
+
+ IUndoContext workbenchUndoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
+
+ OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, workbenchUndoContext);
+ undoAction.setActionDefinitionId(ActionFactory.UNDO.getId());
+
+ // Create the redo action.
+ OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, workbenchUndoContext);
+ undoAction.setActionDefinitionId(ActionFactory.REDO.getId());
+
+ IActionBars actionBars = editorSite.getActionBars();
+ if (actionBars != null) {
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
+
+ }
+
+ }
+
+ public void createUndoSupport_(IEditorSite editorSite) {
+ IUndoManager undoManager = new TextViewerUndoManager(25);
+ this.setUndoManager(undoManager);
+ undoManager.connect(this);
+ IUndoContext undoContext;
+ if (undoManager instanceof IUndoManagerExtension) {
+ undoContext = ((IUndoManagerExtension)undoManager).getUndoContext();
+
+ OperationHistoryActionHandler undoAction = new UndoActionHandler(editorSite, undoContext);
+ undoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.UNDO);
+
+ // Create the redo action.
+ OperationHistoryActionHandler redoAction = new RedoActionHandler(editorSite, undoContext);
+ redoAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.REDO);
+
+ IActionBars actionBars = editorSite.getActionBars();
+ if (actionBars != null) {
+ actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.UNDO, undoAction);
+ actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
+
+ }
+ }
+ }
+
+}
+
/**
* 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.
*/
-package eu.etaxonomy.taxeditor.editor.name.container;
+package eu.etaxonomy.taxeditor.editor.name.e4.container;
import java.util.Set;
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
-import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
* @created 13.01.2009
* @version 1.0
*/
-public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
+public class SynonymContainerE4 extends AbstractGroupedContainerE4<Synonym> {
private int indent = SYNONYM_INDENT;
private Image icon = HETEROTYPIC_SYNONYM_ICON;
* @param group a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroup} object.
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
*/
- public SynonymContainer(AbstractHomotypicalGroupContainer group, Synonym synonym) {
- super(synonym);
+ public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym) {
+ super(group, synonym);
}
-
- public SynonymContainer(AbstractHomotypicalGroupContainer group, Synonym synonym, int indent, Image icon){
- super(synonym);
+
+ public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym, int indent, Image icon){
+ super(group, synonym);
this.indent = indent;
this.icon = icon;
}
-
+
/** {@inheritDoc} */
@Override
protected void initializeComposite() {
setIsDraggable(true);
setFont(getViewerFont());
-
+
if(getName() == null){
MessagingUtils.warn(getClass(), Messages.SynonymContainer_SYNONYM_NULL_NAME);
}
-
+
initTextViewer();
}
-
- protected void updateIcon(){
+
+ @Override
+ 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().isInvalidType())){
setIcon(INVALID_OR_NUDUM_NAME_ICON);
}
}
}
-
+
if (isHomotypic()) {
if(name.isGroupsBasionym()){
setIcon(HOMOTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON);
}else{
setIcon(HOMOTYPIC_SYNONYM_ICON);
}
-
+
return;
} else{
if(name.isGroupsBasionym()){
setIcon(HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON);
return;
}
- }
-
+ }
+
setIcon(icon);
-
+
}
-
+
private boolean isHomotypic() {
HomotypicalGroup group = getSynonym().getHomotypicGroup();
- return group.equals(getEditor().getTaxon().getHomotypicGroup());
+ return group.equals(getEditor().getTaxon().getHomotypicGroup());
}
-
+
/**
* <p>getSynonym</p>
*
public Synonym getSynonym() {
return getTaxonBase();
}
-
+
/**
* <p>getViewerFont</p>
*
* @return a {@link org.eclipse.swt.graphics.Font} object.
*/
- protected Font getViewerFont() {
+ @Override
+ protected Font getViewerFont() {
return EditorUtil.getFont(Resources.SYNONYM_FONT);
}
* @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
*/
@Override
- protected void updateIndent() {
+ protected void updateIndent() {
setIndent(this.indent );
}
}
/**
- *
+ *
*/
-package eu.etaxonomy.taxeditor.editor.name.dnd;
+package eu.etaxonomy.taxeditor.editor.name.e4.dnd;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceAdapter;
import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.taxeditor.editor.CdmDataTransfer;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
/**
- * <p>NameEditorDragListener class.</p>
*
- * @author n.hoffmann
- * @version $Id: $
+ * @author pplitzner
+ * @date 04.09.2017
+ *
*/
-public class NameEditorDragListener extends DragSourceAdapter {
-
- private AbstractGroupedContainer container;
-
- /**
- * <p>Constructor for NameEditorDragListener.</p>
- *
- * @param container a {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer} object.
- */
- public NameEditorDragListener(AbstractGroupedContainer container){
+public class NameEditorDragListenerE4 extends DragSourceAdapter {
+
+ private AbstractGroupedContainerE4 container;
+
+ public NameEditorDragListenerE4(AbstractGroupedContainerE4 container){
this.container = container;
}
-
+
/** {@inheritDoc} */
- public void dragFinished(DragSourceEvent event) {
- if(!event.doit)
- return;
+ @Override
+ public void dragFinished(DragSourceEvent event) {
+ if(!event.doit) {
+ return;
+ }
if(event.detail == DND.DROP_MOVE){
ManagedForm managedForm = container.getGroup().getEditor().getManagedForm();
container.getGroup().remove(container);
managedForm.reflow(true);
}
-
+
};
-
+
/** {@inheritDoc} */
@Override
public void dragSetData(DragSourceEvent event) {
- ICdmBase[] cdmBaseObjects = new ICdmBase[]{(ICdmBase) container.getData()};
+ ICdmBase[] cdmBaseObjects = new ICdmBase[]{container.getData()};
if(CdmDataTransfer.getInstance().isSupportedType(event.dataType)){
event.data = cdmBaseObjects;
}
}
-
+
/** {@inheritDoc} */
@Override
public void dragStart(DragSourceEvent event) {
/**
- *
+ *
*/
-package eu.etaxonomy.taxeditor.editor.name.dnd;
+package eu.etaxonomy.taxeditor.editor.name.e4.dnd;
import org.eclipse.swt.dnd.DragSourceEffect;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.widgets.Control;
/**
- * <p>NameEditorDragSourceEffect class.</p>
- *
* @author n.hoffmann
* @version $Id: $
*/
public class NameEditorDragSourceEffect extends DragSourceEffect {
- /**
- * <p>Constructor for NameEditorDragSourceEffect.</p>
- *
- * @param control a {@link org.eclipse.swt.widgets.Control} object.
- */
public NameEditorDragSourceEffect(Control control) {
super(control);
}
-
+
/** {@inheritDoc} */
@Override
public void dragStart(DragSourceEvent event) {
- // TODO Auto-generated method stub
super.dragStart(event);
}
/** {@inheritDoc} */
@Override
public void dragFinished(DragSourceEvent event) {
- // TODO Auto-generated method stub
super.dragFinished(event);
}
-
+
}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.name.e4.dnd;
+
+import org.eclipse.swt.dnd.DropTargetEffect;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.widgets.Control;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author n.hoffmann
+ * @version $Id: $
+ */
+public class NameEditorDropTargetEffect extends DropTargetEffect {
+
+ public NameEditorDropTargetEffect(Control control) {
+ super(control);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void dragEnter(DropTargetEvent dropTargetEvent) {
+ if(dropTargetEvent.widget instanceof IDropTargetableE4){
+ ((IDropTargetableE4) dropTargetEvent.widget).dragEntered();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void dragLeave(DropTargetEvent dropTargetEvent) {
+ if(dropTargetEvent.widget instanceof Control){
+ ((Control) dropTargetEvent.widget).setBackground(EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+ }
+ }
+}
/**
*
*/
-package eu.etaxonomy.taxeditor.editor.name.dnd;
+package eu.etaxonomy.taxeditor.editor.name.e4.dnd;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.IDropTargetable;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractHomotypicalGroupContainer;
-import eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup;
+import eu.etaxonomy.taxeditor.editor.name.e4.IDropTargetableE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractHomotypicalGroupContainerE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.operation.MoveSynonymToAnotherAcceptedTaxonOperationE4;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicGroupOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
-import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
/**
- * <p>NameEditorDropTargetListener class.</p>
*
- * @author n.hoffmann
- * @version $Id: $
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
*/
-public class NameEditorDropTargetListener extends DropTargetAdapter {
-
- private IDropTargetable target;
+public class NameEditorDropTargetListenerE4 extends DropTargetAdapter {
+ private IDropTargetableE4 target;
- /**
- * <p>Constructor for NameEditorDropTargetListener.</p>
- *
- * @param target a {@link eu.etaxonomy.taxeditor.editor.IDropTargetable} object.
- */
- public NameEditorDropTargetListener(IDropTargetable target){
+ public NameEditorDropTargetListenerE4(IDropTargetableE4 target){
this.target = target;
}
@Override
public void dragEnter(DropTargetEvent dropTargetEvent) {
target.dragEntered();
-
-// if(! EditorUtil.getActiveMultiPageTaxonEditor().equals(editor.getMultiPageTaxonEditor())){
-// editor.getMultiPageTaxonEditor().setFocus();
-// }
}
/** {@inheritDoc} */
MessagingUtils.warn(getClass(), String.format(Messages.NameEditorDropTargetListener_UNSUCCESSFULL_DROP, taxonBase.getClass(), target));
dropTargetEvent.detail = DND.DROP_NONE;
} else {
- EditorUtil.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, target.getContext().get(UISynchronize.class));
}
target.getEditor().getConversationHolder().commit();
- if (!target.equals(EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor())){
- ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).redraw();
- ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();
+ if (!target.equals(EventUtility.getTaxonEditor())){
+ ((TaxonNameEditorE4)EventUtility.getTaxonEditor()).redraw();
+ ((TaxonNameEditorE4)EventUtility.getTaxonEditor()).getConversationHolder().commit();
}
target.getEditor().redraw();
if(taxonBase instanceof Synonym){
Synonym synonym = (Synonym) taxonBase;
- if(target instanceof AbstractHomotypicalGroupContainer){
- HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup();
+ if(target instanceof AbstractHomotypicalGroupContainerE4){
+ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainerE4) target).getGroup();
return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
getEditor().getTaxon(), synonym, homotypicalGroup, target);
}
- else if(target instanceof MisappliedGroup){
+ else if(target instanceof MisappliedGroupE4){
return new ChangeSynonymToMisapplicationOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM_TO_MISAPP, getEditor().getUndoContext(),
getEditor().getTaxon(), synonym, target);
}
- else if(target instanceof TaxonNameEditor){
+ else if(target instanceof TaxonNameEditorE4){
if (target.equals(getEditor())){
return new ChangeHomotypicGroupOperation(Messages.NameEditorDropTargetListener_CHANGE_HOMOTYPICAL_GROUP, getEditor().getUndoContext(),
getEditor().getTaxon(), synonym, null, target);
} else{
getEditor().getConversationHolder().commit();
- ((TaxonNameEditor) target).getConversationHolder().commit();
+ ((TaxonNameEditorE4) target).getConversationHolder().commit();
- return new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), getEditor().getTaxon().getUuid(), synonym.getUuid(), ((TaxonNameEditor) target).getTaxon(), null );
+ return new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.NameEditorDropTargetListener_CHANGE_ACC_TAXON, getEditor().getUndoContext(), synonym.getUuid(), ((TaxonNameEditorE4) target).getTaxon(), (TaxonNameEditorE4) target, (TaxonNameEditorE4) target);
}
}
}else if(taxonBase instanceof Taxon){
Taxon concept = (Taxon) taxonBase;
- if(target instanceof AbstractHomotypicalGroupContainer){
- HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainer) target).getGroup();
+ if(target instanceof AbstractHomotypicalGroupContainerE4){
+ HomotypicalGroup homotypicalGroup = ((AbstractHomotypicalGroupContainerE4) target).getGroup();
return new ChangeConceptToSynonymOperation(Messages.NameEditorDropTargetListener_CHANGE_SYNONYM, getEditor().getUndoContext(),
getEditor().getTaxon(), concept, homotypicalGroup, target);
}
- else if(target instanceof MisappliedGroup ){
+ else if(target instanceof MisappliedGroupE4){
return new ChangeConceptRelationshipTypeOperation(Messages.NameEditorDropTargetListener_CHANGE, getEditor().getUndoContext(),
getEditor().getTaxon(), concept, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), target);
}
private HomotypicalGroup getHomotypicalGroup() {
- if(target instanceof AbstractHomotypicalGroupContainer){
- return ((AbstractHomotypicalGroupContainer) target).getGroup();
+ if(target instanceof AbstractHomotypicalGroupContainerE4){
+ return ((AbstractHomotypicalGroupContainerE4) target).getGroup();
}
return null;
}
return null;
}
- /**
- * @return
- *
- */
- private TaxonNameEditor getEditor() {
- return (TaxonNameEditor) EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor();
+ private TaxonNameEditorE4 getEditor() {
+ return (TaxonNameEditorE4) EventUtility.getTaxonEditor();
}
}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import java.util.Set;
+
+import javax.inject.Named;
+
+import org.apache.log4j.Logger;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeSynonymToAcceptedTaxonHandlerE4 implements IPostOperationEnabled {
+ private static final Logger logger = Logger
+ .getLogger(ChangeSynonymToAcceptedTaxonHandlerE4.class);
+
+ private TaxonNameEditorE4 editor;
+ private EPartService partService;
+ private MApplication application;
+ private EModelService modelService;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection, EPartService partService,
+ EModelService modelService, MApplication application, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
+ UISynchronize sync) {
+
+ this.modelService = modelService;
+ this.application = application;
+ this.partService = partService;
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonEditorInputE4 input = editor.getEditorInput();
+
+ // Get synonym from selection
+ if (!(selection.getFirstElement() instanceof Synonym)) {
+ logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
+ return;
+ }
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+
+ // Force user to save taxon - not really necessary though, is it?
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return;
+ }
+
+ // Get taxon
+ Taxon taxon = input.getTaxon();
+
+ TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, input.getTaxonNode().getClassification());
+
+
+ if(newParentNode != null){
+
+ // TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon
+ // apply confirmation dialog
+ HomotypicalGroup group = synonym.getHomotypicGroup();
+ Set<TaxonName> namesInGroup = group.getTypifiedNames();
+ // FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
+ ChangeSynonymToAcceptedTaxonOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
+ taxon, newParentNode, synonym, namesInGroup, this, editor, editor.getEditorInput()); //$NON-NLS-1$
+
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+
+ // Redraw existing editor
+ ((IPostOperationEnabled) editor).postOperation(null);
+
+ editor.save(AbstractUtility.getMonitor());
+
+ if (objectAffectedByOperation instanceof TaxonNode) {
+
+ // Open new unsaved editor with existing taxon's parent as temporary parent
+ TaxonNode newNode = (TaxonNode) objectAffectedByOperation;
+
+ EditorUtil.openTaxonNodeE4(newNode.getUuid(), modelService, partService, application);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement)
+ && !NameEditorMenuPropertyTester.isAccepted(selectedElement)
+ && !NameEditorMenuPropertyTester.isMisapplication(selectedElement);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeToMisapplicationHandlerE4 {
+
+ private TaxonNameEditorE4 editor;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)){
+ return ;
+ }
+ Object selectedElement = selection.getFirstElement();
+
+ AbstractPostOperation operation = null;
+ if(selectedElement instanceof Taxon){
+ operation = new ChangeConceptRelationshipTypeOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
+ }
+ if(selectedElement instanceof Synonym){
+ operation = new ChangeSynonymToMisapplicationOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
+ }
+
+
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ !NameEditorMenuPropertyTester.isAccepted(selectedElement)
+ && !NameEditorMenuPropertyTester.isMisapplication(selectedElement);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class ChangeToSynonymHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+
+ Taxon concept = (Taxon) selection.getFirstElement();
+
+ AbstractPostOperation operation;
+ operation = new ChangeConceptToSynonymOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), concept, null, editor);
+
+ AbstractUtility.executeOperation(operation, sync);
+
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ !NameEditorMenuPropertyTester.isAccepted(selectedElement)
+ && !NameEditorMenuPropertyTester.isSynonym(selectedElement);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateHeterotypicSynonymHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateSynonymInNewGroupOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), newSynonymName, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ Object selectedElement = selection.getFirstElement();
+ boolean canExecute = NameEditorMenuPropertyTester.isAccepted(selectedElement);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateHomotypicSynonymHandlerE4 {
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+ Taxon taxon = editor.getTaxon();
+ HomotypicalGroup group = taxon.getHomotypicGroup();
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), taxon, group, newSynonymName, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ Object selectedElement = selection.getFirstElement();
+ boolean canExecute = NameEditorMenuPropertyTester.isAccepted(selectedElement);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateMisapplicationHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonName conceptName = ParseHandler.createEmptyName();
+ Taxon concept = Taxon.NewInstance(conceptName, null);
+
+ TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
+
+ AbstractPostOperation<?> operation;
+ operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), concept, type, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute = NameEditorMenuPropertyTester.isAccepted(selectedElement)
+ && !NameEditorMenuPropertyTester.isMisapplication(selectedElement);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.parser.ParseHandler;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class CreateSynonymInHomotypicalGroupHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ Object selecteObject = selection.getFirstElement();
+
+ if(! (selecteObject instanceof Synonym)){
+ return ;
+ }
+
+ Synonym synonym = (Synonym) selecteObject;
+
+ HomotypicalGroup group = synonym.getHomotypicGroup();
+
+ TaxonName newSynonymName = ParseHandler.createEmptyName();
+
+ AbstractPostOperation<?> operation;
+
+ operation = new CreateSynonymInExistingHomotypicalGroupOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
+ editor.getTaxon(), group, newSynonymName, editor);
+ AbstractUtility.executeOperation(operation, sync);
+
+ }
+
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute = NameEditorMenuPropertyTester.isSynonym(selectedElement);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.container.AbstractGroupedContainerE4;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class DeleteAllEmptyNamesHandlerE4 extends DeleteTaxonBaseHandlerE4 {
+
+ @Override
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selectedElement,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
+ editor.removeGroup(containerWithEmptyName.getGroup());
+ doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData(), sync);
+ }
+
+ }
+
+ @Override
+ @CanExecute
+ public boolean canExecute(
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute = editor.checkForEmptyNames();
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.editor.name.handler;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.handlers.HandlerUtil;
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.DeleteResult;
import eu.etaxonomy.cdm.api.service.config.SynonymDeletionConfigurator;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteMisapplicationOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteSynonymOperation;
import eu.etaxonomy.taxeditor.editor.name.operation.DeleteTaxonBaseOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
/**
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
*/
-public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler, IPostOperationEnabled {
+public class DeleteTaxonBaseHandlerE4 implements IPostOperationEnabled {
- TaxonNameEditor editor;
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
+ protected TaxonNameEditorE4 editor;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
- Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
+ editor = (TaxonNameEditorE4) activePart.getObject();
- doExecute(event, editor, selectedElement);
+ doExecute(menuItem.getLocalizedLabel(), shell, editor, selection.getFirstElement(), sync);
- return null;
}
- protected void doExecute(ExecutionEvent event, TaxonNameEditor editor, Object selectedElement) {
+ protected void doExecute(String commandName, Shell shell, TaxonNameEditorE4 editor, Object selectedElement,
+ UISynchronize sync) {
AbstractPostOperation operation = null;
- String commandName = null;
- try {
- commandName = event.getCommand().getName();
- } catch (NotDefinedException e) {
- MessagingUtils.error(getClass(), e);
- }
- IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
if (selectedElement instanceof TaxonBase){
if (((TaxonBase)selectedElement).getId() == 0){
if (selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()) {
// synonym
if(selectedElement instanceof Synonym){
SynonymDeletionConfigurator deleteConfig = new SynonymDeletionConfigurator();
- if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_SYNONYM)){
return ;
}
- operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Synonym) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
+ operation = new DeleteSynonymOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Synonym) selectedElement,this, editor, editor.getEditorInput());
}
// misapplication
else if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){
TaxonDeletionConfigurator deleteConfig = new TaxonDeletionConfigurator();
- if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, HandlerUtil.getActiveShell(event), Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){
+ if(! DeleteConfiguratorDialog.openConfirmWithConfigurator(deleteConfig, shell, Messages.DeleteTaxonBaseHandler_CONFIRM_DELETION, Messages.DeleteTaxonBaseHandler_REALLY_DELETE_MISAPPLICATION)){
return ;
}
- operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, activePage, editor.getTaxon(), (Taxon) selectedElement,this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput());
+ operation = new DeleteMisapplicationOperation(commandName, editor.getUndoContext(), deleteConfig, editor.getTaxon(), (Taxon) selectedElement,this, editor, editor.getEditorInput());
} else {
throw new IllegalArgumentException(Messages.DeleteTaxonBaseHandler_ELEMENT_MUST_BE_SYNONYM_MISAPP_CONCEPT);
}
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
DeleteResult result = ((DeleteTaxonBaseOperation)operation).getResult();
if (result != null){
if (result.isError()){
DeleteResultMessagingUtils.messageDialogWithDetails(result, Messages.DeleteTaxonBaseHandler_DELETE_MISAPPLIEDNAME_SUCCESSFULL_BUT_REMAINING_RELATED_OBJECTS, TaxeditorEditorPlugin.PLUGIN_ID);
}
}
-
-
}
+ @CanExecute
+ public boolean canExecute(
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ NameEditorMenuPropertyTester.isSynonym(selectedElement)
+ || NameEditorMenuPropertyTester.isMisapplication(selectedElement)
+ || NameEditorMenuPropertyTester.isRelatedConcept(selectedElement);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
-
+ editor.redraw();
return true;
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.log4j.Logger;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.operation.MoveSynonymToAnotherAcceptedTaxonOperationE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+public class MoveSynonymToAnotherAcceptedTaxonHandlerE4 implements IPostOperationEnabled{
+ private static final Logger logger = Logger
+ .getLogger(MoveSynonymToAnotherAcceptedTaxonHandlerE4.class);
+
+ private TaxonNameEditorE4 editor;
+
+ private TaxonNode newParentNode;
+
+ private EPartService partService;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private MPart activePart;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, EPartService partService,
+ UISynchronize sync) {
+
+ this.activePart = activePart;
+ this.partService = partService;
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonEditorInputE4 input = editor.getEditorInput();
+
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return ;
+ }
+
+ if (selection==null || !(selection.getFirstElement() instanceof Synonym)) {
+ MessagingUtils.warningDialog(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION, this, Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION_MESSAGE);
+ logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
+ return ;
+ }
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+ Taxon oldParent = input.getTaxon();
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(oldParent.getUuid());
+
+
+ newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, input.getTaxonNode(), input.getTaxonNode().getClassification());
+
+ if(newParentNode!=null){
+ MoveSynonymToAnotherAcceptedTaxonOperationE4 operation = new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
+ synonym.getUuid(), newParentNode.getTaxon(), this, editor);
+
+ AbstractUtility.executeOperation(operation, sync);
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ NameEditorMenuPropertyTester.isSynonym(selectedElement)
+ && NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement);
+
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ editor.redraw();
+ return false;
+ }
+
+ @Override
+ public boolean onComplete() {
+ partService.hidePart(activePart);
+ EditorUtil.openTaxonNodeE4(newParentNode.getUuid(), modelService, partService, application);
+ return true;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class SetBasionymHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) activePart.getObject();
+
+ TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
+
+ AbstractPostOperation operation;
+
+ operation = new ChangeHomotypicalGroupBasionymOperation(menuItem.getLocalizedLabel(), editor.getUndoContext(),
+ editor.getTaxon(), selectedTaxonBase, editor);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ NameEditorMenuPropertyTester.isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.editor.name.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
+import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @since Aug 28, 2017
+ *
+ */
+public class SwapSynonymAndAcceptedHandlerE4 implements IPostOperationEnabled {
+
+ private TaxonNameEditorE4 editor;
+ private Taxon taxon;
+ private EPartService partService;
+ private MPart activePart;
+ private MApplication application;
+ private EModelService modelService;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MHandledMenuItem menuItem, EPartService partService,
+ EModelService modelService, MApplication application,
+ UISynchronize sync) {
+
+ this.activePart = activePart;
+ this.modelService = modelService;
+ this.application = application;
+ this.partService = partService;
+
+ editor = (TaxonNameEditorE4) activePart.getObject();
+
+ Synonym synonym = (Synonym) selection.getFirstElement();
+
+ // Force user to save taxon - not really necessary though, is it?
+ if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+ return;
+ }
+
+ SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), synonym, this, editor.getEditorInput());
+
+ AbstractUtility.executeOperation(operation, sync);
+
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ Object selectedElement = selection.getFirstElement();
+ canExecute =
+ NameEditorMenuPropertyTester.isSynonym(selectedElement);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ // Redraw existing editor
+ // ((IPostOperationEnabled) editor).postOperation(null);
+
+ editor.save(AbstractUtility.getMonitor());
+ partService.hidePart(activePart);
+
+ if (objectAffectedByOperation instanceof Taxon) {
+ taxon = (Taxon) objectAffectedByOperation;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ Display display = Display.getCurrent();
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ EditorUtil.openTaxonBaseE4(taxon.getUuid(), modelService, partService, application);
+ } catch (Exception e) {
+ MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this,
+ e.getMessage());
+ }
+
+ }
+ });
+ return true;
+ }
+}
-package eu.etaxonomy.taxeditor.editor.name.operation;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.UUID;\r
-\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.operations.IUndoContext;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-\r
-import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.api.service.UpdateResult;\r
-import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;\r
-import eu.etaxonomy.cdm.model.name.TaxonName;\r
-import eu.etaxonomy.cdm.model.taxon.Synonym;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.taxeditor.editor.EditorUtil;\r
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;\r
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;\r
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-public class MoveSynonymToAnotherAcceptedTaxonOperation extends\r
- AbstractPostTaxonOperation {\r
-\r
- /**\r
- * The synonym to be moved.\r
- */\r
- private final Synonym synonym;\r
-\r
- private final Taxon oldTaxon;\r
-\r
-\r
- /**\r
- * <p>Constructor for MoveSynonymToAnotherAcceptedTaxon.</p>\r
- *\r
- * @param label a {@link java.lang.String} object.\r
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.\r
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.\r
- * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.\r
-\r
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.\r
- */\r
- public MoveSynonymToAnotherAcceptedTaxonOperation(String label, IUndoContext undoContext,\r
- UUID oldTaxonUUID, UUID synonymUUID, Taxon taxon, IPostOperationEnabled postOperationEnabled) {\r
-\r
- super(label, undoContext, taxon, postOperationEnabled);\r
- List<String> propertyPaths = new ArrayList<String>();\r
- propertyPaths.add("synonymRelations"); //$NON-NLS-1$\r
- this.element = (Taxon) CdmStore.getService(ITaxonService.class).load(taxon.getUuid(),propertyPaths);\r
- this.oldTaxon = (Taxon) CdmStore.getService(ITaxonService.class).load(oldTaxonUUID);\r
- this.synonym = (Synonym) CdmStore.getService(ITaxonService.class).load(synonymUUID);\r
- if(synonym == null){\r
- throw new IllegalArgumentException(\r
- "A null synonym was provided."); //$NON-NLS-1$\r
- }\r
- }\r
-\r
- @Override\r
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
-\r
- // Get synonym name\r
- TaxonName synonymName = synonym.getName();\r
- monitor.worked(20);\r
-\r
- // Switch groups\r
-\r
- monitor.worked(40);\r
-\r
- ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();\r
- UpdateResult result;\r
-\r
- try {\r
- result = CdmStore.getService(ITaxonService.class).moveSynonymToAnotherTaxon(synonym,\r
- this.element.getUuid(),\r
- true,\r
- synonym.getType(),\r
- null,\r
- null,\r
- true);\r
- } catch (HomotypicalGroupChangeException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
- ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();\r
-\r
- // Redraw editor if it exists\r
- return postExecute(synonym);\r
- }\r
-\r
- @Override\r
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
-}\r
+package eu.etaxonomy.taxeditor.editor.name.e4.operation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.api.service.exception.HomotypicalGroupChangeException;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class MoveSynonymToAnotherAcceptedTaxonOperationE4 extends
+ AbstractPostTaxonOperation {
+
+ /**
+ * The synonym to be moved.
+ */
+ private final Synonym synonym;
+ private IConversationEnabled conversationEnabled;
+
+ public MoveSynonymToAnotherAcceptedTaxonOperationE4(String label, IUndoContext undoContext, UUID synonymUUID,
+ Taxon taxon, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
+
+ super(label, undoContext, taxon, postOperationEnabled);
+ List<String> propertyPaths = new ArrayList<String>();
+ propertyPaths.add("synonymRelations"); //$NON-NLS-1$
+ this.conversationEnabled = conversationEnabled;
+ this.element = (Taxon) CdmStore.getService(ITaxonService.class).load(taxon.getUuid(),propertyPaths);
+ this.synonym = (Synonym) CdmStore.getService(ITaxonService.class).load(synonymUUID);
+ if(synonym == null){
+ throw new IllegalArgumentException(
+ "A null synonym was provided."); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ monitor.worked(20);
+
+ // Switch groups
+
+ monitor.worked(40);
+
+ conversationEnabled.getConversationHolder().commit();
+
+ try {
+ CdmStore.getService(ITaxonService.class).moveSynonymToAnotherTaxon(synonym,
+ this.element.getUuid(),
+ true,
+ synonym.getType(),
+ null,
+ null,
+ true);
+ } catch (HomotypicalGroupChangeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ conversationEnabled.getConversationHolder().commit();
+
+ // Redraw editor if it exists
+ return postExecute(null);
+ }
+
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
+
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return null;
+ }
+
+}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToAcceptedTaxonOperation;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-/**
- * <p>ChangeSynonymToAcceptedTaxonHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- */
-public class ChangeSynonymToAcceptedTaxonHandler extends AbstractHandler implements IPostOperationEnabled {
- private static final Logger logger = Logger
- .getLogger(ChangeSynonymToAcceptedTaxonHandler.class);
- private MultiPageTaxonEditor editor;
-
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);
- Shell shell = HandlerUtil.getActiveShell(event);
- IEditorInput input = editor.getEditorInput();
-
- if (!(input instanceof TaxonEditorInput)) {
- logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
- return null;
- }
-
- // Get synonym from selection
- StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event);
- if (!(selection.getFirstElement() instanceof Synonym)) {
- logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
- return null;
- }
-
- Synonym synonym = (Synonym) selection.getFirstElement();
-
- // Force user to save taxon - not really necessary though, is it?
- if (!EditorUtil.forceUserSave(editor, shell)) {
- return null;
- }
-
- // Get taxon
- Taxon taxon = ((TaxonEditorInput) input).getTaxon();
-
- TaxonNode parentNode = (TaxonNode) HibernateProxyHelper.deproxy(((TaxonEditorInput) input).getTaxonNode().getParent());
-
- List<UUID> excludeTaxa = new ArrayList<>();
- //excludeTaxa.add(taxon.getUuid());//there are some cases where the accepted taxon should be the parent of the new created accepted taxon
-
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInput) input).getTaxonNode().getClassification());
-
-
- if(newParentNode != null){
-
- // TODO get synonyms from homotypical group and add them as homotypic synonyms to new accepted taxon
- // apply confirmation dialog
- HomotypicalGroup group = synonym.getHomotypicGroup();
- Set<TaxonName> namesInGroup = group.getTypifiedNames();
- // FIXME with this implementation we can not create a taxonNode that is a direct child of the classification node
- AbstractPostOperation operation = new ChangeSynonymToAcceptedTaxonOperation(Messages.ChangeSynonymToAcceptedTaxonHandler_CHANGE_SYN_TO_ACC_TAXON, EditorUtil.getUndoContext(),
- taxon, newParentNode, synonym, namesInGroup, this, editor, (ICdmEntitySessionEnabled)editor.getEditorInput()); //$NON-NLS-1$
-
- EditorUtil.executeOperation(operation);
- }
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
-
- // Redraw existing editor
- ((IPostOperationEnabled) editor).postOperation(null);
-
- editor.doSave(EditorUtil.getMonitor());
-
- if (objectAffectedByOperation instanceof TaxonNode) {
-
- // Open new unsaved editor with existing taxon's parent as temporary parent
- TaxonNode newNode = (TaxonNode) objectAffectedByOperation;
-// TaxonNode newNode = parentNode.addChild(newTaxon);
-
- try {
- // TODO
- /*
- * This doesn't work b/c newNode hasn't been committed yet, and therefore
- * CdmStore.getTaxonService().getTaxonNodeByUuid(taxonNodeUuid);
- * doesn't work yet.
- */
- EditorUtil.openTaxonNode(newNode.getUuid());
-
- } catch (PartInitException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage());
- }
- }
- return true;
- }
-
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
- @Override
- public boolean onComplete() {
- // TODO Auto-generated method stub
- return false;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.swt.widgets.Event;
-
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToConceptOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>ChangeToConceptRelationHandler class.</p>
- *
- * @author n.hoffmann
- * @created 22.04.2009
- * @version 1.0
- */
-public class ChangeToConceptRelationHandler extends AbstractHandler implements
- IHandler {
- private static final Logger logger = Logger
- .getLogger(ChangeToConceptRelationHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- TaxonBase taxonBase = (TaxonBase) EditorUtil.getSelection(event).getFirstElement();
-
- TaxonRelationshipType type = (TaxonRelationshipType) ((Event)event.getTrigger()).data;
-
- AbstractPostOperation operation;
- try {
- if(taxonBase instanceof Synonym){
- Synonym synonym = (Synonym) taxonBase;
- operation = new ChangeSynonymToConceptOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), synonym, type, editor);
- EditorUtil.executeOperation(operation);
- }
- if(taxonBase instanceof Taxon){
- Taxon misapplication = (Taxon) taxonBase;
- operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), misapplication, type, editor);
- EditorUtil.executeOperation(operation);
- }
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>ChangeToMisapplicationHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class ChangeToMisapplicationHandler extends AbstractHandler implements
- IHandler {
- private static final Logger logger = Logger
- .getLogger(ChangeToMisapplicationHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
- Shell shell = HandlerUtil.getActiveShell(event);
- MultiPageTaxonEditor multiPageTaxonEditor = EditorUtil.getActiveMultiPageTaxonEditor();
- if (!EditorUtil.forceUserSave(multiPageTaxonEditor, shell)) {
- return null;
- }
- Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
-
- AbstractPostOperation operation = null;
- try {
- if(selectedElement instanceof Taxon){
- operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
- }
- if(selectedElement instanceof Synonym){
- operation = new ChangeSynonymToMisapplicationOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
- }
-
-
- EditorUtil.executeOperation(operation);
-
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptToSynonymOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>ChangeToSynonymHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class ChangeToSynonymHandler extends AbstractHandler implements
- IHandler {
- private static final Logger logger = Logger
- .getLogger(ChangeToSynonymHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- Taxon concept = (Taxon) EditorUtil.getSelection(event).getFirstElement();
-
- AbstractPostOperation operation;
- try {
- operation = new ChangeConceptToSynonymOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), concept, null, editor);
-
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInNewGroupOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.parser.ParseHandler;
-
-/**
- * <p>CreateHeterotypicSynonymHandler class.</p>
- *
- * @author n.hoffmann
- * @created 06.02.2009
- */
-public class CreateHeterotypicSynonymHandler extends AbstractHandler implements
- IHandler {
- private static final Logger logger = Logger
- .getLogger(CreateHeterotypicSynonymHandler.class);
-
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- TaxonName newSynonymName = ParseHandler.createEmptyName();
-
- AbstractPostOperation<?> operation;
- try {
- operation = new CreateSynonymInNewGroupOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), newSynonymName, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.parser.ParseHandler;
-
-/**
- * <p>CreateHomotypicSynonymHandler class.</p>
- *
- * @author n.hoffmann
- * @created 06.02.2009
- */
-public class CreateHomotypicSynonymHandler extends AbstractHandler implements
- IHandler {
-
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
- Taxon taxon = editor.getTaxon();
- HomotypicalGroup group = taxon.getHomotypicGroup();
- TaxonName newSynonymName = ParseHandler.createEmptyName();
-
- AbstractPostOperation<?> operation;
- try {
- operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(),
- editor.getUndoContext(), taxon, group, newSynonymName, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.error(getClass(), e);
- }
-
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.parser.ParseHandler;
-
-/**
- * <p>CreateMisapplicationHandler class.</p>
- *
- * @author n.hoffmann
- * @created 16.04.2009
- */
-public class CreateMisapplicationHandler extends AbstractHandler {
- private static final Logger logger = Logger
- .getLogger(CreateMisapplicationHandler.class);
-
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
-
- TaxonName conceptName = ParseHandler.createEmptyName();
- Taxon concept = Taxon.NewInstance(conceptName, null);
-
- TaxonRelationshipType type = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
-
- AbstractPostOperation<?> operation;
- try {
- operation = new CreateConceptRelationOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), concept, type, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.CreateSynonymInExistingHomotypicalGroupOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.parser.ParseHandler;
-
-/**
- * <p>CreateSynonymInHomotypicalGroupHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class CreateSynonymInHomotypicalGroupHandler extends AbstractHandler
- implements IHandler {
- private static final Logger logger = Logger
- .getLogger(CreateSynonymInHomotypicalGroupHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
- ISelection menuSelection = HandlerUtil.getCurrentSelection(event);
-
- Object selecteObject = ((StructuredSelection) menuSelection).getFirstElement();
-
- if(! (selecteObject instanceof Synonym)){
- return null;
- }
-
-
- Synonym synonym = (Synonym) selecteObject;
-
- HomotypicalGroup group = synonym.getHomotypicGroup();
-
- TaxonName newSynonymName = ParseHandler.createEmptyName();
-
- AbstractPostOperation<?> operation;
-
- try {
- operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(), editor.getUndoContext(),
- editor.getTaxon(), group, newSynonymName, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer;
-
-/**
- * @author n.hoffmann
- * @created Jan 28, 2011
- * @version 1.0
- */
-public class DeleteAllEmptyNamesHandler extends DeleteTaxonBaseHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
-
- for(AbstractGroupedContainer<TaxonBase> containerWithEmptyName : editor.getEmptyContainers()){
- editor.removeGroup(containerWithEmptyName.getGroup());
- doExecute(event, editor, containerWithEmptyName.getData());
- }
-
- return null;
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.operation.MoveSynonymToAnotherAcceptedTaxonOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-public class MoveSynonymToAnotherAcceptedTaxonHandler extends AbstractHandler implements IPostOperationEnabled {
- private static final Logger logger = Logger
- .getLogger(MoveSynonymToAnotherAcceptedTaxonHandler.class);
- private MultiPageTaxonEditor editor;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- editor = (MultiPageTaxonEditor) HandlerUtil.getActiveEditor(event);
- Shell shell = HandlerUtil.getActiveShell(event);
- IEditorInput input = editor.getEditorInput();
- // Get synonym from selection before possible save dialog
- // because the selection will be null if save dialog is shown
- StructuredSelection selection = (StructuredSelection) HandlerUtil.getCurrentSelection(event);
-
- if (!EditorUtil.forceUserSave(editor, shell)) {
- return null;
- }
-
- if (!(input instanceof TaxonEditorInput)) {
- logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
- return null;
- }
-
- if (selection==null || !(selection.getFirstElement() instanceof Synonym)) {
- MessagingUtils.warningDialog(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION, this, Messages.MoveSynonymToAnotherAcceptedTaxonHandler_NO_SELECTION_MESSAGE);
- logger.error("Selection does not contain a Synonym"); //$NON-NLS-1$
- return null;
- }
-
- Synonym synonym = (Synonym) selection.getFirstElement();
- Taxon oldParent = ((TaxonEditorInput)input).getTaxon();
- List<UUID> excludeTaxa = new ArrayList<UUID>();
- excludeTaxa.add(oldParent.getUuid());
-
-
- TaxonNode newParentNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa, ((TaxonEditorInput)input).getTaxonNode(), ((TaxonEditorInput)input).getTaxonNode().getClassification());
-
- if(newParentNode!=null){
- MoveSynonymToAnotherAcceptedTaxonOperation operation = new MoveSynonymToAnotherAcceptedTaxonOperation(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
- oldParent.getUuid(), synonym.getUuid(), newParentNode.getTaxon(), editor);
-
- AbstractUtility.executeOperation(operation);
-
- }
- return null;
- }
-
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean onComplete() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
-
-}
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
}
- private boolean isAcceptedAndHasNoHomotypicSynonyms(Object selectedElement) {
+ public static boolean isAcceptedAndHasNoHomotypicSynonyms(Object selectedElement) {
if (isAccepted(selectedElement)){
Taxon taxon = (Taxon) selectedElement;
return taxon.getSynonymsInGroup(taxon.getHomotypicGroup()).isEmpty();
return false;
}
- private boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) {
+ public static boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) {
if (isSynonym(selectedElement)){
Synonym synonym = (Synonym) selectedElement;
return synonym.getHomotypicGroup().getTypifiedNames().size()>1;
}
- private boolean isNotHomotypicSynonymOfAcceptedTaxon(Object selectedElement) {
+ public static boolean isNotHomotypicSynonymOfAcceptedTaxon(Object selectedElement) {
if (isSynonym(selectedElement)){
Synonym synonym = (Synonym) selectedElement;
Taxon taxon = synonym.getAcceptedTaxon();
- if (taxon != null &&
+ if (taxon != null &&
taxon.getHomotypicGroup().equals(synonym.getHomotypicGroup())){
return false;
}
* @param receiver
* @return
*/
- private boolean hasEmptyNames(Object receiver) {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
+ public static boolean hasEmptyNames(Object receiver) {
+ TaxonNameEditorE4 editor = (TaxonNameEditorE4) EventUtility.getTaxonEditor();
return editor == null ? false : editor.checkForEmptyNames();
}
- private boolean isRelatedConcept(Object selectedElement) {
+ public static boolean isRelatedConcept(Object selectedElement) {
if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isRelatedConcept()){
return true;
}
return false;
}
- private boolean isTaxonBase(Object selectedElement) {
+ public static boolean isTaxonBase(Object selectedElement) {
return (selectedElement instanceof TaxonBase) ? true : false;
}
- private boolean isMisapplication(Object selectedElement) {
+ public static boolean isMisapplication(Object selectedElement) {
if(selectedElement instanceof Taxon && ((Taxon) selectedElement).isMisapplication()){
return true;
}
return false;
}
- private boolean isSynonym(Object selectedElement) {
+ public static boolean isSynonym(Object selectedElement) {
return (selectedElement instanceof Synonym) ? true : false;
}
- private boolean isAccepted(Object selectedElement) {
+ public static boolean isAccepted(Object selectedElement) {
return (selectedElement instanceof Taxon && ! ((Taxon) selectedElement).isMisapplication()) ? true : false;
}
- private boolean isOrphaned(Object selectedElement) {
+ public static boolean isOrphaned(Object selectedElement) {
if(selectedElement instanceof Taxon){
return ((Taxon) selectedElement).isOrphaned();
}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.RemoveHomotypicalGroupBasionymOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>RemoveBasionymHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class RemoveBasionymHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger
- .getLogger(RemoveBasionymHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
-
- TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
-
- AbstractPostOperation operation;
-
- try {
- operation = new RemoveHomotypicalGroupBasionymOperation(event.getCommand().getName(), editor.getUndoContext(),
- editor.getTaxon(), selectedTaxonBase, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeHomotypicalGroupBasionymOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>SetBasionymHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class SetBasionymHandler extends AbstractHandler implements IHandler {
- private static final Logger logger = Logger
- .getLogger(SetBasionymHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
-
- TaxonBase selectedTaxonBase = (TaxonBase) selection.getFirstElement();
-
- AbstractPostOperation operation;
-
- try {
- operation = new ChangeHomotypicalGroupBasionymOperation(event.getCommand().getName(), editor.getUndoContext(),
- editor.getTaxon(), selectedTaxonBase, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-
-/**
- * <p>SwapSynonymAndAcceptedHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class SwapSynonymAndAcceptedHandler extends AbstractHandler implements
- IHandler, IPostOperationEnabled {
- private static final Logger logger = Logger
- .getLogger(SwapSynonymAndAcceptedHandler.class);
- private MultiPageTaxonEditor editor;
- private Taxon taxon;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- editor = EditorUtil.getActiveMultiPageTaxonEditor();
- Shell shell = HandlerUtil.getActiveShell(event);
- Synonym synonym = (Synonym) EditorUtil.getSelection(event).getFirstElement();
-
-
- // Force user to save taxon - not really necessary though, is it?
- if (!EditorUtil.forceUserSave(editor, shell)) {
- return null;
- }
-
- try {
- SwapSynonymAndAcceptedOperation operation = new SwapSynonymAndAcceptedOperation(event.getCommand().getName(),
- editor.getUndoContext(),
- editor.getTaxon(),
- synonym,
- this,
- (ICdmEntitySessionEnabled)editor.getEditorInput());
-
- EditorUtil.executeOperation(operation);
-
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase, boolean)
- */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
- // Redraw existing editor
- //((IPostOperationEnabled) editor).postOperation(null);
-
- editor.doSave(EditorUtil.getMonitor());
- editor.close(true);
-
- if (objectAffectedByOperation instanceof Taxon) {
-
- taxon = (Taxon) objectAffectedByOperation;
-
-
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#onComplete()
- */
- @Override
- public boolean onComplete() {
- Display display = Display.getCurrent();
- display.asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- EditorUtil.openTaxonBase(taxon.getUuid());
-
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.SwapSynonymAndAcceptedHandler_COULD_NOT_OPEN, this, e.getMessage());
- }
-
- }
- });
- return true;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>CreateNameRelationOperation class.</p>
- *
- * @author n.hoffmann
- * @created Mar 30, 2010
- */
-public class CreateNameRelationOperation extends AbstractPostTaxonOperation {
-
- private TaxonBase taxonBase;
- private TaxonName relatedName;
- private NameRelationshipType type;
-
- /**
- * <p>Constructor for CreateNameRelationOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
- * @param relatedName a {@link eu.etaxonomy.cdm.model.name.TaxonNameBase} object.
- * @param type a {@link eu.etaxonomy.cdm.model.name.NameRelationshipType} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public CreateNameRelationOperation(String label, IUndoContext undoContext, TaxonBase taxonBase, TaxonName relatedName, NameRelationshipType type, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, postOperationEnabled);
- this.taxonBase = taxonBase;
- this.relatedName = relatedName;
- this.type = type;
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- TaxonName fromName = taxonBase.getName();
-
- fromName.addRelationshipToName(relatedName, type, null);
-
- return postExecute(taxonBase);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return execute(monitor, info);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- TaxonName fromName = taxonBase.getName();
-
- fromName.removeRelationToTaxonName(relatedName);
-
- return postExecute(taxonBase);
- }
-}
* @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
+ public DeleteMisapplicationOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,
Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
//super(label, undoContext, taxon, postOperationEnabled);
- super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.misapplication = misapplication;
this.element = taxon;
}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.model.name.NameRelationship;
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>DeleteNameRelationOperation class.</p>
- *
- * @author n.hoffmann
- * @created Mar 30, 2010
- */
-public class DeleteNameRelationOperation extends AbstractPostTaxonOperation {
-
- private NameRelationship nameRelationship;
-
- /**
- * <p>Constructor for DeleteNameRelationOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param nameRelationship a {@link eu.etaxonomy.cdm.model.name.NameRelationship} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public DeleteNameRelationOperation(String label, IUndoContext undoContext, NameRelationship nameRelationship,
- IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, postOperationEnabled);
- this.nameRelationship = nameRelationship;
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- TaxonName fromName = nameRelationship.getFromName();
-
- fromName.removeRelationToTaxonName(nameRelationship.getToName());
-
- return postExecute(null);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return execute(monitor, info);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- // TODO Auto-generated method stub
- return null;
- }
-}
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.IWorkbenchPage;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,IWorkbenchPage activePage,
+ public DeleteSynonymOperation(String label, IUndoContext undoContext, TaxonBaseDeletionConfigurator configurator,
Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled,ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
+ super(label, undoContext, configurator, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);
this.synonym = synonym;
this.element = taxon;
}
import org.eclipse.core.runtime.IAdaptable;\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.ui.IWorkbenchPage;\r
\r
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
import eu.etaxonomy.cdm.api.service.DeleteResult;\r
public DeleteTaxonBaseOperation(String label,\r
IUndoContext undoContext,\r
TaxonBaseDeletionConfigurator configurator,\r
- IWorkbenchPage activePage,\r
IPostOperationEnabled postOperationEnabled,\r
IConversationEnabled conversationEnabled,\r
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.name.operation;\r
-\r
-import java.util.Iterator;\r
-import java.util.Set;\r
-\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.operations.IUndoContext;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.ui.IWorkbenchPage;\r
-\r
-import eu.etaxonomy.cdm.api.application.ICdmRepository;\r
-import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
-import eu.etaxonomy.cdm.api.service.ITaxonService;\r
-import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;\r
-import eu.etaxonomy.cdm.model.taxon.Classification;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;\r
-import eu.etaxonomy.taxeditor.store.CdmStore;\r
-\r
-public class DeleteTaxonOperation extends DeleteTaxonBaseOperation{\r
-\r
- private final Classification classification;\r
-\r
- public DeleteTaxonOperation(String label,\r
- IUndoContext undoContext,\r
- Taxon taxon,\r
- TaxonDeletionConfigurator configurator,\r
- Classification classification,\r
- IWorkbenchPage activePage,\r
- IPostOperationEnabled postOperationEnabled,\r
- IConversationEnabled conversationEnabled,\r
- ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
- super(label, undoContext, configurator, activePage, postOperationEnabled, conversationEnabled, cdmEntitySessionEnabled);\r
- this.element = taxon;\r
-\r
- Set<TaxonNode> nodes = taxon.getTaxonNodes();\r
- if (nodes.size() == 1 && classification == null){\r
- this.taxonNode = nodes.iterator().next();\r
- } else if (classification != null){\r
- Iterator<TaxonNode> iterator = nodes.iterator();\r
- while (iterator.hasNext()){\r
- TaxonNode node = iterator.next();\r
- if (node.getClassification().equals(classification)){\r
- this.taxonNode = node;\r
- }\r
- }\r
- } else{\r
- //TODO\r
- }\r
- this.classification = classification;\r
-\r
- }\r
-\r
- @Override\r
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
-\r
- monitor.worked(20);\r
- bind();\r
-\r
-\r
- ICdmRepository controller;\r
-\r
- controller = CdmStore.getCurrentApplicationConfiguration();\r
-\r
- ITaxonService service = controller.getTaxonService();\r
-\r
- result = service.deleteTaxon(element.getUuid(), (TaxonDeletionConfigurator)configurator, classification.getUuid());\r
-
-\r
-\r
- monitor.worked(40);\r
-\r
-\r
- return postExecute(null);\r
- }\r
-\r
- @Override\r
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.operation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-
-import eu.etaxonomy.cdm.model.name.TaxonName;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>RemoveHomotypicalGroupBasionymOperation class.</p>
- *
- * @author p.ciardelli
- * @created 15.01.2009
- */
-public class RemoveHomotypicalGroupBasionymOperation extends
- AbstractPostTaxonOperation {
-
- private TaxonBase taxonBase;
-
- /**
- * <p>Constructor for RemoveHomotypicalGroupBasionymOperation.</p>
- *
- * @param text a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- * @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public RemoveHomotypicalGroupBasionymOperation(String text,
- IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
- super(text, undoContext, taxon, postOperationEnabled);
-
- this.taxonBase = taxonBase;
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
-
- TaxonName name = taxonBase.getName();
- monitor.worked(20);
-
- name.removeAsGroupsBasionym();
- monitor.worked(40);
-
- return postExecute(taxonBase);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- return execute(monitor, info);
- }
-
- /** {@inheritDoc} */
- @Override
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)
- throws ExecutionException {
- taxonBase.getName().setAsGroupsBasionym();
-
- return postExecute(taxonBase);
- }
-}
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
* @version 1.0
*/
public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData, IConversationEnabled,
- IContextListener, IPartContentHasDetails, IDirtyMarkable{
+ IContextListener, IDirtyMarkable, IPartContentHasDetails{
private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA;
private static final String UNKNOWN = Messages.ChecklistEditor_UNKNOWN;
private Label statusLabel;
- // private final ICdmEntitySession cdmEntitySession;
+ private ICdmEntitySession cdmEntitySession;
private ChecklistLabelProvider labelProvider;
selectionService = getSite().getWorkbenchWindow().getSelectionService();
selectionService.addSelectionListener(this);
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+
+// viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+// @Override
+// public void selectionChanged(SelectionChangedEvent event) {
+// IStructuredSelection selection = viewer.getStructuredSelection();
+// Object firstElement = selection.getFirstElement();
+// // do something with it
+// }
+//
+//
+// });
labelProvider = new ChecklistLabelProvider(this.viewer);
terms = labelProvider.getNamedAreas();
final Text searchText = createSearchBar(parent);
createToolbar(parent);
- getSite().setSelectionProvider(viewer);
+ // getSite().setSelectionProvider(viewer);
final ModifyListener modifyListener = new ChecklistModifyListener(viewer, filter, searchText);
TaxonNode taxonNode = checklistEditorInput.getTaxonNode();
if (classification != null && taxonNode == null) {
countNodes = taxonNodeService.countAllNodesForClassification(classification);
- statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
+// statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
// This should not kill the view nor the editor if something goes
// wrong
// TODO: don't load the whole taxonNode Object but rather a small
// FIXME: May be don't open classification which are greater than
// 3000 Taxa
selectedTaxonNodes = taxonNodeService.listAllNodesForClassification(classification, 0, countNodes);
+ countNodes = selectedTaxonNodes.size();
+ statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG);
}
if (taxonNode != null) {
selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, null);
getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG);
+ countNodes = selectedTaxonNodes.size();
+ statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
}
}
/** {@inheritDoc} */
@Override
public void dispose() {
- this.checklistEditorInput.dispose();
+// this.checklistEditorInput.dispose();
super.dispose();
conversation.unregisterForDataStoreChanges(this);
*/
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+// System.out.println(selection.getClass().getSimpleName());
+// viewer.setSelection(selection, true);
}
import java.util.List;
import java.util.UUID;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPersistable;
-import org.eclipse.ui.IPersistableElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
* @date 25.04.2014
*
*/
-public class ChecklistEditorInput extends CdmEntitySessionInput implements IEditorInput, IPersistable {
+public class ChecklistEditorInput extends CdmEntitySessionInput implements IPersistable {
/**
* The selected classification
*/
private TaxonNode taxonNode = null;
- private final List<TaxonBase> taxa = new ArrayList<TaxonBase>();
+ private List<Taxon> taxa = new ArrayList<Taxon>();
private Classification classification = null;
public ChecklistEditorInput(TaxonNode taxonNode){
super(false);
this.conversation = CdmStore.createConversation();
+ initSession();
this.taxonNode =CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid(), getTaxonNodePropertyPaths());
- // getChildTaxa(taxonNode);
+ getChildTaxa(taxonNode);
classification = taxonNode.getClassification();
- initSession();
+
}
-
+
/**
* @param taxonNode2
taxonNode2.removeNullValueFromChildren();
if (taxonNode2.hasChildNodes()){
for (TaxonNode node: taxonNode2.getChildNodes()){
- taxa.add(node.getTaxon());
+ node = CdmStore.getService(ITaxonNodeService.class).load(node.getUuid(), getTaxonNodePropertyPaths());
+ taxa.add(HibernateProxyHelper.deproxy(node.getTaxon(), Taxon.class));
getChildTaxa(node);
}
}
public ChecklistEditorInput(Classification classification) {
super(true);
this.conversation = CdmStore.createConversation();
+ initSession();
this.classification = CdmStore.getCurrentApplicationConfiguration().getClassificationService().load(classification.getUuid());
+ getChildTaxa(classification.getRootNode());
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- @Override
- public boolean exists() {
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
+ public List<Taxon> getTaxa() {
+ return taxa;
+ }
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
public String getName() {
- if(taxonNode != null){
+ if(taxonNode != null && taxonNode.getTaxon()!=null){
return taxonNode.getTaxon().getName().getTitleCache();
}else{
return classification.getTitleCache();
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return classification.getTitleCache();
- }
/**
* @return the taxonNode
@Override
public void merge() {
- for (TaxonBase taxon:taxa){
+ for (TaxonBase taxon:this.taxa){
CdmStore.getService(ITaxonService.class).merge(taxon, true);
}
- // CdmStore.getService(ITaxonNodeService.class).merge(taxonNode, true);
+
}
/* (non-Javadoc)
public ConversationHolder getConversation() {
return conversation;
}
-
+
private List<String> getTaxonNodePropertyPaths() {
List<String> taxonNodePropertyPaths = new ArrayList<String>();
for(String propertyPath : getTaxonBasePropertyPaths()) {
return taxonBasePropertyPaths;
}
-
+
+
+ public void setTaxa(List<Taxon> taxonList) {
+ this.taxa = taxonList;
+
+ }
+
// @Override
// public void dispose(){
// conversation.unbind();
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
+
+import java.util.SortedSet;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.ToolItem;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionWizard;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ * Handles drop down menu selection. Available items are defined in the
+ * enumeration SearchOption.
+ *
+ * @author n.hoffmann
+ * @created Feb 2, 2010
+ * @version 1.0
+ */
+public class ChecklistDropdownSelectionListenerE4 extends SelectionAdapter {
+
+ private final Menu menu;
+ private final ChecklistEditorE4 editor;
+ private final SortedSet<DefinedTermBase> termSet;
+ private Logger logger = Logger.getLogger(ChecklistDropdownSelectionListenerE4.class);
+
+ public ChecklistDropdownSelectionListenerE4(ToolItem dropdown, ChecklistEditorE4 editor,
+ SortedSet<DefinedTermBase> termSet) {
+ this.editor = editor;
+ this.termSet = termSet;
+ menu = new Menu(dropdown.getParent().getShell());
+ initialMenuItem();
+ }
+
+ // SearchOption option
+ public void add(DefinedTermBase<DefinedTermBase> term) {
+ MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
+ menuItem.setText(term.getTitleCache());
+ if (PreferencesUtil.getPreferenceStore().getBoolean(term.getUuid().toString())) {
+ menuItem.setSelection(true);
+ } else {
+ menuItem.setSelection(false);
+ }
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ MenuItem selected = (MenuItem) event.widget;
+
+ TableViewer viewer = (TableViewer) editor.getViewer();
+ final Table table = viewer.getTable();
+ // TODO make it selectable according to selection event
+ TableColumn column = null;
+ DefinedTermBase<DefinedTermBase> selectedTerm = null;
+ if (termSet != null) {
+ TableColumn[] columns = viewer.getTable().getColumns();
+ for(int i=0; i<columns.length; i++){
+ if(selected.getText().equalsIgnoreCase(columns[i].getText())){
+ column = columns[i];
+ logger.info("Column no " +i +" Column Header "+ column.getText() ); //$NON-NLS-1$ //$NON-NLS-2$
+ for (DefinedTermBase<DefinedTermBase> term : termSet) {
+ if(column.getText().equalsIgnoreCase(term.getTitleCache())){
+ selectedTerm = term;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (column != null && column.getWidth() == 0) {
+ // save column status if shown or not
+ if (selectedTerm != null) {
+ PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), true);
+ }
+ column.setWidth(100);
+ } else if (column != null) {
+ if (selectedTerm != null) {
+ PreferencesUtil.getPreferenceStore().setValue(selectedTerm.getUuid().toString(), false);
+ }
+ column.setWidth(0);
+ }
+ }
+ });
+ }
+
+ private void initialMenuItem(){
+ MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
+ menuItem.setText(Messages.ChecklistDropdownSelectionListener_ADD_DISTRIBUTION);
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ AvailableDistributionWizard availableDistributionWizard = new AvailableDistributionWizard();
+ WizardDialog dialog = new WizardDialog(StoreUtil.getShell(),
+ availableDistributionWizard);
+
+ int open = dialog.open();
+ if(open == 0){
+ editor.reload();
+ }
+ }
+ });
+ new MenuItem(menu, SWT.SEPARATOR);
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ if (event.detail == SWT.ARROW) {
+ ToolItem item = (ToolItem) event.widget;
+ Rectangle rect = item.getBounds();
+ Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y));
+ menu.setLocation(pt.x, pt.y + rect.height);
+ menu.setVisible(true);
+ } else {
+ menu.setVisible(true);
+ }
+ }
+
+ public Menu getMenu(){
+ return menu;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedSet;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
+import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.jface.viewers.TableViewerFocusCellManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistContentProvider;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorComparator;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistLabelProvider;
+import eu.etaxonomy.taxeditor.editor.view.checklist.filter.ChecklistEditorFilter;
+import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistFocusListener;
+import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistModifyListener;
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ *
+ * @author k.luther
+ *
+ */
+public class ChecklistEditorE4 implements IPartContentHasFactualData, IConversationEnabled,
+ IContextListener, IDirtyMarkable, IPartContentHasDetails, IE4SavablePart, IDistributionEditor{
+
+ private static final String DISTRIBUTION_EDITOR = "Distribution Editor";
+ private static final String LOADING_TAXA = Messages.ChecklistEditor_LOAD_TAXA;
+ private static final String UNKNOWN = Messages.ChecklistEditor_UNKNOWN;
+ private static final String ELEMENT_COUNT = Messages.ChecklistEditor_ELEMENT_COUNT;
+ public static final String TYPE_FILTER_TEXT = "type filter text"; //$NON-NLS-1$
+
+ private static final Logger logger = Logger.getLogger(ChecklistEditorE4.class);
+
+
+// private class ChecklistJob extends Job {
+//
+// private List<TaxonNode> taxonNodes;
+//
+// /**
+// * @param name
+// */
+// public ChecklistJob(String title, List<TaxonNode> listTaxonNodes) {
+// super(title);
+// this.taxonNodes = listTaxonNodes;
+//
+//
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
+// * IProgressMonitor)
+// */
+// @Override
+// public IStatus run(final IProgressMonitor monitor) {
+// try {
+// logger.debug("Begin of eclipse core runtime Job to Retrieve datasources"); //$NON-NLS-1$
+// monitor.beginTask(Messages.ChecklistEditor_RETRIEVE_NODES, taxonNodes.size() + 1);
+//
+// final List<Taxon> taxonList = new ArrayList<Taxon>();
+//
+// for (TaxonNode taxonNode : taxonNodes) {
+// HibernateProxyHelper hh = new HibernateProxyHelper();
+// Taxon taxon = hh.deproxy(taxonNode.getTaxon(), Taxon.class);
+// taxonList.add(taxon);
+// }
+// // set View input
+// Display.getDefault().asyncExec(new Runnable() {
+//
+// @Override
+// public void run() {
+// viewer.setInput(taxonList);
+// }
+// });
+// monitor.worked(1);
+//
+// } finally {
+// monitor.done();
+// taxonNodes = null;
+// }
+// return Status.OK_STATUS;
+// }
+// }
+
+ /**
+ * Constant
+ * <code>ID="eu.etaxonomy.taxeditor.store.datasource"{trunked}</code>
+ */
+ public static String ID = "eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor"; //$NON-NLS-1$
+
+ private TableViewer viewer;
+
+ private String partNameCache;
+
+ //FIXME E4 migrate/delete ater full migration
+
+ private IWorkbenchSiteProgressService service;
+
+ private ITaxonNodeService taxonNodeService;
+
+ private ChecklistEditorComparator comparator;
+
+ private ChecklistEditorInput checklistEditorInput;
+
+ private ConversationHolder conversation;
+
+ private Integer countNodes;
+
+ private List<TaxonNode> selectedTaxonNodes;
+
+ @Inject
+ private MPart thisPart;
+
+ @Inject
+ private MDirtyable dirty;
+
+ @Inject
+ private ESelectionService selService;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ private ChecklistEditorFilter filter;
+
+ private Menu headerMenu;
+
+ private Label statusLabel;
+
+ // private final ICdmEntitySession cdmEntitySession;
+
+ private ChecklistLabelProvider labelProvider;
+
+ private SortedSet<DefinedTermBase> terms = null;
+ private ToolItem toolItem;
+ private ChecklistDropdownSelectionListenerE4 dropListener;
+
+ /**
+ * @return the selectedTaxonNodes
+ */
+ public List<TaxonNode> getSelectedTaxonNodes() {
+ return selectedTaxonNodes;
+ }
+
+ /**
+ * @param selectedTaxonNodes
+ * the selectedTaxonNodes to set
+ */
+ public void setSelectedTaxonNodes(List<TaxonNode> selectedTaxonNodes) {
+ this.selectedTaxonNodes = selectedTaxonNodes;
+ }
+
+ @Inject
+ public ChecklistEditorE4() {
+ }
+
+ /** {@inheritDoc} */
+ @PostConstruct
+ public void createPartControl(Composite parent) {
+ if (!CdmStore.isActive()){
+ return;
+ }
+ taxonNodeService = CdmStore.getService(ITaxonNodeService.class);
+ viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+
+ //the focuzsCellManager should return the distribution!!!
+ TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter (viewer));
+ TableViewerEditor.create(viewer, focusCellManager, new ColumnViewerEditorActivationStrategy(viewer), TableViewerEditor.KEYBOARD_ACTIVATION);
+
+
+// viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+// @Override
+// public void selectionChanged(SelectionChangedEvent event) {
+// IStructuredSelection selection = viewer.getStructuredSelection();
+// Object firstElement = selection.getFirstElement();
+// // do something with it
+// }
+//
+//
+// });
+
+
+
+ labelProvider = new ChecklistLabelProvider(this.viewer);
+
+ terms = labelProvider.getNamedAreas();
+ if (terms == null){
+ MessagingUtils.informationDialog(Messages.ChecklistEditor_NO_AREAS, Messages.ChecklistEditor_NO_AREAS_MESSAGE);
+ this.dispose();
+ return;
+ }
+ filter = new ChecklistEditorFilter();
+ createTopComposite(parent);
+ }
+
+ /**
+ * @param parent
+ */
+ private void createTopComposite(Composite parent) {
+ GridLayout gridLayout = new GridLayout(3, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ parent.setLayout(gridLayout);
+
+ final Text searchText = createSearchBar(parent);
+ createToolbar(parent);
+
+ // getSite().setSelectionProvider(viewer);
+
+ final ModifyListener modifyListener = new ChecklistModifyListener(viewer, filter, searchText);
+
+ searchText.addFocusListener(new ChecklistFocusListener(searchText, modifyListener));
+ searchText.addModifyListener(modifyListener);
+ createGridDataForViewerLayout();
+
+ viewer.addFilter(filter);
+ createTable();
+
+ viewer.setContentProvider(new ChecklistContentProvider());
+ viewer.setLabelProvider(this.labelProvider);
+ comparator = new ChecklistEditorComparator();
+ viewer.setComparator(comparator);
+
+ createStatusBar(parent);
+ }
+
+ private void createGridDataForViewerLayout() {
+ GridData gridData = new GridData();
+ gridData.verticalAlignment = GridData.FILL;
+ gridData.horizontalSpan = 3;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+ viewer.getControl().setLayoutData(gridData);
+ }
+
+ /**
+ * @param parent
+ * @return
+ */
+ private Text createSearchBar(Composite parent) {
+ Label searchLabel = new Label(parent, SWT.NONE);
+ searchLabel.setText(Messages.ChecklistEditor_SEARCH);
+ final Text searchText = new Text(parent, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.CANCEL);
+ searchText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ searchText.setForeground(EditorUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
+ searchText.setText(TYPE_FILTER_TEXT);
+ return searchText;
+ }
+
+ /**
+ * @param parent
+ */
+ private void createToolbar(Composite parent) {
+ ToolBar toolBar = new ToolBar(parent, SWT.NONE);
+ toolItem = new ToolItem(toolBar, SWT.DROP_DOWN | SWT.BORDER);
+ toolItem.setText(Messages.ChecklistEditor_DIST_STATUS);
+ toolItem.setToolTipText(Messages.ChecklistEditor_DIST_STATUS_TOOLTIP);
+ createToolbarItems();
+ toolItem.addSelectionListener(dropListener);
+ toolBar.pack();
+ }
+
+ private void createToolbarItems() {
+ dropListener = new ChecklistDropdownSelectionListenerE4(toolItem, this, terms);
+
+ for (DefinedTermBase<DefinedTermBase> term : terms) {
+ if(term!=null){
+ dropListener.add(term);
+ }
+ }
+ }
+
+ private void createStatusBar(Composite composite) {
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 3;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalAlignment = GridData.FILL;
+
+ statusLabel = new Label(composite, SWT.LEFT);
+ statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
+ statusLabel.setLayoutData(gridData);
+ }
+
+ private void createTable() {
+ Table table = viewer.getTable();//new Table(parent, viewer.getTable().getStyle());
+ List<String> titles = new ArrayList<String>();
+ List<Integer> bounds = new ArrayList<Integer>();
+ if (PreferencesUtil.isShowRankInChecklistEditor()){
+ Collections.addAll(titles, Messages.ChecklistEditor_TAXON, Messages.ChecklistEditor_RANK);
+ Collections.addAll(bounds, 300, 200);
+ } else{
+ Collections.addAll(titles, Messages.ChecklistEditor_TAXON);
+ Collections.addAll(bounds, 300);
+ }
+
+
+ Map<Integer, Boolean> restoreValuesForColumnWidth = restoreValuesForColumnWidth(titles, bounds);
+ createInitalDistributionColumns(table, titles, bounds, restoreValuesForColumnWidth);
+ table.setSortDirection(SWT.DOWN);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ }
+ /**
+ * This method creates initially the distribution columns for a table. It should only be called for creation.<br>
+ *<p>
+ *
+ *<b>Notice:</b> If you want to add additional columns later please use <b>addTableViewerColumn()</b>
+ *
+ * @param table
+ * @param titles
+ * @param bounds
+ * @param restoreValuesForColumnWidth
+ */
+ private void createInitalDistributionColumns(Table table,
+ List<String> titles, List<Integer> bounds, Map<Integer, Boolean> restoreValuesForColumnWidth) {
+ for (int columnIndex = 0; columnIndex < titles.size(); columnIndex++) {
+ TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+ column.getColumn().setText(titles.get(columnIndex));
+ column.getColumn().setWidth(bounds.get(columnIndex));
+ column.getColumn().setResizable(true);
+ column.getColumn().setMoveable(true);
+ column.getColumn().addSelectionListener(getSelectionAdapter(column.getColumn(), columnIndex));
+ if (columnIndex == 0) {
+ table.setSortColumn(column.getColumn());
+ }
+ if (columnIndex == 1 && PreferencesUtil.isShowRankInChecklistEditor()) {
+ /** uncommented it for now because no rank editing is wanted **/
+// column.setEditingSupport(new RankEditingSupport(viewer, this));
+ }
+ if ((columnIndex == 1 && !PreferencesUtil.isShowRankInChecklistEditor()) || columnIndex >= 2 ) {
+ //read PrefrenceStore to setWidth according to last saved state
+ if(restoreValuesForColumnWidth.get(columnIndex)){
+ column.getColumn().setWidth(50);
+ }else{
+ column.getColumn().setWidth(50);
+ }
+ column.setEditingSupport(new DistributionEditingSupportE4(viewer, this, columnIndex));
+
+ }
+ }
+ }
+
+ /**
+ * This methods loads the last opened distribution columns for the table viewer from the prefrence store.<br>
+ *<p>
+ * <b>Notice:</b> It adds also the TitleCache to the titles list for the header of each column.<p>
+ *
+ * @param titles
+ * @param bounds
+ * @return Map<Integer, Boolean>
+ */
+ private Map<Integer, Boolean> restoreValuesForColumnWidth(List<String> titles,
+ List<Integer> bounds) {
+ Map<Integer, Boolean> restoreColumnWidth = new HashMap<Integer, Boolean>();
+ if (terms != null) {
+ int columnIndex;
+ if (PreferencesUtil.isShowRankInChecklistEditor()){
+ columnIndex = 2;
+ } else{
+ columnIndex = 1;
+ }
+ for (DefinedTermBase<DefinedTermBase> term : terms) {
+ if(term != null){
+ restoreColumnWidth.put(columnIndex, PreferencesUtil.getPreferenceStore().getBoolean(term.getUuid().toString()));
+ if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+ if (term.getIdInVocabulary() != null){
+ titles.add(term.getIdInVocabulary());
+ } else{
+ titles.add(term.getTitleCache());
+ }
+ }else{
+ titles.add(term.getTitleCache());
+ }
+ bounds.add(200);
+ columnIndex++;
+ }
+ }
+ }
+ return restoreColumnWidth;
+ }
+
+ /**
+ * This method adds new DistributionColumns to an existing table.
+ *
+ * @param title
+ * @param bound
+ * @param colNumber
+ * @return
+ */
+ private TableViewerColumn addTableViewerColumn(String title, int bound, final int colNumber) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
+ final TableColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(200);
+ viewerColumn.setEditingSupport(new DistributionEditingSupportE4(viewer, this, colNumber));
+ column.setResizable(true);
+ column.setMoveable(true);
+ return viewerColumn;
+ }
+
+
+
+ /**
+ *
+ * pull data from database and set input for view
+ *
+ */
+ private void loadDataInput() {
+ Classification classification = checklistEditorInput.getClassification();
+ TaxonNode taxonNode = checklistEditorInput.getTaxonNode();
+ if (classification != null && taxonNode == null) {
+ countNodes = taxonNodeService.countAllNodesForClassification(classification);
+// statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
+ // This should not kill the view nor the editor if something goes
+ // wrong
+ // TODO: don't load the whole taxonNode Object but rather a small
+ // and simple Solution
+ // FIXME: May be don't open classification which are greater than
+ // 3000 Taxa
+ selectedTaxonNodes = taxonNodeService.listAllNodesForClassification(classification, 0, countNodes);
+ countNodes = selectedTaxonNodes.size();
+ statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
+ viewer.setInput(checklistEditorInput.getTaxa());
+// Job checkListJob = new ChecklistJob(LOADING_TAXA, selectedTaxonNodes);
+// checkListJob.schedule(Job.LONG);
+
+ }
+ if (taxonNode != null) {
+ selectedTaxonNodes = taxonNodeService.loadChildNodesOfTaxonNode(taxonNode, NODE_INIT_STRATEGY, true, null);
+ countNodes = selectedTaxonNodes.size();
+ viewer.setInput(checklistEditorInput.getTaxa());
+ statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
+// Job checkListJob = new ChecklistJob(LOADING_TAXA, selectedTaxonNodes);
+// checkListJob.schedule(Job.LONG);
+// getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @PreDestroy
+ public void dispose() {
+// if(checklistEditorInput!=null){
+// this.checklistEditorInput.getConversation().unregisterForDataStoreChanges(this.checklistEditorInput);
+// }
+
+ if(conversation!=null){
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.unbind();
+ }
+ //conversation.close();
+ conversation = null;
+ }
+
+ /** {@inheritDoc} */
+ @Focus
+ public void setFocus() {
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().setFocus();
+ }
+ }
+
+ //FIXME E4 migrate
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean)
+// */
+// /** {@inheritDoc} */
+// @Override
+// public void showBusy(boolean busy) {
+// super.showBusy(busy);
+// // viewer.getTable().setEnabled(!busy);
+// if (busy) {
+// partNameCache = getPartName();
+// setPartName(String.format(Messages.ChecklistEditor_LOAD_CNT_TAXA, countNodes));
+// } else {
+// if (partNameCache != null) {
+// setPartName(partNameCache);
+// }
+// }
+// }
+
+ /**
+ * <p>
+ * Getter for the field <code>viewer</code>.
+ * </p>
+ *
+ * @return a {@link org.eclipse.jface.viewers.StructuredViewer} object.
+ */
+ public StructuredViewer getViewer() {
+ return viewer;
+ }
+
+ public void refresh() {
+ viewer.refresh();
+ }
+
+ /**
+ * This method should only be called for adding new Distribution columns and reloading the table.<br>
+ * It will hide the old distribution column and load the newly added columns.<br>
+ * <p>
+ * <b>Notice:</b> for data update please use <b>refresh()</b>
+ *
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public void reload(){
+ //create new Items for Dropdown menue
+ Table table = viewer.getTable();
+ table.setRedraw(false);
+ SortedSet<DefinedTermBase> oldTerms = terms;
+
+// if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+//
+// } else{
+// terms = (SortedSet<DefinedTermBase>) labelProvider.getTermsOrderedByLabels(labelProvider.getNamedAreas(), CdmStore.getDefaultLanguage());
+// }
+ SortedSet<DefinedTermBase> newTerms = labelProvider.getNamedAreas();
+ toolItem.removeSelectionListener(dropListener);
+ hideDistributionColumns(oldTerms);
+ createToolbarItems();
+ toolItem.addSelectionListener(dropListener);
+ for(DefinedTermBase term:newTerms){
+ int count = viewer.getTable().getColumnCount();
+ addTableViewerColumn(term.getTitleCache(), 200, count);
+ acitivateNewColumnInDropDownMenu(term);
+ }
+ viewer.setLabelProvider(labelProvider);
+// getService().schedule(new ChecklistJob(LOADING_TAXA, selectedTaxonNodes), Job.LONG);
+ table.setRedraw(true);
+ viewer.refresh();
+ }
+
+ private void acitivateNewColumnInDropDownMenu(DefinedTermBase term) {
+ Menu menu = dropListener.getMenu();
+ MenuItem[] items = menu.getItems();
+ for(MenuItem item: items){
+ if(item.getText().equalsIgnoreCase(term.getTitleCache())){
+ item.setSelection(true);
+ PreferencesUtil.getPreferenceStore().setValue(term.getUuid().toString(), true);
+ }
+ }
+ }
+
+ private void hideDistributionColumns(SortedSet<DefinedTermBase> oldTerms) {
+ TableColumn[] columns = viewer.getTable().getColumns();
+ for(int i=4; i<columns.length; i++){
+ //remove all columns
+ columns[i].dispose();
+ Menu menu = dropListener.getMenu();
+ int itemCount = menu.getItemCount();
+ MenuItem item = menu.getItem(i-3);
+ item.setSelection(false);
+ }
+ if(oldTerms != null){
+ for(DefinedTermBase term : oldTerms){
+ PreferencesUtil.getPreferenceStore().setValue(term.getUuid().toString(), false);
+ }
+ }
+ }
+
+ /**
+ * <p>
+ * Getter for the field <code>service</code>.
+ * </p>
+ *
+ * @return the service
+ */
+ public IWorkbenchSiteProgressService getService() {
+ return TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IWorkbenchSiteProgressService.class);
+ }
+
+ private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
+ SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ comparator.setColumn(index);
+ int dir = viewer.getTable().getSortDirection();
+ if (viewer.getTable().getSortColumn() == column) {
+ dir = dir == SWT.UP ? SWT.DOWN : SWT.UP;
+ } else {
+ dir = SWT.DOWN;
+ }
+ viewer.getTable().setSortDirection(dir);
+ viewer.getTable().setSortColumn(column);
+ viewer.refresh();
+ }
+ };
+ return selectionAdapter;
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ monitor.beginTask(Messages.ChecklistEditor_SAVE_EDITOR, 1);
+ if (!conversation.isBound()) {
+ conversation.bind();
+ }
+ this.checklistEditorInput.merge();
+ //this.checklistEditorInput.merge();
+ conversation.commit(true);
+ setDirty(false);
+ monitor.worked(1);
+ } finally {
+ monitor.done();
+ }
+
+ }
+
+ public void init(ChecklistEditorInput input) {
+ checklistEditorInput = input;
+ thisPart.setLabel(DISTRIBUTION_EDITOR+": " + checklistEditorInput.getName());
+ conversation = checklistEditorInput.getConversation();
+ conversation.registerForDataStoreChanges(this);
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(
+ DistributionEditorHelper.getDistributionForColumn(event)));
+
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+
+ loadDataInput();
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IContextListener#contextAboutToStop(org.
+ * eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
+ */
+
+ @Override
+ public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse
+ * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+// IStructuredSelection sel = (IStructuredSelection) this.viewer.getSelection();
+// if (sel.isEmpty()) {
+// return;
+// }
+// memento = memento.createChild("tree-selections");
+// Iterator iter = sel.iterator();
+// while (iter.hasNext()) {
+// String nodeName = (String) iter.next();
+// memento.createChild("selected-nodes", nodeName);
+// }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IContextListener#contextStart(org.eclipse
+ * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IContextListener#contextRefresh(org.eclipse
+ * .core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void contextRefresh(IProgressMonitor monitor) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IContextListener#workbenchShutdown(org.eclipse
+ * .ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ conversation.clear();
+ conversation.close();
+ conversation = null;
+ }
+
+ private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$
+ "descriptions.*", "description.state", "feature", "feature.*", "childNodes", "childNodes.taxon", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "childNodes.taxon.name", "taxonNodes", "taxonNodes.*", "taxonNodes.taxon.*", "taxon.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "taxon.descriptions", "taxon.sec", "taxon.name.*", "terms", "name.*", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ "name.rank.representations", "name.status.type.representations", "stateData.$" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#changed(
+ * java.lang.Object)
+ */
+ @Override
+ public void changed(Object element) {
+ if (element != null) {
+ viewer.update(element, null);
+ setDirty(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#forceDirty()
+ */
+ @Override
+ public void forceDirty() {
+ changed(null);
+ }
+
+ public void setDirty(boolean dirty) {
+ this.dirty.setDirty(dirty);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#isDirty()
+ */
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
+ */
+
+
+// /* (non-Javadoc)
+// * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
+// */
+// @Override
+// public <T extends CdmBase> Collection<T> getRootEntities() {
+// // TODO Auto-generated method stub
+// return null;
+// }
+//
+// /* (non-Javadoc)
+// * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
+// */
+// @Override
+// public Map<Object, List<String>> getPropertyPathsMap() {
+// // TODO Auto-generated method stub
+// return null;
+// }
+
+ /**
+ * @return the labelProvider
+ */
+ public ChecklistLabelProvider getLabelProvider() {
+ return labelProvider;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+
+ return conversation;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart#save(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor) {
+ doSave(monitor);
+
+ }
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import javax.inject.Inject;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ComboBoxViewerCellEditor;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableColumn;
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Distribution;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.location.NamedArea;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public final class DistributionEditingSupportE4 extends EditingSupport {
+
+ private ComboBoxViewerCellEditor cellEditor = null;
+ private final TableViewer viewer;
+ private final ChecklistEditorE4 editor;
+// private final IDescriptionService descriptionService;
+ private final int columnIndex;
+
+ @Inject
+ private ESelectionService selService;
+ private ISelectionChangedListener selectionChangedListener;
+
+ private static final Logger logger = Logger.getLogger(DistributionEditingSupportE4.class);
+
+ public DistributionEditingSupportE4(TableViewer viewer, ChecklistEditorE4 checklistEditor, int columnIndex) {
+ super(viewer);
+ this.viewer = viewer;
+ this.columnIndex = columnIndex;
+
+// descriptionService = CdmStore.getService(IDescriptionService.class);
+ editor = checklistEditor;
+ cellEditor = new ComboBoxViewerCellEditor((Composite) viewer.getControl(), SWT.READ_ONLY);
+ cellEditor.setLabelProvider(new LabelProvider(){
+ @Override
+ public String getText(Object element) {
+ if (element instanceof PresenceAbsenceTerm) {
+ PresenceAbsenceTerm status = (PresenceAbsenceTerm)element;
+ String result = null;
+ if (PreferencesUtil.isShowSymbolInChecklistEditor() && !StringUtils.isBlank(status.getSymbol())){
+ result = status.getTitleCache() + "("+ status.getSymbol()+")";
+ }else{
+ result = status.getTitleCache();
+ }
+ return result;
+ }
+ return null;
+ }
+ });
+// selectionChangedListener = (event -> selService.setSelection(event));
+// cellEditor.addListener(selectionChangedListener);
+ cellEditor.setContentProvider(new ArrayContentProvider());
+ // TODO set input
+// List<PresenceAbsenceTermBase> input = CdmStore.getTermManager()
+// .getPreferredTerms(PresenceAbsenceTermBase.class);
+// selectionChangedListener = (event -> selService.setSelection(event));
+// viewer.addSelectionChangedListener(selectionChangedListener);
+ List<DefinedTermBase<?>> input = CdmStore.getTermManager().getPreferredTerms(TermType.PresenceAbsenceTerm);
+ cellEditor.setInput(input);
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return cellEditor;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ if (element instanceof Taxon) {
+ Taxon taxon = (Taxon) element;
+ String result = null;
+ Distribution distributionForColumn = getDistributionForColumn(taxon);
+
+ if (distributionForColumn != null) {
+ PresenceAbsenceTerm status = distributionForColumn.getStatus();
+ if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+ if (status.getIdInVocabulary() != null){
+ result = status.getIdInVocabulary();
+ } else{
+ result = status.getTitleCache();
+ }
+ } else{
+ result = status.getTitleCache();
+ }
+ if (PreferencesUtil.isShowSymbolInChecklistEditor() && status.getSymbol() != null){
+ result.concat(" ("+ status.getSymbol() + ")");
+ }
+ }
+
+ fireStateChanged(distributionForColumn);
+ return result;
+ }
+ return null;
+ }
+
+ protected void fireStateChanged(Distribution dist) {
+ if (dist!= null){
+ ISelection selection = new StructuredSelection(dist);
+// selService.setSelection(selection);
+ }
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if (element instanceof Taxon && value instanceof PresenceAbsenceTerm) {
+ Taxon taxon = (Taxon) element;
+ PresenceAbsenceTerm occurenceStatus = (PresenceAbsenceTerm) value;
+ Distribution distribution = getDistributionForColumn(taxon);
+ if (distribution != null) {
+ // change status for already exsiting distribution
+ distribution.setStatus(occurenceStatus);
+ } else {
+ createDistributionForColumn(taxon, occurenceStatus);
+ }
+ // viewer.update(distribution, null);
+// viewer.update(element, null);
+// viewer.refresh();
+// editor.setDirty(true);
+ editor.changed(element);
+ viewer.refresh();
+ }
+ }
+
+ private static final List<String> DESC_INIT_STRATEGY = Arrays.asList(new String[] { "descriptions", //$NON-NLS-1$
+ "descriptions.*", "description.state" }); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ *
+ * @param taxon
+ * @return
+ */
+ private Distribution getDistributionForColumn(Taxon taxon) {
+// List<TaxonDescription> listTaxonDescriptions = descriptionService.listTaxonDescriptions(taxon, null, null,
+// null, null, null, DESC_INIT_STRATEGY);
+ Set<TaxonDescription> listTaxonDescriptions = taxon.getDescriptions();
+ TableColumn column = viewer.getTable().getColumn(columnIndex);
+ for (TaxonDescription td : listTaxonDescriptions) {
+ for (DescriptionElementBase deb : td.getElements()) {
+ if (deb instanceof Distribution) {
+ Distribution distribution = (Distribution) deb;
+ if (distribution.getArea() != null){
+ if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+ if (column.getText().equalsIgnoreCase(distribution.getArea().getIdInVocabulary())) {
+ return distribution;
+ }
+ }else{
+ if (column.getText().equalsIgnoreCase(distribution.getArea().getTitleCache())) {
+ return distribution;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private void createDistributionForColumn(Taxon taxon, PresenceAbsenceTerm occurenceStatus) {
+ TableColumn column = viewer.getTable().getColumn(columnIndex);
+
+ SortedSet<DefinedTermBase> namedAreas = this.editor.getLabelProvider().getNamedAreas();
+
+
+ if (namedAreas != null) {
+ for (DefinedTermBase term : namedAreas) {
+ boolean sameArea = true;
+ if (!PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+ sameArea = column.getText().equalsIgnoreCase(term.getTitleCache());
+ } else{
+ if (term.getIdInVocabulary() != null){
+ sameArea = column.getText().equalsIgnoreCase(term.getIdInVocabulary());
+ } else{
+ sameArea = column.getText().equalsIgnoreCase(term.getTitleCache());
+ }
+ }
+ if (sameArea) {
+ NamedArea area = (NamedArea) term;
+ Distribution distribution = Distribution.NewInstance(area, occurenceStatus);
+ Set<TaxonDescription> descriptions = taxon.getDescriptions();
+ if (!descriptions.isEmpty()) {
+ for (TaxonDescription desc : descriptions) {
+ // add to first taxon description
+ desc.addElement(distribution);
+ break;
+ }
+ } else {// there are no TaxonDescription yet.
+ TaxonDescription td = TaxonDescription.NewInstance(taxon);
+ td.addElement(distribution);
+ break;
+ }
+ }
+ }
+ }
+
+ return;
+ }
+
+
+}
--- /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.editor.view.checklist.e4;
+
+import java.util.Set;
+
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerEditor;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.widgets.TableColumn;
+
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Distribution;
+import eu.etaxonomy.cdm.model.description.TaxonDescription;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author k.luther
+ * @date 28.09.2017
+ *
+ */
+public class DistributionEditorHelper {
+
+ public static Distribution getDistributionForColumn(SelectionChangedEvent event) {
+ // List<TaxonDescription> listTaxonDescriptions = descriptionService.listTaxonDescriptions(taxon, null, null,
+ // null, null, null, DESC_INIT_STRATEGY);
+ TableViewer viewer = null;
+ TableViewerEditor editor = null;
+ Taxon taxon = null;
+ int columnIndex;
+ if (event.getSource() instanceof TableViewer){
+ viewer = (TableViewer)event.getSource();
+ } else {
+ return null;
+ }
+ if (viewer.getColumnViewerEditor() instanceof TableViewerEditor){
+ editor = (TableViewerEditor) viewer.getColumnViewerEditor();
+ } else {
+ return null;
+ }
+ ViewerCell cell = editor.getFocusCell();
+ if (cell.getElement() instanceof Taxon){
+ taxon =(Taxon)cell.getElement();
+ } else {
+ return null;
+ }
+ columnIndex = cell.getColumnIndex();
+ Set<TaxonDescription> listTaxonDescriptions = taxon.getDescriptions();
+ TableColumn column = viewer.getTable().getColumn(columnIndex);
+ for (TaxonDescription td : listTaxonDescriptions) {
+ for (DescriptionElementBase deb : td.getElements()) {
+ if (deb instanceof Distribution) {
+ Distribution distribution = (Distribution) deb;
+ if (distribution.getArea() != null){
+ if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
+ if (column.getText().equalsIgnoreCase(distribution.getArea().getIdInVocabulary())) {
+ return distribution;
+ }
+ }else{
+ if (column.getText().equalsIgnoreCase(distribution.getArea().getTitleCache())) {
+ return distribution;
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
-package eu.etaxonomy.taxeditor.editor.handler;
+package eu.etaxonomy.taxeditor.editor.view.checklist.e4.handler;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.AppModelId;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
-public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase<ITaxonTreeNode> {
+public class OpenChecklistEditorHandlerE4 extends DefaultOpenHandlerBaseE4<ITaxonTreeNode> {
- private static final String FAILED_TO_OPEN_EDITOR = Messages.OpenChecklistEditorHandler_FAILED_TO_OPEN;
private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_MESSAGE;
private static final String COULD_NOT_OPEN_DISTRIBUTION_EDITOR = Messages.OpenChecklistEditorHandler_COULD_NOT_OPEN_TITLE;
}
@Override
- protected void open(ExecutionEvent event, ITaxonTreeNode entity) {
+ protected void open(ITaxonTreeNode entity, Shell shell, EPartService partService) {
if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) {
if (StringUtils.isBlank(PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DISTRIBUTION_AREA_OCCURENCE_STATUS) )){
MessagingUtils.informationDialog(Messages.OpenChecklistEditorHandler_NO_AREAS, Messages.OpenChecklistEditorHandler_CHOOSE_AREA
+ Messages.OpenChecklistEditorHandler_GOTO_PREFERENCES);
- this.dispose();
return;
}
if (entity instanceof Classification) {
ChecklistEditorInput input = new ChecklistEditorInput(((Classification) entity));
try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenChecklistEditorHandler.class, COULD_NOT_OPEN_DISTRIBUTION_EDITOR, e);
+ openChecklistEditor(input, partService);
} catch (NullPointerException npe) {
- MessagingUtils.messageDialog(FAILED_TO_OPEN_EDITOR, OpenChecklistEditorHandler.class,
+ MessagingUtils.messageDialog(COULD_NOT_OPEN_DISTRIBUTION_EDITOR, OpenChecklistEditorHandlerE4.class,
COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED, npe);
}
} else if (entity instanceof TaxonNode) {
ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity);
try {
- EditorUtil.open(input);
- } catch (PartInitException e) {
- MessagingUtils.error(OpenChecklistEditorHandler.class, COULD_NOT_OPEN_DISTRIBUTION_EDITOR, e);
+ openChecklistEditor(input, partService);
} catch (NullPointerException npe) {
- MessagingUtils.messageDialog(FAILED_TO_OPEN_EDITOR, OpenChecklistEditorHandler.class,
+ MessagingUtils.messageDialog(COULD_NOT_OPEN_DISTRIBUTION_EDITOR, OpenChecklistEditorHandlerE4.class,
COULD_NOT_OPEN_DISTRIBUTION_EDITOR_THE_HIERARCHY_IS_CORRUPTED, npe);
}
}
}
}
+
+ private void openChecklistEditor(ChecklistEditorInput input, EPartService partService) {
+ MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_CHECKLIST_E4_CHECKLISTEDITORE4);
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ ChecklistEditorE4 checklistEditor = (ChecklistEditorE4) part.getObject();
+ if (checklistEditor != null){
+ checklistEditor.init(input);
+ }else{
+ System.err.println("Editor is null");
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(ITaxonTreeNode entity) {
+ return entity!=null && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
+ }
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.checklist.edit;
+
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.ISelectionListener;
+import org.eclipse.jface.viewers.ComboBoxViewerCellEditor;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+/**
+ * <p>
+ * CdmComboBoxViewerCellEditor class.
+ * </p>
+ *
+ * @author k.luther
+ * @created 26.09.2017
+ * @version 1.0
+ */
+public class CdmComboBoxViewerCellEditor extends ComboBoxViewerCellEditor implements ISelectionListener, IPartContentHasDetails{
+
+
+ public CdmComboBoxViewerCellEditor(Composite parent, int style) {
+ super(parent, style);
+
+ }
+
+ @Override
+ public void selectionChanged(MPart part, Object selection) {
+ System.out.println(selection.toString());
+
+ }
+
+}
private ComboBoxViewerCellEditor cellEditor = null;
private final TableViewer viewer;
private final ChecklistEditor editor;
- private final IDescriptionService descriptionService;
private final int columnIndex;
private static final Logger logger = Logger.getLogger(DistributionEditingSupport.class);
super(viewer);
this.viewer = viewer;
this.columnIndex = columnIndex;
- descriptionService = CdmStore.getService(IDescriptionService.class);
+
editor = checklistEditor;
cellEditor = new ComboBoxViewerCellEditor((Composite) viewer.getControl(), SWT.READ_ONLY);
cellEditor.setLabelProvider(new LabelProvider(){
+++ /dev/null
-/**
- * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.editor.view.checklist.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * <p>CreateDescriptionElementHandler class.</p>
- *
- * @author n.hoffmann
- * @created 16.04.2009
- * @version 1.0
- */
-public class CreateDescriptionElementHandler extends AbstractHandler {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part
- : null;
-
-
- DescriptionBase<?> description = null;
-
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- Object selectedElement = null;
- if (selection instanceof ITreeSelection) {
- TreePath[] paths = ((ITreeSelection) selection).getPaths();
- selectedElement = paths[0].getFirstSegment();
- }
- else if (selection instanceof IStructuredSelection) {
- selectedElement = ((IStructuredSelection) selection).getFirstElement();
- }
- if (selectedElement instanceof DescriptionBase<?>) {
- description = (DescriptionBase<?>) selectedElement;
- }
-
- if (description != null) {
- AbstractPostOperation operation = null;
- try {
- // TODO use undo context specific to editor
- operation = operationCreationInstance(event.getCommand().getName(), event, description, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
- }
- } else {
- MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$
- return null;
- }
- return null;
-
- }
-
- /**
- * Added to make the Class more generic and limit the amount of code changes required
- * @param label
- * @param event
- * @param taxon
- * @param description
- * @param postOperationEnabled
- * @return
- */
- protected AbstractPostOperation operationCreationInstance(String label, ExecutionEvent event, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
- Feature feature = (Feature) ((Event) event.getTrigger()).data;
- return new CreateDescriptionElementOperation(label, EditorUtil.getUndoContext(), description, feature, postOperationEnabled);
- }
-
-}
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateSpecimenDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
Taxon taxon = ((TaxonEditorInput) input).getTaxon();
try {
operation = createTaxonOperation(event.getCommand().getName(), taxon, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
}
// specimen description
- else if(part instanceof DescriptiveViewPart){
- Object viewerInput = ((DescriptiveViewPart)part).getViewer().getInput();
+ else if(part instanceof FactualDataPartE4){
+ Object viewerInput = ((FactualDataPartE4)part).getViewer().getInput();
if(viewerInput instanceof SpecimenOrObservationBase<?>){
try {
operation = new CreateSpecimenDescriptionOperation(event.getCommand().getName(), EditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>) viewerInput, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
/**
* @author a.oppermann
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- ChecklistEditor editor = (ChecklistEditor) EditorUtil.getActiveE4Editor();
+ ChecklistEditor editor = (ChecklistEditor) AbstractUtility.getActiveEditor();
if (currentSelection instanceof IStructuredSelection) {
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
/**
* @author n.hoffmann
@Override
public void dispose() {
-
+
}
@Override
@Override
public Object[] getElements(Object inputElement) {
Taxon taxon = null;
- if(inputElement instanceof TaxonEditorInput){
- taxon = ((TaxonEditorInput) inputElement).getTaxon();
- }
- else if(inputElement instanceof Taxon){
+ if(inputElement instanceof Taxon){
taxon = (Taxon) inputElement;
}
if(taxon!=null){
Map<TaxonRelationship, Taxon> taxonToTaxonRelationsMap = new HashMap<>();
-
+
for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
if (! relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) ||
relationship.getType().equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) {
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept;
-
-import java.util.Map.Entry;
-
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.model.LineSelection;
-import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
-
-/**
- * @author n.hoffmann
- * @created Jan 24, 2011
- * @version 1.0
- */
-public class ConceptViewPart extends AbstractCdmEditorViewPart
-implements IPartContentHasDetails, IPartContentHasSupplementalData{
-
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.concept"; //$NON-NLS-1$
-
- private ConceptRelationViewer viewer;
-
- @Override
- protected void selectionChanged_internal(IWorkbenchPart workbenchPart, ISelection selection) {
- if(workbenchPart == this){
- return;
- }
- Object partObject = workbenchPart;
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
- if(wrappedPart!=null){
- partObject = wrappedPart;
- }
- if(AbstractUtility.getActiveE4Editor() == null){
- showEmptyPage();
- return;
- }
-
- if (partObject instanceof DetailsViewPart || partObject instanceof SupplementalDataViewPart) {
- // do not show empty page as these views are also used to edit the
- // description selected in this view
- return;
- }
- else if(partObject instanceof BulkEditor && selection instanceof LineSelection){
- if(((LineSelection) selection).getFirstElement() instanceof Taxon){
- showViewer(partObject, (LineSelection) selection);
- }
- else{
- showEmptyPage();
- }
- return;
- }
- else if(partObject instanceof AbstractGraphKeyEditor){
- showEmptyPage();
- return;
- }
- else if(partObject instanceof MultiPageTaxonEditor){
- if(! partObject.equals(this.part)){
- IEditorInput input = ((IEditorPart) partObject).getEditorInput();
- showViewer(partObject, new StructuredSelection(input));
- }
- }
- else {
- showEmptyPage();
- }
-
- }
-
- @Override
- protected String createPartTitle(Object selectedObject) {
- if(selectedObject instanceof TaxonEditorInput){
- return super.createPartTitle(((TaxonEditorInput) selectedObject).getTaxon());
- }
- return super.createPartTitle(selectedObject);
- }
-
- @Override
- public boolean onComplete() {
- return true;
- }
-
- @Override
- public Viewer getViewer() {
- return viewer;
- }
-
- @Override
- public void createViewer(Composite parent) {
- viewer = new ConceptRelationViewer(parent);
-
- viewer.setContentProvider(new ConceptContentProvider());
- viewer.setLabelProvider(new ConceptLabelProvider());
-
-
- viewer.setSorter(new ViewerSorter());
-
- getSite().setSelectionProvider(viewer);
-
- createMenu();
- }
-
- private void createMenu(){
- MenuManager menuManager = new MenuManager();
- menuManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
-
- getSite().registerContextMenu(menuManager, viewer);
-
- Control control = viewer.getControl();
- Menu menu = menuManager.createContextMenu(control);
- menuManager.setRemoveAllWhenShown(true);
-
- control.setMenu(menu);
- }
-
- @Override
- public void changed(Object object) {
- getViewer().refresh();
- super.changed(object);
- }
-
- private class ConceptRelationViewer extends ListViewer {
-
- public ConceptRelationViewer(Composite parent) {
- super(parent);
- }
-
- @Override
- public ISelection getSelection() {
- ISelection selection = super.getSelection();
- if(selection instanceof IStructuredSelection && !selection.isEmpty()){
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- TaxonRelationship taxonRelationship = ((Entry<TaxonRelationship, Taxon>)firstElement).getKey();
- return new StructuredSelection(taxonRelationship);
-
- }
- return selection;
- }
-
- @Override
- public void setSelection(ISelection selection) {
- super.setSelection(selection);
- }
-
- }
-
- @Override
- protected String getViewName() {
- return Messages.ConceptViewPart_VIEWER_NAME;
- }
-
-}
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptContentProvider;
import eu.etaxonomy.taxeditor.editor.view.concept.ConceptLabelProvider;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
else if(partObject instanceof AbstractGraphKeyEditor){
showEmptyPage();
}
- else if(partObject instanceof MultiPageTaxonEditor){
- IEditorInput input = ((IEditorPart) partObject).getEditorInput();
- showViewer(new StructuredSelection(input), activePart, viewer);
+ else if(partObject instanceof TaxonNameEditorE4){
+ Taxon taxon = ((TaxonNameEditorE4) partObject).getTaxon();
+ if(taxon!=null){
+ showViewer(new StructuredSelection(taxon), activePart, viewer);
+ }
}
else {
showEmptyPage();
}
- //FIXME E4 implement
-// @Override
-// protected String createPartTitle(Object selectedObject) {
-// if(selectedObject instanceof TaxonEditorInput){
-// return super.createPartTitle(((TaxonEditorInput) selectedObject).getTaxon());
-// }
-// return super.createPartTitle(selectedObject);
-// }
-
@PostConstruct
- public void create(Composite parent, EMenuService menuService) {
+ public void create(Composite parent, EMenuService menuService, MPart thisPart) {
+
+ this.thisPart = thisPart;
ConceptRelationViewer conceptViewer = new ConceptRelationViewer(parent);
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@Optional@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
- MHandledMenuItem menuItem) {
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
String commandId = menuItem.getCommand().getElementId();
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".taxonRelationshipType.uuid");
TaxonRelationshipType taxonRelationshipType = HibernateProxyHelper.deproxy(CdmStore.getService(ITermService.class).load(uuid), TaxonRelationshipType.class);
- TaxonNameEditor editor = null;
+ TaxonNameEditorE4 editor = null;
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
- editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME);
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
+ editor = (TaxonNameEditorE4) e4WrappedPart;
+
+ IUndoContext undoContext = null;
+ ConversationHolder conversationHolder = null;
+ Taxon taxon = null;
+ taxon = editor.getTaxon();
+ conversationHolder = editor.getConversationHolder();
+ undoContext = editor.getUndoContext();
+
+ //FIXME should this also be enabled for bulk editor
+ // else if(activeEditor instanceof BulkEditor){
+ // BulkEditor bulkEditor = (BulkEditor)activeEditor;
+ // ISelection selection = bulkEditor.getSelectionProvider().getSelection();
+ // taxon = (Taxon) ((IStructuredSelection)selection).getFirstElement();
+ // conversationHolder = bulkEditor.getConversationHolder();
+ // undoContext = bulkEditor.getUndoContext();
+ // }
+
+ Taxon relatedConcept = TaxonBaseSelectionDialog.selectTaxon(shell, conversationHolder, taxon);
+
+
+ if(relatedConcept == null){
+ return;
+ }
+ boolean isInverse = taxonRelationshipType.getInverseLabel().isEmpty()?false:true;
+ TaxonRelationshipTypeInverseContainer typeInverseContainer =new TaxonRelationshipTypeInverseContainer(taxonRelationshipType, isInverse) ;
+
+
+ AbstractPostOperation operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
+ undoContext, taxon, relatedConcept, typeInverseContainer, conceptView);
+ AbstractUtility.executeOperation(operation, sync);
}
-
- IUndoContext undoContext = null;
- ConversationHolder conversationHolder = null;
- Taxon taxon = null;
- taxon = editor.getTaxon();
- conversationHolder = editor.getConversationHolder();
- undoContext = editor.getUndoContext();
-
- //FIXME should this also be enabled for bulk editor
- // else if(activeEditor instanceof BulkEditor){
- // BulkEditor bulkEditor = (BulkEditor)activeEditor;
- // ISelection selection = bulkEditor.getSelectionProvider().getSelection();
- // taxon = (Taxon) ((IStructuredSelection)selection).getFirstElement();
- // conversationHolder = bulkEditor.getConversationHolder();
- // undoContext = bulkEditor.getUndoContext();
- // }
-
- Taxon relatedConcept = TaxonBaseSelectionDialog.selectTaxon(shell, conversationHolder, taxon);
-
-
- if(relatedConcept == null){
- return;
- }
- boolean isInverse = taxonRelationshipType.getInverseLabel().isEmpty()?false:true;
- TaxonRelationshipTypeInverseContainer typeInverseContainer =new TaxonRelationshipTypeInverseContainer(taxonRelationshipType, isInverse) ;
-
-
- AbstractPostOperation operation = new CreateConceptRelationOperation(menuItem.getLocalizedLabel(),
- undoContext, taxon, relatedConcept, typeInverseContainer, conceptView);
- AbstractUtility.executeOperation(operation);
}
@CanExecute
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- canExecute = e4WrappedPart instanceof MultiPageTaxonEditor;
+ canExecute = e4WrappedPart instanceof TaxonNameEditorE4;
menuItem.setVisible(canExecute);
return canExecute;
}
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.jface.viewers.ISelection;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, MMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, MMenuItem menuItem,
+ UISynchronize sync) {
- TaxonNameEditor editor = null;
+ TaxonNameEditorE4 editor = null;
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
- editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME);
- }
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
+ editor = (TaxonNameEditorE4) e4WrappedPart;
- Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>();
+ Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>();
- // FIXME E4 multiple selection
- // while (iterator.hasNext()){
- if(selection instanceof TaxonRelationship){
- relations.add((TaxonRelationship) selection);
- }
- // }
+ // FIXME E4 multiple selection
+ // while (iterator.hasNext()){
+ if(selection instanceof TaxonRelationship){
+ relations.add((TaxonRelationship) selection);
+ }
+ // }
- //editor should not be null because this is already checked in canExecute
- AbstractPostOperation operation = new DeleteConceptRelationOperation(menuItem.getLocalizedLabel(),
- editor.getUndoContext(), editor.getTaxon(), relations, conceptView);
- AbstractUtility.executeOperation(operation);
+ //editor should not be null because this is already checked in canExecute
+ AbstractPostOperation operation = new DeleteConceptRelationOperation(menuItem.getLocalizedLabel(),
+ editor.getUndoContext(), editor.getTaxon(), relations, conceptView);
+ AbstractUtility.executeOperation(operation, sync);
+ }
}
@CanExecute
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
ISelection selection = conceptView.getViewer().getSelection();
canExecute = selection!=null && !selection.isEmpty();
menuItem.setVisible(canExecute);
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.model.LineSelection;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship, EModelService modelService, EPartService partService, MApplication application) {
- MultiPageTaxonEditor editor = null;
+ TaxonNameEditorE4 editor = null;
BulkEditor bulkEditor = null;
ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
- editor = (MultiPageTaxonEditor) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
+ editor = (TaxonNameEditorE4) e4WrappedPart;
}
else if(e4WrappedPart instanceof BulkEditor){
bulkEditor = (BulkEditor) e4WrappedPart;
String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), null);
}
else{
- openConcept(relatedTaxon);
+ openConcept(relatedTaxon, modelService, partService, application);
}
}
- /**
- * @param relatedTaxon
- */
- protected void openConcept(TaxonBase<?> relatedTaxon) {
- try {
- EditorUtil.openTaxonBase(relatedTaxon.getUuid());
- } catch (PartInitException e) {
- MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
- String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e);
- }
+ protected void openConcept(TaxonBase<?> relatedTaxon, EModelService modelService, EPartService partService, MApplication application) {
+ EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid(), modelService, partService, application);
}
private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){
package eu.etaxonomy.taxeditor.editor.view.concept.e4.handler;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
public class OpenRelatedConceptInBulkEditorHandlerE4 extends OpenRelatedConceptHandlerE4{
/**
* {@inheritDoc}
*/
@Override
- protected void openConcept(TaxonBase<?> relatedTaxon) {
- try {
- BulkEditorUtil.openEditor(relatedTaxon);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+relatedTaxon, e);
- }
+ protected void openConcept(TaxonBase<?> relatedTaxon, EModelService modelService, EPartService partService, MApplication application) {
+ AbstractBulkEditorInput<?> input = AbstractBulkEditorInput.NewInstance(relatedTaxon);
+ BulkEditorUtil.openBulkEditor(input, modelService, partService, application);
}
}
/**
- *
+ *
*/
package eu.etaxonomy.taxeditor.editor.view.concept.graph;
-import java.util.Set;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.zest.core.viewers.IGraphContentProvider;
-
-
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.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
/**
- * @author andreas
+ * @author andreas
*
*/
public class ConceptGraphContentProvider implements IGraphContentProvider {
*/
@Override
public Object[] getElements(Object inputElement) {
- if(inputElement instanceof TaxonEditorInput){
- Taxon taxon = ((TaxonEditorInput) inputElement).getTaxon();
+ if(inputElement instanceof TaxonEditorInputE4){
+ Taxon taxon = ((TaxonEditorInputE4) inputElement).getTaxon();
Map<String, TaxonRelationship> filteredTaxonRelations = new HashMap<String, TaxonRelationship>();
getTaxonRelationshipsRecursive(filteredTaxonRelations, taxon);
-
+
return filteredTaxonRelations.values().toArray();
}
return new Object[0];
// eu.etaxonomy.taxeditor.model;
// see also ConceptContentProvider
for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
-
+
if (!relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
&& !relationship.getType().equals(TaxonRelationshipType.INVALID_DESIGNATION_FOR())
&& !relationship.getType().equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) {
-
+
if(!relationship.getToTaxon().equals(taxon)){
continue;
}
-
+
String key = relationship.getFromTaxon().getUuid().toString() + relationship.getType().getUuid();
if(!filteredTaxonRelations.containsKey(key)) {
- filteredTaxonRelations.put(key, relationship);
+ filteredTaxonRelations.put(key, relationship);
Taxon toTaxon = relationship.getToTaxon();
if(toTaxon != null){
getTaxonRelationshipsRecursive(filteredTaxonRelations, toTaxon);
-
+
}
}
}
-
-
+
+
}
-
-
+
+
}
}
package eu.etaxonomy.taxeditor.editor.view.concept.graph;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.zest.core.viewers.GraphViewer;
import org.eclipse.zest.core.widgets.ZestStyles;
import org.eclipse.zest.layouts.LayoutStyles;
import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* @author andreas
*/
@Override
protected void selectionChanged_internal(IWorkbenchPart workbenchPart, ISelection selection) {
-
- Object partObject = workbenchPart;
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
- if(wrappedPart!=null){
- partObject = wrappedPart;
- }
-// if(part instanceof ConceptGraphView){
-// // ConceptGraphView is maximized
+ //FIXME E4 migrate or delete
+// Object partObject = workbenchPart;
+// Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
+// if(wrappedPart!=null){
+// partObject = wrappedPart;
+// }
+//// if(part instanceof ConceptGraphView){
+//// // ConceptGraphView is maximized
+//// return;
+//// }
+//
+// if(EditorUtil.getActiveE4Editor() == null){
+// showEmptyPage();
// return;
// }
-
- if(EditorUtil.getActiveE4Editor() == null){
- showEmptyPage();
- return;
- }
-
- if(partObject instanceof BulkEditor){
- showEmptyPage();
- return;
- }
-
-
- if(partObject instanceof MultiPageTaxonEditor){
- if(! partObject.equals(this.part)){
- IEditorInput input = ((IEditorPart) partObject).getEditorInput();
- showViewer(partObject, new StructuredSelection(input));
- }
- }
+//
+// if(partObject instanceof BulkEditor){
+// showEmptyPage();
+// return;
+// }
+//
+//
+// if(partObject instanceof MultiPageTaxonEditor){
+// if(! partObject.equals(this.part)){
+// IEditorInput input = ((IEditorPart) partObject).getEditorInput();
+// showViewer(partObject, new StructuredSelection(input));
+// }
+// }
}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.view.concept.graph.e4;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
+
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+import eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphContentProvider;
+import eu.etaxonomy.taxeditor.editor.view.concept.graph.ConceptGraphLabelProvider;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
+import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
+import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 27, 2017
+ *
+ */
+public class ConceptGraphViewE4 extends AbstractCdmEditorPartE4 {
+
+ public static final String ID = "eu.etaxonomy.taxeditor.editor.view.concept.graph"; //$NON-NLS-1$
+
+ private LayoutAlgorithm layoutAlgoritm;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
+ if(activePart==thisPart){
+ return;
+ }
+
+ Object partObject = createPartObject(activePart);
+
+ if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
+ || partObject instanceof FactualDataPartE4|| partObject instanceof MediaViewPartE4) {
+ // do not show empty page as these views are also used to edit the
+ // description selected in this view
+ return;
+ }
+ if(AbstractUtility.getActiveEditor() == null){
+ showEmptyPage();
+ return;
+ }
+
+ if(partObject instanceof BulkEditor){
+ showEmptyPage();
+ return;
+ }
+
+
+ if(partObject instanceof TaxonNameEditorE4){
+ TaxonEditorInputE4 input = ((TaxonNameEditorE4) partObject).getEditorInput();
+ showViewer(new StructuredSelection(input), activePart, viewer);
+ }
+
+ }
+
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+
+ @Override
+ public Viewer getViewer() {
+ return viewer;
+ }
+
+ @PostConstruct
+ public void create(Composite parent, EMenuService menuService, MPart thisPart) {
+
+ this.thisPart = thisPart;
+
+ GraphViewer viewer = new GraphViewer(parent, SWT.NONE);
+
+ viewer.setContentProvider(new ConceptGraphContentProvider());
+ viewer.setLabelProvider(new ConceptGraphLabelProvider());
+
+ viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
+
+ viewer.setLayoutAlgorithm(getLayoutAlgoritm(), false);
+
+ this.viewer = viewer;
+
+ // Propagate selection from viewer
+ selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+// createMenu();
+//
+// createToolbar();
+
+
+ }
+
+ private LayoutAlgorithm getLayoutAlgoritm() {
+
+ if (layoutAlgoritm == null) {
+ // layoutAlgoritm = new CompositeLayoutAlgorithm(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING,
+ // new LayoutAlgorithm[] {
+ // new TreeLayoutAlgorithm(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING),
+ // new HorizontalShift(
+ // LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
+
+ layoutAlgoritm = new TreeLayoutAlgorithm(
+ LayoutStyles.NO_LAYOUT_NODE_RESIZING);
+ layoutAlgoritm.setEntityAspectRatio(0.5);
+ }
+ return layoutAlgoritm;
+ }
+
+ @Override
+ protected String getViewName() {
+ return Messages.ConceptGraphView_VIEWER_NAME;
+ }
+
+}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.swt.widgets.Event;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>ChangeConceptRelationshipTypeHandler class.</p>
- *
- * @author n.hoffmann
- * @created 22.04.2009
- * @version 1.0
- */
-public class ChangeConceptRelationshipTypeHandler extends AbstractHandler
- implements IHandler {
- private static final Logger logger = Logger
- .getLogger(ChangeConceptRelationshipTypeHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- Taxon selectedElement = (Taxon) EditorUtil.getSelection(event).getFirstElement();
-
- TaxonRelationshipType type = (TaxonRelationshipType) ((Event)event.getTrigger()).data;
-
- AbstractPostOperation operation;
- try {
- operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), selectedElement, type, editor);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-
-
-/**
- * <p>ChangeConceptRelationshipTypeMenu class.</p>
- *
- * @author n.hoffmann
- * @created 22.04.2009
- * @version 1.0
- */
-public class ChangeConceptRelationshipTypeMenu extends
- AbstractDynamicConceptRelationMenu {
-
- public String commandName = "eu.etaxonomy.taxeditor.editor.name.changeConceptRelationshipType"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.editor.handler.AbstractDynamicConceptRelationMenu#getCommandName()
- */
- /** {@inheritDoc} */
- @Override
- public String getCommandName() {
- return commandName;
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
-
-/**
- * @author n.hoffmann
- * @created 16.04.2009
- * @version 1.0
- */
-public class CreateConceptRelationHandler extends AbstractHandler {
-
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IUndoContext undoContext = null;
- ConversationHolder conversationHolder = null;
- Taxon taxon = null;
- Object activeEditor = AbstractUtility.getActiveE4Editor();
- if(activeEditor instanceof MultiPageTaxonEditor){
- MultiPageTaxonEditor taxonEditor = (MultiPageTaxonEditor)activeEditor;
- taxon = taxonEditor.getTaxon();
- conversationHolder = taxonEditor.getConversationHolder();
- undoContext = taxonEditor.getUndoContext();
- }
- else if(activeEditor instanceof BulkEditor){
- BulkEditor bulkEditor = (BulkEditor)activeEditor;
- ISelection selection = bulkEditor.getSelectionProvider().getSelection();
- taxon = (Taxon) ((IStructuredSelection)selection).getFirstElement();
- conversationHolder = bulkEditor.getConversationHolder();
- undoContext = bulkEditor.getUndoContext();
- }
-
-
- /* we need to get the activePart before calling TaxonBaseSelectionDialog.selectTaxon(), otherwise the
- * the variable of the parent applicationContext in event are overwritten during this method call
- * this is Linux specific bugfix see: #2685 ([LINUX] Editing concept relationships does not work under linux)
- */
- IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
-
- Taxon relatedConcept = TaxonBaseSelectionDialog.selectTaxon(HandlerUtil.getActiveShell(event), conversationHolder, taxon);
-
-
- if(relatedConcept == null){
- return Status.CANCEL_STATUS;
- }
- TaxonRelationshipType type = (TaxonRelationshipType) ((Event)event.getTrigger()).data;
- boolean isInverse = type.getInverseLabel().isEmpty()?false:true;
- TaxonRelationshipTypeInverseContainer typeInverseContainer =new TaxonRelationshipTypeInverseContainer(type, isInverse) ;
-
-
- IPostOperationEnabled postOperationEnabled = (activePart instanceof IPostOperationEnabled) ? (IPostOperationEnabled) activePart : null;
-
- try {
- AbstractPostOperation operation = new CreateConceptRelationOperation(event.getCommand().getName(),
- undoContext, taxon, relatedConcept, typeInverseContainer, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.view.concept.operation.DeleteConceptRelationOperation;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-
-/**
- * @author n.hoffmann
- * @created Jan 25, 2011
- * @version 1.0
- */
-public class DeleteConceptRelationHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- ISelection selection = HandlerUtil.getActiveSite(event).getSelectionProvider().getSelection();
-
- Set<TaxonRelationship> relations = new HashSet<TaxonRelationship>();
-
- if(selection instanceof IStructuredSelection){
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Iterator iterator = structuredSelection.iterator();
-
- while (iterator.hasNext()){
- Object element = iterator.next();
- if(element instanceof TaxonRelationship){
- relations.add((TaxonRelationship) element);
- }
- }
- }
-
- IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
- IPostOperationEnabled postOperationEnabled = (activePart instanceof IPostOperationEnabled) ? (IPostOperationEnabled) activePart : null;
-
- try {
- AbstractPostOperation operation = new DeleteConceptRelationOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), relations, postOperationEnabled);
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
- }
-
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.LineSelection;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-/**
- * @author n.hoffmann
- * @created Jan 25, 2011
- * @version 1.0
- */
-public class OpenRelatedConceptHandler extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- TaxonBase<?> relatedTaxon = null;
-
- if(selection instanceof IStructuredSelection){
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object selectedElement = structuredSelection.getFirstElement();
-
- if(selectedElement instanceof TaxonRelationship){
- Object activeEditor = AbstractUtility.getActiveE4Editor();
- if(activeEditor instanceof MultiPageTaxonEditor){
- relatedTaxon = getRelatedTaxon((TaxonRelationship) selectedElement, ((MultiPageTaxonEditor) activeEditor).getTaxon());
- }
- else if(activeEditor instanceof BulkEditor){
- ISelection bulkSelection = ((BulkEditor)activeEditor).getSelectionProvider().getSelection();
- if(bulkSelection instanceof LineSelection){
- Object firstElement = ((LineSelection)bulkSelection).getFirstElement();
- if(firstElement instanceof Taxon){
- relatedTaxon = getRelatedTaxon((TaxonRelationship) selectedElement, (Taxon) firstElement);
- }
- }
- }
- }
- }
-
- if(relatedTaxon==null){
- MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
- String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), null);
- }
- else{
- openConcept(relatedTaxon);
- }
-
- return null;
- }
-
- /**
- * @param relatedTaxon
- */
- protected void openConcept(TaxonBase<?> relatedTaxon) {
- try {
- EditorUtil.openTaxonBase(relatedTaxon.getUuid());
- } catch (PartInitException e) {
- MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
- String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e);
- }
- }
-
- private Taxon getRelatedTaxon(TaxonRelationship relationship, Taxon taxon){
- if (relationship.getFromTaxon().equals(taxon)){
- return relationship.getToTaxon();
- }
- else if(relationship.getToTaxon().equals(taxon)){
- return relationship.getFromTaxon();
- }
- else{
- return null;
- }
- }
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor.view.concept.handler;
-
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-public class OpenRelatedConceptInBulkEditorHandler extends OpenRelatedConceptHandler{
- /**
- * {@inheritDoc}
- */
- @Override
- protected void openConcept(TaxonBase<?> relatedTaxon) {
- try {
- BulkEditorUtil.openEditor(relatedTaxon);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+relatedTaxon, e);
- }
- }
-}
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.ui.EditViewerDropAdapter;
/**
* @author pplitzner
* @date 18.03.2014
*
*/
-public class DerivateDropListener extends ViewerDropAdapter {
+public class DerivateDropListener extends EditViewerDropAdapter {
private final DerivateView derivateView;
TreeNode draggedNode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
if(draggedNode!=null){
MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation(String.format(Messages.DerivateDropListener_MOVE_TO, derivateView.getLabelProvider().getDerivateText(draggedNode), derivateView.getLabelProvider().getDerivateText(targetNode)), EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
- return AbstractUtility.executeOperation(moveDerivateOperation).equals(Status.OK_STATUS)?true:false;
+ return AbstractUtility.executeOperation(moveDerivateOperation, sync).equals(Status.OK_STATUS)?true:false;
}
}
return false;
import javax.inject.Named;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.derivate.searchFilter.DerivateSearchCompositeController;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IContextListener;
}
@PostConstruct
- public void createPartControl(Composite parent, EMenuService menuService) {
+ public void createPartControl(Composite parent, EMenuService menuService,
+ IEclipseContext context) {
if (CdmStore.isActive()){
if(conversation == null){
conversation = CdmStore.createConversation();
derivateSearchCompositeController.setEnabled(CdmStore.isActive());
//---tree viewer---
- viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
GridData gridDataTree = new GridData();
gridDataTree.horizontalAlignment = GridData.FILL;
gridDataTree.verticalAlignment = GridData.FILL;
//add drag'n'drop support
Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer(),};
viewer.addDragSupport(dndOperations, transfers, new DerivateDragListener(this));
- viewer.addDropSupport(dndOperations, transfers, new DerivateDropListener(this));
+ DerivateDropListener dropListener = new DerivateDropListener(this);
+ ContextInjectionFactory.inject(dropListener, context);
+ viewer.addDropSupport(dndOperations, transfers, dropListener);
}
public void updateRootEntities() {
}
if(listenToSelectionChange){
selectedTaxon = null;
- if(activePart instanceof MultiPageTaxonEditor){
- selectedTaxon = ((MultiPageTaxonEditor) activePart).getTaxon();
+ if(activePart instanceof TaxonNameEditorE4){
+ selectedTaxon = ((TaxonNameEditorE4) activePart).getTaxon();
}
else if(selection instanceof IStructuredSelection){
Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
import java.util.Collections;
import java.util.UUID;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
/**
* @date Nov 11, 2015
*
*/
-public class DerivateViewEditorInput implements IEditorInput {
+public class DerivateViewEditorInput {
private Collection<UUID> derivativeUuids;
private UUID taxonUuid;
public DerivateViewEditorInput(UUID derivativeUuid) {
this(derivativeUuid, null);
}
-
+
public DerivateViewEditorInput(Collection<UUID> derivativeUuids) {
this(derivativeUuids, null);
}
return taxonUuid;
}
- @Override
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- @Override
- public boolean exists() {
- return false;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- @Override
- public String getName() {
- return getEditorName();
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
- @Override
- public String getToolTipText() {
- return getEditorName();
- }
-
private String getEditorName() {
return Messages.DerivateViewEditorInput_SPECIMEN_EDITOR;
}
import java.util.Collections;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.AppModelId;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandlerBase<IndividualsAssociation> {
+public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandlerBaseE4<IndividualsAssociation> {
@Override
protected IndividualsAssociation getEntity(UUID uuid) {
}
@Override
- protected void open(ExecutionEvent event, IndividualsAssociation entity) {
+ protected void open(IndividualsAssociation entity, Shell shell, EPartService partService) {
if(entity==null || entity.getAssociatedSpecimenOrObservation()==null){
MessagingUtils.messageDialog(Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS, this, Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS_MESSAGE);
return;
SpecimenOrObservationBase associatedSpecimenOrObservation = entity.getAssociatedSpecimenOrObservation();
if(associatedSpecimenOrObservation!=null){
UUID specimenUuid = associatedSpecimenOrObservation.getUuid();
- DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singletonList(specimenUuid));
- MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
- AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
- DerivateView derivateView = (DerivateView) part.getObject();
- derivateView.init(input);
+ EditorUtil.openSpecimenEditor(new DerivateViewEditorInput(Collections.singletonList(specimenUuid)), modelService, partService, application);
}
-
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(IndividualsAssociation entity) {
+ return true;
+ }
}
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.editor.AppModelId;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-public class OpenDerivativeEditorForSpecimenOrOBservationBase extends DefaultOpenHandlerBase<SpecimenOrObservationBase<?>>{
+public class OpenDerivativeEditorForSpecimenOrOBservationBase extends DefaultOpenHandlerBaseE4<SpecimenOrObservationBase<?>>{
protected static final String OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN = Messages.OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN;
}
@Override
- protected void open(ExecutionEvent event, SpecimenOrObservationBase<?> entity) {
+ protected void open(SpecimenOrObservationBase<?> entity, Shell shell, EPartService partService) {
DerivateViewEditorInput input = new DerivateViewEditorInput(entity.getUuid());
- MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
- AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
- DerivateView derivateView = (DerivateView) part.getObject();
- derivateView.init(input);
+ EditorUtil.openSpecimenEditor(input, modelService, partService, application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(SpecimenOrObservationBase<?> entity) {
+ //FIXME E4 when bulk editor is migrated then move the handler scope to the bulk editor part descriptor
+ //in the model fragment
+ return true;
}
}
import java.util.List;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.config.FindOccurrencesConfigurator;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.AppModelId;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
-import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase<TaxonNode> {
+public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBaseE4<TaxonNode> {
protected static final String OPEN_DERIVATIVE_EDITOR_FOR_TAXON_NODE_COULD_NOT_OPEN = Messages.OpenDerivativeEditorForTaxonNode_COULD_NOT_OPEN;
}
@Override
- protected void open(ExecutionEvent event, TaxonNode entity) {
+ protected void open(TaxonNode entity, Shell shell, EPartService partService) {
FindOccurrencesConfigurator config = new FindOccurrencesConfigurator();
UUID taxonUuid = entity.getTaxon().getUuid();
config.setAssociatedTaxonUuid(taxonUuid);
specimenUuids.add(specimenOrObservationBase.getUuid());
}
DerivateViewEditorInput input = new DerivateViewEditorInput(specimenUuids, taxonUuid);
- MPart part = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
- AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW, PartState.ACTIVATE);
- DerivateView derivateView = (DerivateView) part.getObject();
- derivateView.init(input);
+ EditorUtil.openSpecimenEditor(input, modelService, partService, application);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(TaxonNode entity) {
+ return entity.getTaxon()!=null;
}
}
--- /dev/null
+package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+
+public class OpenSpecimenEditorFromMenu{
+
+ @Execute
+ public void execute(EModelService modelService, EPartService partService, MApplication application) {
+ DerivateViewEditorInput input = new DerivateViewEditorInput();
+ EditorUtil.openSpecimenEditor(input, modelService, partService, application);
+ }
+
+}
import java.util.Collection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TransferData;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.ui.EditViewerDropAdapter;
/**
* @author n.hoffmann
* @created Feb 8, 2011
* @version 1.0
*/
-public class DescriptionElementDropAdapter extends ViewerDropAdapter {
+public class DescriptionElementDropAdapter extends EditViewerDropAdapter {
private static final String OPERATION_NOT_SUPPORTED_YET = Messages.DescriptionElementDropAdapter_NOT_SUPPORTED;
AbstractPostOperation operation = new MoveDescriptionElementsOperation(Messages.DescriptionElementDropAdapter_MOVE_DESC, EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
- EditorUtil.executeOperation(operation);
+ EditorUtil.executeOperation(operation, sync);
return true;
}
MessagingUtils.warningDialog(OPERATION_NOT_SUPPORTED_YET, this, Messages.DescriptionElementDropAdapter_NOT_SUPPORTED_EMPTY_ELEMENT);
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
-import eu.etaxonomy.taxeditor.editor.view.media.MediaViewPart;
+import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
/** {@inheritDoc} */
@Override
protected ISelection getInitialSelection() {
- if(getEditor() != null){
- return new StructuredSelection(getEditor().getEditorInput());
- }
+// if(getEditor() != null){
+// return new StructuredSelection(getEditor().getEditorInput());
+// }
return super.getInitialSelection();
}
}
if (partObject instanceof DetailsViewPart || partObject instanceof SupplementalDataViewPart
- || partObject instanceof MediaViewPart) {
+ || partObject instanceof MediaViewPartE4) {
// do not show empty page as these views are also used to edit the
// description selected in this view
return;
}
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (partObject instanceof MultiPageTaxonEditor){
- if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
+ if (partObject instanceof TaxonNameEditorE4){
+ if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
showEmptyPage();
return;
}
import javax.annotation.PostConstruct;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.model.ImageResources;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
+import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
/**
* @author pplitzner
*
*/
public class FactualDataPartE4 extends AbstractCdmEditorPartE4
- implements IPartContentHasDetails, IPartContentHasSupplementalData, ICdmEntitySessionEnabled {
+ implements IPartContentHasDetails, IPartContentHasSupplementalData, ICdmEntitySessionEnabled,
+ ICollapsableExpandable {
/**
* Maps {@link FeatureNodeContainerTree} to their corresponding {@link TaxonDescritpion}.<br>
*/
protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache = new HashMap<DescriptionBase<?>, FeatureNodeContainerTree>();
- protected ToggleDescriptionAction showAllElementsAction;
-
- protected ToggleDescriptionAction hideAllElementsAction;
-
protected int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
private DescriptiveContentProvider provider;
@PostConstruct
- public void create(Composite parent, EMenuService menuService) {
+ public void create(Composite parent, EMenuService menuService, MPart thisPart,
+ IEclipseContext context) {
TreeViewer treeViewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION));
+
+ this.thisPart = thisPart;
+
provider = new DescriptiveContentProvider(featureNodeContainerCache);
treeViewer.setContentProvider(provider);
treeViewer.setLabelProvider(new DescriptiveLabelProvider());
Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
treeViewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
this));
+ DescriptionElementDropAdapter dropListener = new DescriptionElementDropAdapter(viewer);
+ ContextInjectionFactory.inject(dropListener, context);
treeViewer.addDropSupport(dndOperations, transfers,
- new DescriptionElementDropAdapter(viewer));
+ dropListener);
viewer = treeViewer;
//create context menu
menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.factualDataView");
- showAllElementsAction = new ToggleDescriptionAction(false);
- hideAllElementsAction = new ToggleDescriptionAction(true);
-
- //FIXME E4 implement toolbar
-// createToolbar();
-
}
-// protected void createToolbar() {
-// IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
-// toolBarManager.add(showAllElementsAction);
-// toolBarManager.add(hideAllElementsAction);
-// }
-
-
@Override
public void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart) {
if(activePart==thisPart){
}
}
Object firstElement = structuredSelection.getFirstElement();
- if (partObject instanceof MultiPageTaxonEditor){
- if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
+ if (partObject instanceof TaxonNameEditorE4){
+ if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
showEmptyPage();
return;
}
return Messages.DescriptiveViewPart_FACTUAL_DATA;
}
- /**
- *
- * @author n.hoffmann
- * @created May 28, 2010
- * @version 1.0
- */
- protected class ToggleDescriptionAction extends Action{
- private final boolean expanded;
-
- public ToggleDescriptionAction(boolean expand){
- super(null, IAction.AS_PUSH_BUTTON);
- expanded = expand;
- setImageAndTooltip();
- }
-
- private void setImageAndTooltip(){
- setImageDescriptor(new ImageDescriptor() {
- @Override
- public ImageData getImageData() {
- setText(expanded ? Messages.DescriptiveViewPart_COLLAPSE_ALL : Messages.DescriptiveViewPart_EXPAND_ALL);
- String resource = expanded ? ImageResources.COLLAPSE_ALL : ImageResources.EXPAND_ALL;
- return ImageResources.getImage(resource).getImageData();
- }
- });
-
- String toolTipText = expanded ? Messages.DescriptiveViewPart_COLLAPSE_ALL : Messages.DescriptiveViewPart_SHOW_ALL_DATA;
- setToolTipText(toolTipText);
- }
-
- @Override
- public void run() {
- if(expanded){
- ((AbstractTreeViewer) viewer).collapseAll();
- }else{
- ((AbstractTreeViewer) viewer).expandAll();
- }
- setImageAndTooltip();
- }
- }
-
/** {@inheritDoc} */
@Override
public void changed(Object object) {
super.changed(object);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void collapse() {
+ if(viewer instanceof TreeViewer) {
+ ((TreeViewer) viewer).collapseAll();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void expand() {
+ if(viewer instanceof TreeViewer) {
+ ((TreeViewer) viewer).expandAll();
+ }
+ }
+
public void toggleShowOnlyIndividualAssociations(){
provider.toggleShowOnlyIndividualAssociations();
viewer.refresh();
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object object, MHandledMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object object, MHandledMenuItem menuItem,
+ UISynchronize sync) {
String commandId = menuItem.getCommand().getElementId();
UUID uuid = (UUID) menuItem.getTransientData().get(commandId+".feature.uuid");
MessagingUtils.error(getClass(), new IllegalArgumentException("Could not determine the taxon description")); //$NON-NLS-1$
return;
}
- AbstractPostOperation operation = operationCreationInstance(menuItem.getLocalizedLabel(), feature, description, factualDataPart);
+ AbstractPostOperation operation = operationCreationInstance(menuItem.getLocalizedLabel(), feature, description,
+ factualDataPart);
// TODO use undo context specific to editor
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
/**
* @param postOperationEnabled
* @return
*/
- protected AbstractPostOperation operationCreationInstance(String label, Feature feature, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
- return new CreateDescriptionElementOperation(label, EditorUtil.getUndoContext(), description, feature, postOperationEnabled);
- }
+ protected AbstractPostOperation operationCreationInstance(String label, Feature feature,
+ DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ return new CreateDescriptionElementOperation(label, EditorUtil.getUndoContext(), description, feature,
+ postOperationEnabled);
+ }
}
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
public class CreateDescriptionHandlerE4 {
@Execute
- public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, MMenuItem menuItem) {
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, MMenuItem menuItem,
+ UISynchronize sync) {
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
}
if(viewerInput instanceof SpecimenOrObservationBase<?>){
operation = new CreateSpecimenDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>) viewerInput, factualDataPart);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
if(viewerInput instanceof TaxonBase){
operation = createTaxonOperation(menuItem.getLocalizedLabel(), (Taxon) viewerInput, factualDataPart);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
- @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem) {
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem,
+ UISynchronize sync) {
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
// execute all cumulated operations
for(AbstractPostOperation<?> operation : operations){
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
}
private boolean isTaxonEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof MultiPageTaxonEditor){
+ if(AbstractUtility.getActiveEditor() instanceof TaxonNameEditorE4){
return true;
}
return false;
}
private boolean isBulkEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof BulkEditor){
+ if(AbstractUtility.getActiveEditor() instanceof BulkEditor){
return true;
}
return false;
}
private boolean isDerivateEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof DerivateView){
+ if(AbstractUtility.getActiveEditor() instanceof DerivateView){
return true;
}
return false;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
*/
public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
private UUID newAcceptedTaxonNodeUuid;
- private TaxonNameEditor editor;
+ private TaxonNameEditorE4 editor;
+ private MApplication application;
+ private EModelService modelService;
+ private EPartService partService;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
- @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem) {
+ @Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
+ @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MMenuItem menuItem, EPartService partService,
+ EModelService modelService, MApplication application, UISynchronize sync) {
+
+ this.modelService = modelService;
+ this.application = application;
+ this.partService = partService;
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
- editor = (TaxonNameEditor) ((MultiPageTaxonEditor) e4WrappedPart).getPage(Page.NAME);
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
+ editor = (TaxonNameEditorE4) e4WrappedPart;
}
Taxon actualTaxon= null;
}
newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
- String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getEditor().getTaxon());
+ String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, editor.getTaxon());
AbstractPostOperation operation = new MoveDescriptionElementsOperation(
menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(),
targetTaxon.getUuid(), moveMessage, elements, false, this);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
public void run() {
//AbstractUtility.close(editor.getMultiPageTaxonEditor());
- try {
- MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
- if(possibleOpenEditor != null){
- AbstractUtility.close(possibleOpenEditor);
- }
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.MoveDescriptionElementsHandler_CREATE_FAILURE, this, e.getMessage());
- }
+ //FIXME E4 migrate
+// MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
+// if(possibleOpenEditor != null){
+// AbstractUtility.close(possibleOpenEditor);
+// }
+ EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid, modelService, partService, application);
}
});
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
private MoveDescriptionToOtherTaxonOperation operation;
private UUID newAcceptedTaxonNodeUuid;
- private MultiPageTaxonEditor editor;
+ private TaxonNameEditorE4 editor;
+ private MApplication application;
+ private EModelService modelService;
+ private EPartService partService;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
- @Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MMenuItem menuItem) {
+ @Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
+ @Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MMenuItem menuItem, EPartService partService,
+ EModelService modelService, MApplication application, UISynchronize sync) {
+ this.modelService = modelService;
+ this.application = application;
+ this.partService = partService;
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
- editor = (MultiPageTaxonEditor) e4WrappedPart;
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
+ editor = (TaxonNameEditorE4) e4WrappedPart;
if (this.editor.isDirty()){
boolean proceed = MessageDialog.openQuestion(null,
Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE);
if (proceed) {
- editor.doSave(AbstractUtility.getMonitor());
+ editor.save(AbstractUtility.getMonitor());
} else {
return;
}
// Choose the target taxon
List<UUID> excludeTaxa = new ArrayList<UUID>();
-
+
excludeTaxa.add(descriptions.get(0).getTaxon().getUuid());
//get current taxon node
TaxonNode node = null;
Classification classification = null;
- MultiPageTaxonEditor taxonEditor = EditorUtil.getActiveMultiPageTaxonEditor();
- if(taxonEditor!=null){
- node = ((TaxonEditorInput) taxonEditor.getEditorInput()).getTaxonNode();
+ if(editor!=null){
+ node = editor.getEditorInput().getTaxonNode();
classification = node.getClassification();
}
TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
newAcceptedTaxonNode,
this,
editor,
- (ICdmEntitySessionEnabled)editor.getEditorInput());
- AbstractUtility.executeOperation(operation);
+ editor.getEditorInput());
+ AbstractUtility.executeOperation(operation, sync);
}
@Override
public void run() {
- AbstractUtility.close(editor);
-
+ //FIXME E4 migrate
+// AbstractUtility.close(editor);
+//
try {
- MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
- if(possibleOpenEditor != null){
- AbstractUtility.close(possibleOpenEditor);
- }
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
+// MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
+// if(possibleOpenEditor != null){
+// AbstractUtility.close(possibleOpenEditor);
+// }
+ EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid, modelService, partService, application);
+// } catch (PartInitException e) {
+// MessagingUtils.error(this.getClass(), e);
+// throw new RuntimeException(e);
} catch (Exception e) {
MessagingUtils.warningDialog(Messages.MoveDescriptionToOtherTaxonHandler_CREATE_FAILED, this, e.getMessage());
}
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject();
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(factualDataPart.getSelectionProvidingPart());
- if(e4WrappedPart instanceof MultiPageTaxonEditor){
+ if(e4WrappedPart instanceof TaxonNameEditorE4){
ISelection selection = factualDataPart.getViewer().getSelection();
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
try {
// TODO use undo context specific to editor
operation = operationCreationInstance(event.getCommand().getName(), event, description, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
}
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateSpecimenDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
+
AbstractPostOperation<?> operation;
if(part instanceof DescriptiveViewPart){
+
Object viewerInput = ((DescriptiveViewPart)part).getViewer().getInput();
if(viewerInput instanceof SpecimenOrObservationBase<?>){
try {
operation = new CreateSpecimenDescriptionOperation(event.getCommand().getName(), EditorUtil.getUndoContext(), (SpecimenOrObservationBase<?>) viewerInput, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
if(viewerInput instanceof TaxonBase){
try{
operation = createTaxonOperation(event.getCommand().getName(), (Taxon) viewerInput, postOperationEnabled);
- AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.SpecimenDescription;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
-import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteDescriptionElementOperation;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteSpecimenDescriptionOperation;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteTaxonDescriptionOperation;
-import eu.etaxonomy.taxeditor.editor.view.media.operation.DeleteMediaOperation;
-import eu.etaxonomy.taxeditor.editor.view.media.operation.RemoveImageFromDescriptionElementOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
-
-/**
- * <p>DeleteDescriptionHandler class.</p>
- *
- * @author n.hoffmann
- * @created Jun 22, 2010
- * @version 1.0
- */
-public class DeleteHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveSite(event).getSelectionProvider().getSelection();
-
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
- ICdmEntitySessionEnabled cdmEntitySessionEnabled = (part instanceof ICdmEntitySessionEnabled) ? (ICdmEntitySessionEnabled) part : null;
-
- try {
- String label = event.getCommand().getName();
-
- IUndoContext undoContext = EditorUtil.getUndoContext();
-
- List<AbstractPostOperation<?>> operations = new ArrayList<AbstractPostOperation<?>>();
-
- for(Object object : selection.toArray()){
-
- // TaxonDescription
- if(object instanceof TaxonDescription){
- operations.add(new DeleteTaxonDescriptionOperation(label, undoContext, (TaxonDescription) object, postOperationEnabled, cdmEntitySessionEnabled));
- }
- else if(object instanceof SpecimenDescription){
- operations.add(new DeleteSpecimenDescriptionOperation(label, undoContext, (SpecimenDescription) object, postOperationEnabled, cdmEntitySessionEnabled)) ;
- }
- // DescriptionElementBase
- else if(object instanceof DescriptionElementBase){
- operations.add(new DeleteDescriptionElementOperation(label, undoContext, (DescriptionElementBase) object, postOperationEnabled, cdmEntitySessionEnabled));
- }
- else if(object instanceof FeatureNodeContainer){
- List<DescriptionElementBase> descriptions = ((FeatureNodeContainer) object).getDescriptionElementsForEntireBranch();
-
- for(DescriptionElementBase description : descriptions){
- operations.add(new DeleteDescriptionElementOperation(label, undoContext, description, postOperationEnabled, cdmEntitySessionEnabled));
- }
- }
- // Media
- else if(object instanceof Media){
- TreeSelection treeSelection = (TreeSelection) selection;
-
- TreePath[] path = treeSelection.getPathsFor(object);
-
- DescriptionBase<?> imageGallery = (DescriptionBase<?>) path[0].getFirstSegment();
-
- // TODO use undo context specific to editor
- MediaDeletionConfigurator config = new MediaDeletionConfigurator();
- config.setDeleteFromDescription(true);
- config.setOnlyRemoveFromGallery(false);
-
- if (imageGallery instanceof SpecimenDescription){
- config.setDeleteFrom(((SpecimenDescription)imageGallery).getDescribedSpecimenOrObservation());
- } else if (imageGallery instanceof TaxonDescription){
- config.setDeleteFrom(((TaxonDescription)imageGallery).getTaxon());
- }else if (imageGallery instanceof TaxonNameDescription){
- config.setDeleteFrom(((TaxonNameDescription)imageGallery).getTaxonName());
- }
-
-
- if (!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), Messages.DeleteHandler_CONFIRM_DELETION, Messages.DeleteHandler_CONFIRM_DELETION_MESSAGE)){
- return null;
- }
-
-
-
- if (config.isOnlyRemoveFromGallery() || ((Media)object).getId() == 0){
- operations.add(new RemoveImageFromDescriptionElementOperation(label, undoContext, (Media) object, imageGallery, postOperationEnabled));
- }else{
- operations.add(new DeleteMediaOperation(label, undoContext, imageGallery, (Media) object, config, postOperationEnabled));
- }
-
-
-
- }
- else{
- MessagingUtils.error(getClass(), Messages.DeleteHandler_INVALID_SELECTION, null);
- }
- }
-
- // execute all cumulated operations
- for(AbstractPostOperation<?> operation : operations){
- AbstractUtility.executeOperation(operation);
- }
-
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
- }
-
-
- return null;
- }
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
-import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-
-/**
- * Property tester used by the description tree menu.
- *
- * @author p.ciardelli
- * @author n.hoffmann
- * @version $Id: $
- */
-public class DescriptionsMenuPropertyTester extends PropertyTester {
-
- private static final String MEDIA = "isMedia"; //$NON-NLS-1$
- private static final String FEATURE_NODE_CONTAINER = "isFeatureNodeContainer"; //$NON-NLS-1$
- private static final String DESCRIPTION = "isDescription"; //$NON-NLS-1$
- private static final String INDIVIDUALS_ASSOCIATION = "isIndividualsAssociation"; //$NON-NLS-1$
- private static final String DESCRIPTION_ELEMENT = "isDescriptionElement"; //$NON-NLS-1$
- private static final String DELETABLE = "isDeletable"; //$NON-NLS-1$
- private static final String IMAGE_GALLERY = "isImageGallery"; //$NON-NLS-1$
- private static final String TAXON_EDITOR = "isTaxonEditor"; //$NON-NLS-1$
- private static final String BULK_EDITOR = "isBulkEditor"; //$NON-NLS-1$
- private static final String DERIVATE_EDITOR = "isDerivateEditor"; //$NON-NLS-1$
-
- /* (non-Javadoc)
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- public boolean test(Object receiver, String property, Object[] args,
- Object expectedValue) {
-
- if(TAXON_EDITOR.equals(property)){
- return isTaxonEditor();
- }
- else if(BULK_EDITOR.equals(property)){
- return isBulkEditor();
- }
- else if(DERIVATE_EDITOR.equals(property)){
- return isDerivateEditor();
- }
-
- Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
-
- if(selectedElements.length == 0){
- // nothing selected so all tests should fail
- return false;
- }
-
- if(MEDIA.equals(property)){
- return isMedia(selectedElements);
- }
- else if(FEATURE_NODE_CONTAINER.equals(property)){
- return isFeatureNodeContainer(selectedElements);
- }
- else if(DESCRIPTION.equals(property)){
- return isDescription(selectedElements);
- }
- else if(INDIVIDUALS_ASSOCIATION.equals(property)){
- return isIndividualsAssociation(selectedElements);
- }
- else if(DESCRIPTION_ELEMENT.equals(property)){
- return isDescriptionElement(selectedElements);
- }
- else if(DELETABLE.equals(property)){
- return isDeletable(selectedElements);
- }
- else if(IMAGE_GALLERY.equals(property)){
- return isImageGallery(selectedElements);
- }
- else{
- return false;
- }
- }
-
- private boolean isImageGallery(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof DescriptionBase) || !((DescriptionBase<?>) object).isImageGallery()){
- return false;
- }
- }
- return true;
- }
-
- private boolean isFeatureNodeContainer(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof FeatureNodeContainer)){
- return false;
- }
- }
- return true;
- }
-
- private boolean isDeletable(Object[] selectedElements) {
- boolean result = false;
-
- for (Object object : selectedElements) {
-
- if((object instanceof DescriptionBase)
- || (object instanceof DescriptionElementBase)
- || (object instanceof Media)
- || (object instanceof FeatureNodeContainer)){
- result = true;
- }else{
- return false;
- }
-
- }
- return result;
- }
-
- private boolean isDescriptionElement(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof DescriptionElementBase)){
- return false;
- }
- }
- return true;
- }
-
- private boolean isDescription(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof DescriptionBase)){
- return false;
- }
- }
- return true;
- }
-
- private boolean isIndividualsAssociation(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof IndividualsAssociation)){
- return false;
- }
- }
- return true;
- }
-
- private boolean isMedia(Object[] selectedElements) {
- for (Object object : selectedElements){
- if(!(object instanceof Media)){
- return false;
- }
- }
- return true;
- }
-
- private boolean isTaxonEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof MultiPageTaxonEditor){
- return true;
- }
- return false;
- }
-
- private boolean isBulkEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof BulkEditor){
- return true;
- }
- return false;
- }
-
- private boolean isDerivateEditor() {
- if(AbstractUtility.getActiveE4Editor() instanceof DerivateView){
- return true;
- }
- return false;
- }
-}
+++ /dev/null
-/**
- * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
- * http://www.e-taxonomy.eu
- *
- * The contents of this file are subject to the Mozilla Public License Version 1.1
- * See LICENSE.TXT at the top of this package for the full license terms.
- */
-
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.handlers.IHandlerService;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-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.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateDescriptionElementOperation;
-import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- *
- * @author n.hoffmann
- * @created 17.04.2009
- * @version 1.0
- */
-public class DynamicFeatureMenu extends CompoundContributionItem {
-
- /** {@inheritDoc} */
- @Override
- protected IContributionItem[] getContributionItems() {
-
- return new IContributionItem[] { new ContributionItem() {
- @Override
- public void fill(Menu menu, int index) {
- ISelectionService selectionService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService();
-
- ISelection selection = selectionService.getSelection(DescriptiveViewPart.ID);
-
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object selectedElement = structuredSelection
- .getFirstElement();
-
- if (selectedElement instanceof DescriptionBase<?>) {
- FeatureTree featureTree = getFeatureTree((DescriptionBase<?>) selectedElement);
-
- for (FeatureNode childNode : featureTree.getRootChildren()) {
- createMenuItem(menu, childNode.getFeature());
-
- }
- } else if (selectedElement instanceof FeatureNodeContainer) {
- FeatureNode featureNode = ((FeatureNodeContainer) selectedElement)
- .getFeatureNode();
-
- // add the feature to the menu
- createMenuItem(menu, featureNode.getFeature());
-
- // add possible children to the menu
- for (FeatureNode childNode : featureNode.getChildNodes()) {
- createMenuItem(menu, childNode.getFeature());
- }
- } else if (selectedElement instanceof DescriptionElementBase) {
- Feature feature = ((DescriptionElementBase) selectedElement)
- .getFeature();
- createMenuItem(menu, feature);
- }
- }
- }
- } };
- }
-
- private void createMenuItem(Menu menu, final Feature feature) {
- MenuItem menuItem = new MenuItem(menu, -1);
- final Feature deproxiedFeature = HibernateProxyHelper.deproxy(feature, Feature.class);
-
- String label = deproxiedFeature.getLabel(PreferencesUtil.getGlobalLanguage());
- if (label == null){
- label = deproxiedFeature.getLabel();
- }
- if(label == null){
- label = deproxiedFeature.generateTitle();
- }
- if(label == null){
- label = deproxiedFeature.toString();
- }
- menuItem.setText(label);
- menuItem.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent ev) {
- Event event = new Event();
- event.data = deproxiedFeature;
- try {
- TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class).executeCommand(
- CreateDescriptionElementOperation.ID, event);
- } catch (Exception e) {
- MessagingUtils.error(getClass(), e);
- }
- }
- });
-
- }
-
- /**
- * Retrieves the feature tree associated with the given description
- *
- * TODO as of now this is always the same thing because feature trees may
- * not be associated to descriptions yet.
- *
- * @param description
- * @return
- */
- private FeatureTree getFeatureTree(DescriptionBase description) {
- FeatureTree featureTree = null;
-
- // TODO change this to the feature tree associated with this taxon
- // description
- if (description.hasStructuredData()) {
- featureTree = PreferencesUtil
- .getDefaultFeatureTreeForStructuredDescription();
- } else {
- featureTree = PreferencesUtil
- .getDefaultFeatureTreeForTextualDescription();
- }
-
- if (featureTree == null) {
- featureTree = FeatureTree.NewInstance(CdmStore.getTermManager()
- .getPreferredTerms(Feature.class));
- }
-
- return featureTree;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-
-/**
- * @author n.hoffmann
- * @created Feb 8, 2011
- * @version 1.0
- */
-public class MoveDescriptionElementsHandler extends AbstractHandler implements IPostOperationEnabled{
- private UUID newAcceptedTaxonNodeUuid;
- private TaxonNameEditor editor;
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
-// ConversationHolder conversation = CdmStore.createConversation();
- editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- Taxon actualTaxon= null;
- if(selection instanceof IStructuredSelection){
-
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- List<DescriptionElementBase> elements = new ArrayList<DescriptionElementBase>();
-
- for(Object element : structuredSelection.toArray()){
- if(element instanceof DescriptionElementBase){
- UUID uuid = ((DescriptionElementBase) element).getUuid();
-
- elements.add(CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null));
- } else if(element instanceof FeatureNodeContainer){
- for(DescriptionElementBase de : ((FeatureNodeContainer)element).getDescriptionElements()){
- elements.add(
- CdmStore.getService(IDescriptionService.class).loadDescriptionElement(de.getUuid(), null)
- );
- }
- }
- }
-
- if(elements.size() == 0){
- return null;
- }
- DescriptionBase description = elements.get(0).getInDescription();
- List<UUID> excludeTaxa = new ArrayList<UUID>();
- if (description!=null && description.isInstanceOf(TaxonDescription.class)){
- TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(description, TaxonDescription.class);
- actualTaxon = taxonDescription.getTaxon();
- excludeTaxa.add(actualTaxon.getUuid());
- }
- Classification classification = null;
- TaxonNode actualNode = null;
- if (actualTaxon != null){
- if (!actualTaxon.getTaxonNodes().isEmpty() && actualTaxon.getTaxonNodes().size() ==1){
- actualNode = actualTaxon.getTaxonNodes().iterator().next();
- classification = actualNode.getClassification();
-
- }
- }
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
- editor.getConversationHolder(),
- Messages.MoveDescriptionElementsHandler_CHOOSE_ACC_TAXON,
- excludeTaxa,
- null, classification
- );
- if (newAcceptedTaxonNode != null){
- Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
-
- if(targetTaxon == null){
- // canceled
- return null;
- }
- newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
-
- String moveMessage = String.format(Messages.MoveDescriptionElementsHandler_ELEMENTS_MOVED, EditorUtil.getActiveMultiPageTaxonEditor().getTaxon());
-
- try {
- AbstractPostOperation operation = new MoveDescriptionElementsOperation(
- event.getCommand().getName(), EditorUtil.getUndoContext(),
- targetTaxon.getUuid(), moveMessage, elements, false, this);
-
- AbstractUtility.executeOperation(operation);
-
- //CdmStore.getService(ITaxonService.class).saveOrUpdate(targetTaxon);
-
- } catch (NotDefinedException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
- }
-
- return null;
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
-
- editor.getConversationHolder().bind();
- editor.getConversationHolder().commit(true);
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- //AbstractUtility.close(editor.getMultiPageTaxonEditor());
-
- try {
- MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
- if(possibleOpenEditor != null){
- AbstractUtility.close(possibleOpenEditor);
- }
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.MoveDescriptionElementsHandler_CREATE_FAILURE, this, e.getMessage());
- }
- }
-
- });
-
-
- return true;
- }
-
- @Override
- public boolean onComplete() {
- return false;
- }
-
-}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.description.DescriptionBase;
-import eu.etaxonomy.cdm.model.description.TaxonDescription;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-/**
- * <p>ChangeAcceptedTaxonToSynonymHandler class.</p>
- *
- * @author a.kohlbecker
- * @created Okt. 11, 2013
- * @version 1.0
- *
- */
-public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler
- implements IPostOperationEnabled {
- private static final Logger logger = Logger
- .getLogger(MoveDescriptionToOtherTaxonHandler.class);
- private MoveDescriptionToOtherTaxonOperation operation;
-
- private UUID newAcceptedTaxonNodeUuid;
- private MultiPageTaxonEditor editor;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- editor = EditorUtil.getActiveMultiPageTaxonEditor();
- if (this.editor.isDirty()){
- boolean proceed = MessageDialog.openQuestion(null,
- Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES, Messages.MoveDescriptionToOtherTaxonHandler_SAVE_CHANGES_MESSAGE);
- if (proceed) {
- editor.doSave(EditorUtil.getMonitor());
- } else {
- return null;
- }
-
- }
-
-
- if(selection instanceof IStructuredSelection){
-
- List<TaxonDescription> descriptions = new ArrayList<TaxonDescription>();
-
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- for(Object element : structuredSelection.toArray()){
- UUID uuid = null;
- if (element instanceof FeatureNodeContainer){
- uuid = ((FeatureNodeContainer)element).getDescription().getUuid();
- } else if (element instanceof DescriptionBase){
- uuid = ((DescriptionBase)element).getUuid();
- }
-
- if (uuid != null){
- descriptions.add((TaxonDescription) CdmStore.getService(IDescriptionService.class).load(uuid, null));
- }
- }
- if(descriptions.size() == 0){
- return null;
- }
-
- // Choose the target taxon
- List<UUID> excludeTaxa = new ArrayList<UUID>();
-
-
- excludeTaxa.add(descriptions.get(0).getTaxon().getUuid());
-
- //get current taxon node
- TaxonNode node = null;
- Classification classification = null;
- MultiPageTaxonEditor taxonEditor = EditorUtil.getActiveMultiPageTaxonEditor();
- if(taxonEditor!=null){
- node = ((TaxonEditorInput) taxonEditor.getEditorInput()).getTaxonNode();
- classification = node.getClassification();
- }
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
- editor.getConversationHolder(),
- Messages.MoveDescriptionToOtherTaxonHandler_CHOOSE_ACC_TAXON,
- excludeTaxa,
- node,
- classification);
-
- if (newAcceptedTaxonNode == null) {
- return null;
- }
-
- newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();
-
- try {
- for(TaxonDescription description : descriptions){
- operation = new MoveDescriptionToOtherTaxonOperation(event.getCommand().getName(),
- editor.getUndoContext(),
- description,
- newAcceptedTaxonNode,
- this,
- editor,
- (ICdmEntitySessionEnabled)editor.getEditorInput());
- AbstractUtility.executeOperation(operation);
- }
-
- } catch (NotDefinedException e) {
- logger.warn("Command name not set"); //$NON-NLS-1$
- }
- }
-
- return null;
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
- */
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- AbstractUtility.close(editor);
-
- try {
- MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
- if(possibleOpenEditor != null){
- AbstractUtility.close(possibleOpenEditor);
- }
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.MoveDescriptionToOtherTaxonHandler_CREATE_FAILED, this, e.getMessage());
- }
- }
-
- });
-
-
- return true;
- }
-
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
- @Override
- public boolean onComplete() {
- // TODO Auto-generated method stub
- return false;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2014 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-
-/**
- * @author pplitzner
- * @date Nov 25, 2014
- *
- */
-public class ToggleShowOnlyIndividualAssociationsHandler extends AbstractHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
- if(activePart instanceof DescriptiveViewPart){
- DescriptiveViewPart descriptiveViewPart = (DescriptiveViewPart)activePart;
- descriptiveViewPart.toggleShowOnlyIndividualAssociations();
- }
- return null;
- }
-
-}
+++ /dev/null
-
-package eu.etaxonomy.taxeditor.editor.view.media;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
-
-/**
- * <p>MediaLabelProvider class.</p>
- *
- * @author n.hoffmann
- * @version $Id: $
- */
-public class MediaLabelProvider extends ColumnLabelProvider {
-
- /** {@inheritDoc} */
- public String getText(Object element) {
- if(element instanceof IdentifiableEntity){
- return ((IdentifiableEntity) element).getTitleCache();
- }
-
- return element.toString();
- }
-}
--- /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.editor.view.media;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.common.UriUtils;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.media.MediaRepresentation;
+import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author k.luther
+ * @date 11.10.2017
+ *
+ */
+public class MediaViewLabelProvider extends LabelProvider implements IStyledLabelProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+
+ @Override
+ public StyledString getStyledText(Object element) {
+ if (element instanceof IdentifiableEntity) {
+ IdentifiableEntity<?> identifiableEntity= (IdentifiableEntity<?>) element;
+ if(identifiableEntity.getId()==0){
+ return new StyledString(identifiableEntity.generateTitle());
+ }
+ else{
+ return new StyledString(identifiableEntity.getTitleCache());
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ Image image = null;
+ if (element instanceof Media && PreferencesUtil.isShowMediaPreview()){
+ Set<MediaRepresentation> representations = ((Media)element).getRepresentations();
+ if(representations.iterator().hasNext()){
+ MediaRepresentation rep = representations.iterator().next();
+ List<MediaRepresentationPart> parts = rep.getParts();
+ MediaRepresentationPart smallestPart = null;
+ for (MediaRepresentationPart part: parts){
+ if (smallestPart != null){
+ if (smallestPart.getSize() != null && part.getSize() != null) {
+ if (smallestPart.getSize() > part.getSize()){
+ smallestPart = part;
+ }
+ }
+ }else{
+ smallestPart = part;
+ }
+
+ }
+ URI uri = parts.get(0).getUri();
+ if (uri == null){
+ return null;
+ }
+ InputStream imageStream;
+ try {
+ imageStream = UriUtils.getInputStream(uri);
+ image = new Image(Display.getCurrent(), imageStream);
+ int height = image.getBounds().height;
+ int width = image.getBounds().width;
+ int scale = 50;
+ if (height>width){
+ width = width/(height/scale);
+ height = scale;
+ }else{
+ height = height/(width/scale);
+ width = scale;
+ }
+ Image scaled = new Image(Display.getDefault(), scale, scale);
+
+ GC gc = new GC(scaled);
+ gc.setAntialias(SWT.ON);
+ gc.setInterpolation(SWT.HIGH);
+
+
+ gc.drawImage(image, 0, 0,
+ image.getBounds().width, image.getBounds().height,
+ 0, 0, width, height);
+
+ gc.dispose();
+ image.dispose(); // don't forget about me!
+ return scaled;
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ return null;
+ }
+
+ }
+
+ }
+ return image;
+ }
+
+ @Override
+ public void dispose() {
+ // garbage collection system resources
+
+ }
+
+
+
+}
+++ /dev/null
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.view.media;
-
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.internal.E4PartWrapper;
-
-import eu.etaxonomy.cdm.model.description.IDescribable;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
-import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
-import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
-import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
-
-/**
- * @author n.hoffmann
- * @created Jun 15, 2010
- * @version 1.0
- */
-public class MediaViewPart extends AbstractCdmEditorViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
-
- public static final String ID = "eu.etaxonomy.taxeditor.editor.view.media"; //$NON-NLS-1$
-
-
- private TreeViewer viewer;
-
- /** {@inheritDoc} */
- @Override
- public void createViewer(Composite parent) {
-
- viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
- | SWT.V_SCROLL | SWT.FULL_SELECTION));
-
- viewer.setContentProvider(new MediaContentProvider());
- viewer.setLabelProvider(new MediaLabelProvider());
- viewer.setAutoExpandLevel(2);
-
- // Propagate selection from viewer
- getSite().setSelectionProvider(viewer);
-
- // Add context menu to tree
- MenuManager menuMgr = new MenuManager();
- menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- menuMgr.setRemoveAllWhenShown(true);
- getSite().registerContextMenu(menuMgr, viewer);
-
- Control control = viewer.getControl();
- Menu menu = menuMgr.createContextMenu(control);
- menuMgr.setRemoveAllWhenShown(true);
- control.setMenu(menu);
-
- }
-
- /** {@inheritDoc} */
- @Override
- protected ISelection getInitialSelection() {
- if(getEditor() != null){
- return new StructuredSelection(getEditor().getEditorInput());
- }
-
- return super.getInitialSelection();
- }
-
- /** {@inheritDoc} */
- @Override
- protected void selectionChanged_internal(IWorkbenchPart workbenchPart, ISelection selection) {
- Object partObject = workbenchPart;
-
- if(partObject==this){
- return;
- }
-
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
- if(wrappedPart!=null){
- partObject = wrappedPart;
- }
-// if(AbstractUtility.getActiveE4Editor() == null){
-// showEmptyPage();
-// return;
-// }
-
-
- if (partObject instanceof DetailsViewPart || partObject instanceof SupplementalDataViewPart
- || partObject instanceof DescriptiveViewPart) {
- // do not show empty page as these views are also used to edit the
- // description selected in this view
- return;
- }
-
- if(partObject instanceof IPartContentHasMedia && ((IPartContentHasMedia) partObject).canAttachMedia() ){
- if(selection instanceof IStructuredSelection){
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if (partObject instanceof MultiPageTaxonEditor){
- if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
- showEmptyPage();
- return;
- }
- }
- if(firstElement instanceof TreeNode){
- showViewer(partObject, new StructuredSelection(((TreeNode) firstElement).getValue()));
- return;
- }
- else if(firstElement!=null
- && firstElement instanceof IDescribable<?>){
- showViewer(partObject, (IStructuredSelection) selection);
- return;
- }
- }
- }
- if (selection instanceof IStructuredSelection){
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if(structuredSelection.getFirstElement() instanceof TreeNode){
- if (((TreeNode)structuredSelection.getFirstElement()).getValue() instanceof SpecimenOrObservationBase){
- structuredSelection = new StructuredSelection(((TreeNode)structuredSelection.getFirstElement()).getValue());
- showViewer(partObject, structuredSelection);
- return;
- }
- }
- }
-
- showEmptyPage();
- }
-
- /** {@inheritDoc} */
- @Override
- public void changed(Object object) {
- viewer.expandToLevel(2);
- viewer.refresh();
- if(object != null){
- StructuredSelection selection = new StructuredSelection(object);
- viewer.setSelection(selection, true);
- }
- //TODO: should be replaced with the possibility to set views dirty
- // when we move to Eclipse 4
- // take a look at ISaveblePart
- if(part instanceof BulkEditor && !(object instanceof SpecimenOrObservationBase<?>)){
- ((BulkEditor) part).forceDirty();
- IStructuredSelection selection = (IStructuredSelection) ((BulkEditor) part).getSelectionProvider().getSelection();
- ((BulkEditor) part).changed(selection.getFirstElement());
-
- }
- if (part instanceof E4PartWrapper){
- part = WorkbenchUtility.getE4WrappedPart(part);
- if (part instanceof IDirtyMarkable){
- StructuredSelection selection = new StructuredSelection(object);
- ((IDirtyMarkable)part).changed(selection.getFirstElement());
- }
- }
-
-
- super.changed(object);
- }
-
- /** {@inheritDoc} */
- @Override
- public Viewer getViewer() {
- return viewer;
- }
-
- @Override
- public boolean onComplete() {
- return true;
- }
-
- @Override
- protected String getViewName() {
- return Messages.MediaViewPart_MEDIA;
- }
-}
import org.eclipse.swt.widgets.Tree;
import eu.etaxonomy.cdm.model.description.IDescribable;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.concept.e4.ConceptViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.MediaContentProvider;
-import eu.etaxonomy.taxeditor.editor.view.media.MediaLabelProvider;
+import eu.etaxonomy.taxeditor.editor.view.media.MediaViewLabelProvider;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
implements IPartContentHasDetails, IPartContentHasSupplementalData {
@PostConstruct
- public void create(Composite parent, EMenuService menuService) {
+ public void create(Composite parent, EMenuService menuService, MPart thisPart) {
+ this.thisPart = thisPart;
TreeViewer treeViewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL
| SWT.V_SCROLL | SWT.FULL_SELECTION));
treeViewer.setContentProvider(new MediaContentProvider());
- treeViewer.setLabelProvider(new MediaLabelProvider());
+ treeViewer.setLabelProvider(new MediaViewLabelProvider());
+
+// TreeViewerColumn imagePreview = new TreeViewerColumn(treeViewer, SWT.NONE);
+// imagePreview.setLabelProvider(new DelegatingStyledCellLabelProvider(
+// new MediaViewLabelProvider(createImageDescriptor())));
+
treeViewer.setAutoExpandLevel(2);
viewer = treeViewer;
}
Object firstElement = structuredSelection.getFirstElement();
- if (partObject instanceof MultiPageTaxonEditor){
- if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
+ if (partObject instanceof TaxonNameEditorE4){
+ if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
showEmptyPage();
return;
}
return Messages.MediaViewPart_MEDIA;
}
+
+
}
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) DescriptionBase description, MMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) DescriptionBase description, MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
// TODO use undo context specific to editor
operation = new AddExistingMediaToImageGalleryOperation(media, menuItem.getLocalizedLabel(),
EditorUtil.getUndoContext(), description, mediaView);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
}
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
/** {@inheritDoc} */
@Execute
- public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, MMenuItem menuItem) {
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart, MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
AbstractPostOperation<?> operation = new CreateTaxonDescriptionOperation(menuItem.getLocalizedLabel(),
EditorUtil.getUndoContext(), taxon, mediaView, true);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
else if(((CdmBase) viewerInput).isInstanceOf(SpecimenOrObservationBase.class)){
SpecimenOrObservationBase<?> specimen = HibernateProxyHelper.deproxy(viewerInput, SpecimenOrObservationBase.class);
AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(menuItem.getLocalizedLabel(),
BulkEditorUtil.getUndoContext(), specimen, mediaView);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
}
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) DescriptionBase description, MMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) DescriptionBase description, MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
// TODO use undo context specific to editor
operation = new AddMediaToImageGalleryOperation(menuItem.getLocalizedLabel(),
EditorUtil.getUndoContext(), description, mediaView);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
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.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.forms.editor.FormEditor;
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
import eu.etaxonomy.cdm.model.media.Media;
-import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteSpecimenDescriptionOperation;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.DeleteTaxonDescriptionOperation;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.operation.DeleteMediaOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
*
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Named(IServiceConstants.ACTIVE_SELECTION) Media media,
+ @Named(IServiceConstants.ACTIVE_SELECTION) Object object,
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
- MMenuItem menuItem) {
+ MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
-
- Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(mediaView.getSelectionProvidingPart());
- if (e4WrappedPart instanceof FormEditor) {
- IEditorPart editor = null;
- editor = (FormEditor) e4WrappedPart;
- IEditorInput input = editor.getEditorInput();
- if (input instanceof CdmEntitySessionInput) {
- ISelection selection = mediaView.getViewer().getSelection();
- if (selection instanceof TreeSelection) {
- TreePath[] paths = ((TreeSelection) selection).getPaths();
- int count = paths[0].getSegmentCount();
- DescriptionBase description = null;
- for (int i = 0; i < count; i++ ) {
- if (paths[0].getSegment(i) instanceof DescriptionBase) {
- description = (DescriptionBase) paths[0].getSegment(i);
- break;
- }
- }
- // TODO use undo context specific to editor
- MediaDeletionConfigurator config = new MediaDeletionConfigurator();
-
- config.setDeleteFromDescription(true);
- config.setOnlyRemoveFromGallery(false);
-
- if (description instanceof SpecimenDescription){
- config.setDeleteFrom(((SpecimenDescription)description).getDescribedSpecimenOrObservation());
- } else if (description instanceof TaxonDescription){
- config.setDeleteFrom(((TaxonDescription)description).getTaxon());
- }else if (description instanceof TaxonNameDescription){
- config.setDeleteFrom(((TaxonNameDescription)description).getTaxonName());
- }
-
+ ISelection selection = mediaView.getViewer().getSelection();
+ if (selection instanceof TreeSelection) {
+ TreePath[] paths = ((TreeSelection) selection).getPaths();
+ int count = paths[0].getSegmentCount();
+ DescriptionBase description = null;
+ for (int i = 0; i < count; i++ ) {
+ if (paths[0].getSegment(i) instanceof DescriptionBase) {
+ description = (DescriptionBase) paths[0].getSegment(i);
+ break;
+ }
+ }
+ // TODO use undo context specific to editor
+ MediaDeletionConfigurator config = new MediaDeletionConfigurator();
+
+ config.setDeleteFromDescription(true);
+ config.setOnlyRemoveFromGallery(false);
+
+ if (description instanceof SpecimenDescription){
+ config.setDeleteFrom(((SpecimenDescription)description).getDescribedSpecimenOrObservation());
+ } else if (description instanceof TaxonDescription){
+ config.setDeleteFrom(((TaxonDescription)description).getTaxon());
+ }else if (description instanceof TaxonNameDescription){
+ config.setDeleteFrom(((TaxonNameDescription)description).getTaxonName());
+ }
+ DeleteConfiguratorDialog dialog;
+ dialog = new DeleteConfiguratorDialog(config, shell, Messages.DeleteMediaHandler_CONFIRM, null, Messages.DeleteMediaHandler_CONFIRM_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteMediaHandler_DELETE, Messages.DeleteMediaHandler_SKIP }, 0);
+ int result_dialog= dialog.open();
+ if (result_dialog != IStatus.OK){
+ return;
+ }
+ if(object instanceof Media){
+ AbstractPostOperation<?> operation = new DeleteMediaOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), description, (Media) object, config, mediaView);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+ if(object instanceof DescriptionBase && ((DescriptionBase) object).isImageGallery()){
+ if(object instanceof TaxonDescription){
+ DeleteTaxonDescriptionOperation deleteTaxonDescriptionOperation = new DeleteTaxonDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (TaxonDescription)object, mediaView, null);
+ AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync);
+ }
+ else if(object instanceof SpecimenDescription){
+ DeleteSpecimenDescriptionOperation deleteTaxonDescriptionOperation = new DeleteSpecimenDescriptionOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), (SpecimenDescription)object, mediaView, null);
+ AbstractUtility.executeOperation(deleteTaxonDescriptionOperation, sync);
- DeleteConfiguratorDialog dialog;
- dialog = new DeleteConfiguratorDialog(config, shell, Messages.DeleteMediaHandler_CONFIRM, null, Messages.DeleteMediaHandler_CONFIRM_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteMediaHandler_DELETE, Messages.DeleteMediaHandler_SKIP }, 0);
- int result_dialog= dialog.open();
- if (result_dialog != IStatus.OK){
- return;
- }
- AbstractPostOperation<?> operation = new DeleteMediaOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), description, media, config, mediaView);
- AbstractUtility.executeOperation(operation);
-
}
}
- } else if (e4WrappedPart instanceof DerivateView){
- DerivateView view = (DerivateView) e4WrappedPart;
-
- ISelection selection = mediaView.getViewer().getSelection();
- if (selection instanceof TreeSelection) {
- TreePath[] paths = ((TreeSelection) selection).getPaths();
- int count = paths[0].getSegmentCount();
- DescriptionBase description = null;
- for (int i = 0; i < count; i++ ) {
- if (paths[0].getSegment(i) instanceof DescriptionBase) {
- description = (DescriptionBase) paths[0].getSegment(i);
- break;
- }
- }
- // TODO use undo context specific to editor
- MediaDeletionConfigurator config = new MediaDeletionConfigurator();
-
- config.setDeleteFromDescription(true);
- config.setOnlyRemoveFromGallery(false);
-
- if (description instanceof SpecimenDescription){
- config.setDeleteFrom(((SpecimenDescription)description).getDescribedSpecimenOrObservation());
- } else if (description instanceof TaxonDescription){
- config.setDeleteFrom(((TaxonDescription)description).getTaxon());
- }else if (description instanceof TaxonNameDescription){
- config.setDeleteFrom(((TaxonNameDescription)description).getTaxonName());
- }
-
- DeleteConfiguratorDialog dialog;
- dialog = new DeleteConfiguratorDialog(config, shell, Messages.DeleteMediaHandler_CONFIRM, null, Messages.DeleteMediaHandler_CONFIRM_MESSAGE, MessageDialog.WARNING, new String[] { Messages.DeleteMediaHandler_DELETE, Messages.DeleteMediaHandler_SKIP }, 0);
- int result_dialog= dialog.open();
- if (result_dialog != IStatus.OK){
- return;
- }
- AbstractPostOperation<?> operation = new DeleteMediaOperation(menuItem.getLocalizedLabel(), EditorUtil.getUndoContext(), description, media, config, mediaView);
- AbstractUtility.executeOperation(operation);
-
- }
- }
}
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION) Object object,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = object instanceof Media
+ || (object instanceof DescriptionBase && ((DescriptionBase) object).isImageGallery());
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+
-
}
\ No newline at end of file
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.forms.editor.FormEditor;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.operation.MoveMediaInListOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@Named(IServiceConstants.ACTIVE_SELECTION) Media media,
- MMenuItem menuItem) {
+ MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
- IEditorPart editor = null;
+ TaxonNameEditorE4 editor = null;
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(mediaView.getSelectionProvidingPart());
- if (e4WrappedPart instanceof FormEditor) {
- editor = (FormEditor) e4WrappedPart;
- IEditorInput input = editor.getEditorInput();
- if (input instanceof TaxonEditorInput) {
- Taxon taxon = ((TaxonEditorInput) input).getTaxon();
+ if (e4WrappedPart instanceof TaxonNameEditorE4) {
+ editor = (TaxonNameEditorE4) e4WrappedPart;
+ TaxonEditorInputE4 input = editor.getEditorInput();
+ Taxon taxon = input.getTaxon();
- ISelection selection = mediaView.getViewer().getSelection();
- if (selection instanceof TreeSelection) {
- TreePath[] paths = ((TreeSelection) selection).getPaths();
- int count = paths[0].getSegmentCount();
- DescriptionBase description = null;
- for (int i = 0; i < count; i++ ) {
- if (paths[0].getSegment(i) instanceof DescriptionBase) {
- description = (DescriptionBase) paths[0].getSegment(i);
- break;
- }
+ ISelection selection = mediaView.getViewer().getSelection();
+ if (selection instanceof TreeSelection) {
+ TreePath[] paths = ((TreeSelection) selection).getPaths();
+ int count = paths[0].getSegmentCount();
+ DescriptionBase description = null;
+ for (int i = 0; i < count; i++ ) {
+ if (paths[0].getSegment(i) instanceof DescriptionBase) {
+ description = (DescriptionBase) paths[0].getSegment(i);
+ break;
}
- AbstractPostOperation operation = null;
- // TODO use undo context specific to editor
- operation = new MoveMediaInListOperation(menuItem.getLocalizedLabel(),
- EditorUtil.getUndoContext(), taxon, description, media, MoveMediaInListOperation.DOWN, mediaView);
- AbstractUtility.executeOperation(operation);
}
+ AbstractPostOperation operation = null;
+ // TODO use undo context specific to editor
+ operation = new MoveMediaInListOperation(menuItem.getLocalizedLabel(),
+ EditorUtil.getUndoContext(), taxon, description, media, MoveMediaInListOperation.DOWN, mediaView);
+ AbstractUtility.executeOperation(operation, sync);
}
}
- }
+ }
}
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.forms.editor.FormEditor;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4;
import eu.etaxonomy.taxeditor.editor.view.media.operation.MoveMediaInListOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@Named(IServiceConstants.ACTIVE_SELECTION) Media media,
- MMenuItem menuItem) {
+ MMenuItem menuItem,
+ UISynchronize sync) {
MediaViewPartE4 mediaView = (MediaViewPartE4) activePart.getObject();
- IEditorPart editor = null;
+ TaxonNameEditorE4 editor = null;
Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(mediaView.getSelectionProvidingPart());
- if (e4WrappedPart instanceof FormEditor) {
- editor = (FormEditor) e4WrappedPart;
- IEditorInput input = editor.getEditorInput();
- if (input instanceof TaxonEditorInput) {
- Taxon taxon = ((TaxonEditorInput) input).getTaxon();
+ if (e4WrappedPart instanceof TaxonNameEditorE4) {
+ editor = (TaxonNameEditorE4) e4WrappedPart;
+ TaxonEditorInputE4 input = editor.getEditorInput();
+ Taxon taxon =input.getTaxon();
- ISelection selection = mediaView.getViewer().getSelection();
- if (selection instanceof TreeSelection) {
- TreePath[] paths = ((TreeSelection) selection).getPaths();
- int count = paths[0].getSegmentCount();
- DescriptionBase element = null;
- for (int i = 0; i < count; i++ ) {
- if (paths[0].getSegment(i) instanceof DescriptionBase) {
- element = (DescriptionBase) paths[0].getSegment(i);
- break;
- }
+ ISelection selection = mediaView.getViewer().getSelection();
+ if (selection instanceof TreeSelection) {
+ TreePath[] paths = ((TreeSelection) selection).getPaths();
+ int count = paths[0].getSegmentCount();
+ DescriptionBase element = null;
+ for (int i = 0; i < count; i++ ) {
+ if (paths[0].getSegment(i) instanceof DescriptionBase) {
+ element = (DescriptionBase) paths[0].getSegment(i);
+ break;
}
- AbstractPostOperation operation = null;
- // TODO use undo context specific to editor
- operation = new MoveMediaInListOperation(menuItem.getLocalizedLabel(),
- EditorUtil.getUndoContext(), taxon, element, media, MoveMediaInListOperation.UP, mediaView);
- AbstractUtility.executeOperation(operation);
}
+ AbstractPostOperation operation = null;
+ // TODO use undo context specific to editor
+ operation = new MoveMediaInListOperation(menuItem.getLocalizedLabel(),
+ EditorUtil.getUndoContext(), taxon, element, media, MoveMediaInListOperation.UP, mediaView);
+ AbstractUtility.executeOperation(operation, sync);
}
}
}
import eu.etaxonomy.cdm.model.media.Media;
import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
import eu.etaxonomy.taxeditor.model.DeleteResultMessagingUtils;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
// ImagesUtility.removeMediaFromGallery(description, media);
monitor.worked(20);
- if (!config.isOnlyRemoveFromGallery()){
+ if (!config.isOnlyRemoveFromGallery() && media.getId() != 0){
DeleteResult result = CdmStore.getService(IMediaService.class).delete(media.getUuid(), config);
String errorMessage = "The media ";
-
+
if (!result.isOk()){
List<String> messages = new ArrayList<String>();
int i = result.getExceptions().size();
} else{
ImagesUtility.removeMediaFromGallery(description, media);
}
-
+
monitor.worked(40);
return postExecute(null);
--- /dev/null
+/**
+ * Copyright (C) 2011 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.editor.view.uses.e4;
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDragListener;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4;
+import eu.etaxonomy.taxeditor.editor.view.uses.UsesContentProvider;
+import eu.etaxonomy.taxeditor.editor.view.uses.UsesLabelProvider;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class UsesViewPartE4 extends FactualDataPartE4 {
+
+ //FIXME E4 implement delete handler
+
+ @Override
+ @PostConstruct
+ public void create(Composite parent, EMenuService menuService, MPart thisPart,
+ IEclipseContext context) {
+
+ this.thisPart = thisPart;
+
+ TreeViewer treeViewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL
+ | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ treeViewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
+ treeViewer.setLabelProvider(new UsesLabelProvider());
+ treeViewer.setAutoExpandLevel(2);
+
+ Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
+ treeViewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
+ this));
+ DescriptionElementDropAdapter dropListener = new DescriptionElementDropAdapter(treeViewer);
+ ContextInjectionFactory.inject(dropListener, context);
+ treeViewer.addDropSupport(dndOperations, transfers,
+ dropListener);
+
+
+
+ // Propagate selection from viewer
+ selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+ treeViewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(treeViewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.usesView");
+
+ viewer = treeViewer;
+ }
+
+ @Override
+ protected String getViewName(){
+ return Messages.UsesViewPart_VIEWER_NAME;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ viewer.refresh();
+ return super.postOperation(objectAffectedByOperation);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2011 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.uses.e4.handler;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionHandlerE4;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.CreateTaxonDescriptionOperation;
+import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateTaxonUseOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class CreateUseHandlerE4 extends CreateDescriptionHandlerE4 {
+
+
+ /** {@inheritDoc} */
+ @Override
+ protected CreateTaxonDescriptionOperation createTaxonOperation(String eventLabel, Taxon taxon, IPostOperationEnabled postOperationEnabled) {
+ return new CreateTaxonUseOperation(eventLabel, EditorUtil.getUndoContext(), taxon, postOperationEnabled);
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2011 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.editor.view.uses.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4;
+import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseRecordOperation;
+import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.UseObjectStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class CreateUseRecordHandlerE4 extends CreateDescriptionElementHandlerE4 {
+ /** {@inheritDoc} */
+ @Override
+ protected AbstractPostOperation operationCreationInstance(String label, Feature feature, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ //Use Record Feature retrieval below
+ Feature useRecordFeature = UseObjectStore.getUseRecordFeature();
+ useRecordFeature.setSupportsCategoricalData(true);
+ return new CreateUseRecordOperation(label,
+ EditorUtil.getUndoContext(),
+ description, useRecordFeature, postOperationEnabled);
+ }
+
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection){
+ return selection instanceof DescriptionBase
+ || selection instanceof DescriptionElementBase
+ || selection instanceof FeatureNodeContainer;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2011 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.uses.e4.handler;
+
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Feature;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionElementHandlerE4;
+import eu.etaxonomy.taxeditor.editor.view.uses.operation.CreateUseSummaryOperation;
+import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.UseObjectStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class CreateUseSummaryHandlerE4 extends CreateDescriptionElementHandlerE4 {
+
+ /** {@inheritDoc} */
+ @Override
+ protected AbstractPostOperation operationCreationInstance(String label, Feature feature, DescriptionBase<?> description, IPostOperationEnabled postOperationEnabled) {
+ //Use Record Feature retrieval below
+ Feature useSummarFeature = UseObjectStore.getUseSummaryFeature();
+
+ useSummarFeature.setSupportsTextData(true);
+ return new CreateUseSummaryOperation(label, EditorUtil.getUndoContext(), description, useSummarFeature, postOperationEnabled);
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection){
+ return selection instanceof DescriptionBase
+ || selection instanceof DescriptionElementBase
+ || selection instanceof FeatureNodeContainer;
+ }
+
+}
* @param feature a {@link eu.etaxonomy.cdm.model.description.Feature} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public CreateUseRecordOperation(String label, IUndoContext undoContext, DescriptionBase<?> description, Feature feature, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, (Taxon)null, postOperationEnabled);
+ public CreateUseRecordOperation(String label, IUndoContext undoContext, DescriptionBase<?> description,
+ Feature feature, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, null, postOperationEnabled);
- this.description = description;
- this.feature = feature;
+ this.description = description;
+ this.feature = feature;
}
import javax.annotation.PreDestroy;
import javax.inject.Inject;
+import org.eclipse.core.runtime.IProgressMonitor;
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.taxeditor.session.ICdmEntitySessionEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
/**
*/
public class CharacterEditor
implements ICdmEntitySessionEnabled, ISelectionChangedListener, ModifyListener, IE4ViewerPart
- , IPartContentHasDetails, IPartContentHasSupplementalData{
+ , IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart{
private FeatureTreeEditorComposite characterTreeEditorComposite;
private FeatureTreeEditorComposite propertiesTreeEditorComposite;
});
}
+ @Override
@Persist
- public void save(){
+ public void save(IProgressMonitor monitor){
if (!conversation.isBound()) {
conversation.bind();
}
taxon.addMisappliedName(misapplication, null, null);
- operation = new DeleteMisapplicationOperation("", undoContext, null, null, taxon, misapplication, postOperation, null, null);
+ operation = new DeleteMisapplicationOperation("", undoContext, null, taxon, misapplication, postOperation, null, null);
}
taxon.addSynonym(synonym, synonymType);
- operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), null, taxon,synonym, postOperation, null, null);
+ operation = new DeleteSynonymOperation("", undoContext, new SynonymDeletionConfigurator(), taxon,synonym, postOperation, null, null);
}
<feature
id="eu.etaxonomy.taxeditor.feature.platform"
label="Taxeditor Dependencies"
- version="4.10.0"
+ version="4.11.0"
os="linux,macosx,win32"
ws="cocoa,gtk,win32"
arch="x86,x86_64">
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</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.10.0"
+ version="4.11.0"
provider-name="EDIT"
plugin="eu.etaxonomy.taxeditor.application"
os="linux,macosx,win32"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</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.10.0
+Bundle-Version: 4.11.0
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.10.0</version>
+ <version>4.11.0</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.10.0
+Bundle-Version: 4.11.0
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.10.0</version>
+ <version>4.11.0</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.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.databinding.property;bundle-version="1.4.0",
org.eclipse.e4.core.di.annotations,
org.eclipse.e4.ui.services,
- org.eclipse.e4.ui.model.workbench
+ org.eclipse.e4.ui.model.workbench,
+ org.eclipse.e4.ui.workbench,
+ org.eclipse.e4.ui.di
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
command.name.EXPORT_SEQUENCE_TO_FILE = Alignmentdatei exportieren
command.name.CUT_PHEROGRAM_LEFT = Pherogramm links abschneiden
command.name.CUT_PHEROGRAM_RIGHT = Pherogramm rechts abschneiden
-command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Ausgewählte Spalten reverse complementen
+command.name.REVERSE_COMPLEMENT_SELECTED_ROWS = Ausgewählte Zeilen reverse complementen
command.name.CREATE_CONSENUS_SEQUENCE = Konsensussequenz (neu) erzeugen
command.name.UPDATE_CONSENSUS_SEQUENCE = Konsensussequenz aktualisieren
command.name.TOGGLE_SHOW_PROBABILITY_VALUES = Anzeige von Wahrscheinlichkeiten umschalten
<?xml version="1.0" encoding="ASCII"?>
-<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+ <imports xsi:type="commands:Command" xmi:id="_q2vnsKUDEeejf7ggYkp-TA" elementId="org.eclipse.ui.edit.copy"/>
+ <imports xsi:type="commands:Command" xmi:id="_rlhZQKUDEeejf7ggYkp-TA" elementId="org.eclipse.ui.edit.cut"/>
+ <imports xsi:type="commands:Command" xmi:id="_tLkxEKUDEeejf7ggYkp-TA" elementId="org.eclipse.ui.edit.paste"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_JZdQ0H2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.editSequence" commandName="%command.EDIT_SEQUENCE"/>
<elements xsi:type="commands:Command" xmi:id="_IXQocH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.exportSequenceToFile" commandName="%command.label.EXPORT_SEQUENCE_TO_FILE"/>
<elements xsi:type="commands:Command" xmi:id="_m9gZAH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.showPherogram" commandName="%command.name.SHOW_PHEROGRAM"/>
+ <elements xsi:type="commands:Command" xmi:id="_YLPrgKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft" commandName="%command.name.CUT_PHEROGRAM_LEFT"/>
+ <elements xsi:type="commands:Command" xmi:id="_akezwKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight" commandName="%command.name.CUT_PHEROGRAM_RIGHT"/>
+ <elements xsi:type="commands:Command" xmi:id="_cnIoAKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows" commandName="%command.name.REVERSE_COMPLEMENT_SELECTED_ROWS"/>
+ <elements xsi:type="commands:Command" xmi:id="_d28DAKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus" commandName="%command.name.CREATE_CONSENUS_SEQUENCE"/>
+ <elements xsi:type="commands:Command" xmi:id="_gnsTYKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus" commandName="%command.name.UPDATE_CONSENSUS_SEQUENCE"/>
+ <elements xsi:type="commands:Command" xmi:id="_h1lC0KT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities" commandName="%command.name.TOGGLE_SHOW_PROBABILITY_VALUES"/>
+ <elements xsi:type="commands:Command" xmi:id="_j-w84KT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines" commandName="%command.name.TOGGLE_SHOW_BASE_CALL_LINES"/>
+ <elements xsi:type="commands:Command" xmi:id="_lyJmEKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput" commandName="%command.name.CHANGE_QUALITY_OUTPUT"/>
+ <elements xsi:type="commands:Command" xmi:id="_ncVP8KT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram" commandName="%command.name.LOAD_PHEROGRAM"/>
+ <elements xsi:type="commands:Command" xmi:id="_pfKDUKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite" commandName="%command.name.TOGGLE_INSERT_OVERWRITE"/>
+ <elements xsi:type="commands:Command" xmi:id="_rz8wcKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion" commandName="%command.name.TOGGLE_LEFT_RIGHT_INSERTION"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_RCmzgH2sEeeVL5aZ55YsWA" featurename="handlers" parentElementId="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView">
- <elements xsi:type="commands:Handler" xmi:id="_XuBioH2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handler.EditSequenceHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.handler.EditSequenceHandler" command="_JZdQ0H2sEeeVL5aZ55YsWA"/>
- <elements xsi:type="commands:Handler" xmi:id="_QwuNwH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handler.ExportSequenceToFileHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.handler.ExportSequenceToFileHandler" command="_IXQocH22EeeVL5aZ55YsWA"/>
- <elements xsi:type="commands:Handler" xmi:id="_reIrkH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler" command="_m9gZAH22EeeVL5aZ55YsWA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_XuBioH2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.EditSequenceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.EditSequenceHandlerE4" command="_JZdQ0H2sEeeVL5aZ55YsWA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_QwuNwH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ExportSequenceToFileHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ExportSequenceToFileHandlerE4" command="_IXQocH22EeeVL5aZ55YsWA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_reIrkH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ShowPherogramHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ShowPherogramHandlerE4" command="_m9gZAH22EeeVL5aZ55YsWA"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_o08AQH2sEeeVL5aZ55YsWA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.editor.popupmenu.specimeneditor" positionInList="before:eu.etaxonomy.taxeditor.editor.menuseparator.beforeDelete">
<elements xsi:type="menu:HandledMenuItem" xmi:id="_txARoH2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabeledit_sequence" label="%command.label.EDIT_SEQUENCE" command="_JZdQ0H2sEeeVL5aZ55YsWA"/>
<elements xsi:type="menu:HandledMenuItem" xmi:id="_VRC-UH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabelexport_sequence_to_file" label="%command.label.EXPORT_SEQUENCE_TO_FILE" command="_IXQocH22EeeVL5aZ55YsWA"/>
<elements xsi:type="menu:HandledMenuItem" xmi:id="_xftzgH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandnameshow_pherogram" label="%command.name.SHOW_PHEROGRAM" command="_m9gZAH22EeeVL5aZ55YsWA"/>
</fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_paaYIKT5Eeejf7ggYkp-TA" featurename="descriptors" parentElementId="xpath:/">
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_sAK5cKT5Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4" label="%editor.ALIGNMENT_EDITOR" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4">
+ <handlers xmi:id="_8S4OwKUAEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.UpdateConsensusSequenceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.UpdateConsensusSequenceHandlerE4" command="_gnsTYKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="__mR5MKUAEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CreateConsensusSequenceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CreateConsensusSequenceHandlerE4" command="_d28DAKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_DD3aYKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ReverseComplementHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ReverseComplementHandlerE4" command="_cnIoAKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_FoONgKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CutPherogramRightHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CutPherogramRightHandlerE4" command="_akezwKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_I78oEKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CutPherogramLeftHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.CutPherogramLeftHandlerE4" command="_YLPrgKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_NLSWUKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleLeftRightInsertionHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleLeftRightInsertionHandlerE4" command="_rz8wcKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_WV0zQKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleInsertOverwriteHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleInsertOverwriteHandlerE4" command="_pfKDUKT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_ar1KMKUBEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.LoadPherogramHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.LoadPherogramHandlerE4" command="_ncVP8KT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_myRFoKUDEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorCutHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorCutHandlerE4" command="_rlhZQKUDEeejf7ggYkp-TA"/>
+ <handlers xmi:id="_vvnbIKUDEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorCopyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorCopyHandlerE4" command="_q2vnsKUDEeejf7ggYkp-TA"/>
+ <handlers xmi:id="_x70M8KUDEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorPasteHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.AlignmentEditorPasteHandlerE4" command="_tLkxEKUDEeejf7ggYkp-TA"/>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_v8GjgKT5Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4" label="%view.PHEROGRAM_VIEW" allowMultiple="true" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4">
+ <handlers xmi:id="_6ioEAKT-Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleShowPherogramProbabilitiesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleShowPherogramProbabilitiesHandlerE4" command="_h1lC0KT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_-IewYKT-Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleShowPherogramBaseCallLinesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleShowPherogramBaseCallLinesHandlerE4" command="_j-w84KT7Eeejf7ggYkp-TA"/>
+ <handlers xmi:id="_36J7AKUAEeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ChangePherogramQualityOutputTypeE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ChangePherogramQualityOutputTypeE4" command="_lyJmEKT7Eeejf7ggYkp-TA"/>
+ </elements>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1hS_gKT7Eeejf7ggYkp-TA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu">
+ <elements xsi:type="menu:Menu" xmi:id="_nWX8cKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.menu.editoralignment_editor" label="%editor.ALIGNMENT_EDITOR">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wWCx4KUXEeejf7ggYkp-TA" coreExpressionId="isAlignmentEditor"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="__HWTwKT7Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.loadpherogram" label="%command.name.LOAD_PHEROGRAM" command="_ncVP8KT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_J3mKQKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.cutleft" label="%command.name.CUT_PHEROGRAM_LEFT" command="_YLPrgKT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_OCpOYKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.cutright" label="%command.name.CUT_PHEROGRAM_RIGHT" command="_akezwKT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_PYK24KT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.reversecomplement" label="%command.name.REVERSE_COMPLEMENT_SELECTED_ROWS" command="_cnIoAKT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_RRcFoKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.createconsensus" label="%command.name.CREATE_CONSENUS_SEQUENCE" command="_d28DAKT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_TUGg8KT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.alignmenteditor.updateconsensus" label="%command.name.UPDATE_CONSENSUS_SEQUENCE" command="_gnsTYKT7Eeejf7ggYkp-TA"/>
+ </elements>
+ <elements xsi:type="menu:Menu" xmi:id="_yuMJQKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.menu.viewpherogram_view" label="%view.PHEROGRAM_VIEW">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_45_BMKjuEeejedk4mZQIGw" coreExpressionId="isPherogramView"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_0r-EkKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.pherogrameditor.changeQuality" label="%command.name.CHANGE_QUALITY_OUTPUT" command="_lyJmEKT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_7_ShMKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.pherogrameditor.toggleProbabilities" label="%command.name.TOGGLE_SHOW_PROBABILITY_VALUES" command="_h1lC0KT7Eeejf7ggYkp-TA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_93JasKT8Eeejf7ggYkp-TA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.mainmenu.pherogrameditor.toggleBaseCallLines" label="%command.name.TOGGLE_SHOW_BASE_CALL_LINES" command="_j-w84KT7Eeejf7ggYkp-TA"/>
+ </elements>
+ </fragments>
</fragment:ModelFragments>
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor"
- default="false"
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor"
- name="%editor.ALIGNMENT_EDITOR">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart"
- id="eu.etaxonomy.taxeditor.molecular.PherogramView"
- name="%view.PHEROGRAM_VIEW"
- restorable="true">
- </view>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
- name="%command.name.CUT_PHEROGRAM_LEFT">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
- name="%command.name.CUT_PHEROGRAM_RIGHT">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows"
- name="%command.name.REVERSE_COMPLEMENT_SELECTED_ROWS">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus"
- name="%command.name.CREATE_CONSENUS_SEQUENCE">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus"
- name="%command.name.UPDATE_CONSENSUS_SEQUENCE">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities"
- name="%command.name.TOGGLE_SHOW_PROBABILITY_VALUES">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines"
- name="%command.name.TOGGLE_SHOW_BASE_CALL_LINES">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
- name="%command.name.CHANGE_QUALITY_OUTPUT">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
- name="%command.name.LOAD_PHEROGRAM">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"
- name="%command.name.TOGGLE_INSERT_OVERWRITE">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"
- name="%command.name.TOGGLE_LEFT_RIGHT_INSERTION">
- </command>
- </extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
</command>
</toolbar>
</menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="menu:org.eclipse.ui.main.menu">
- <menu
- label="%menu.ALIGNMENT_EDITOR">
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
- name="Cut pherogram left">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
- id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows"
- mnemonic="r"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus"
- style="push">
- </command>
- <visibleWhen
- checkEnabled="true">
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
- </equals>
- </with>
- </visibleWhen>
- </menu>
- <menu
- label="%menu.label.PHEROGRAM_VIEW">
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines"
- style="push">
- </command>
- <visibleWhen
- checkEnabled="true">
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.PherogramView">
- </equals>
- </with>
- </visibleWhen>
- </menu>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.LoadPherogramHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.CutPherogramLeftHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.CutPherogramRightHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ReverseComplementHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.CreateConsensusSequenceHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.UpdateConsensusSequenceHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ToggleShowPherogramProbabilitiesHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ToggleShowPherogramBaseCallLinesHandler"
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.ChangePherogramQualityOutputType"
- commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.AlignmentEditorCopyHandler"
- commandId="org.eclipse.ui.edit.copy">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.AlignmentEditorCutHandler"
- commandId="org.eclipse.ui.edit.cut">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.molecular.handler.AlignmentEditorPasteHandler"
- commandId="org.eclipse.ui.edit.paste">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
- </equals>
- </with>
- </activeWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <scheme
- description="%scheme.description"
- id="eu.etaxonomy.taxeditor.bindings.scheme.default"
- name="%scheme.name">
- </scheme>
- <key
- commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
- schemeId="eu.etaxonomy.taxeditor.bindings.scheme.default"
- sequence="M1+O">
- </key>
</extension>
<extension
id="id1"
uri="fragment.e4xmi">
</fragment>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.definitions">
+ <definition
+ id="isAlignmentEditor">
+ <with
+ variable="activePartId">
+ <equals
+ value="eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4">
+ </equals>
+ </with>
+ </definition>
+ <definition
+ id="isPherogramView">
+ <with
+ variable="activePartId">
+ <equals
+ value="eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4">
+ </equals>
+ </with>
+ </definition>
+ </extension>
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList;
import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer;
+import info.bioinfweb.libralign.pherogram.model.PherogramAlignmentRelation;
import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel;
import info.bioinfweb.libralign.pherogram.model.ShiftChange;
import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider;
String sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
PherogramArea area = getPherogramArea(sequenceID);
PherogramAreaModel pherogramAlignmentModel = area.getModel();
+
+ PherogramAlignmentRelation rightRelation = pherogramAlignmentModel.editableIndexByBaseCallIndex(
+ pherogramAlignmentModel.getRightCutPosition());
+ int rightBorder;
+ if (rightRelation.getCorresponding() == PherogramAlignmentRelation.OUT_OF_RANGE) {
+ rightBorder = rightRelation.getBeforeValidIndex() + 1;
+ }
+ else {
+ rightBorder = rightRelation.getAfterValidIndex();
+ }
+
AlignmentModelUtils.reverseComplement(model, sequenceID,
pherogramAlignmentModel.editableIndexByBaseCallIndex(
pherogramAlignmentModel.getLeftCutPosition()).getBeforeValidIndex(),
- pherogramAlignmentModel.editableIndexByBaseCallIndex(
- pherogramAlignmentModel.getRightCutPosition()).getAfterValidIndex());
+ rightBorder);
pherogramAlignmentModel.reverseComplement();
}
}
/**
* Recreates the whole consensus sequence from all single read sequences. The previous consensus
- * sequence is overwritte.
+ * sequence is overwritten.
*/
@SuppressWarnings("unchecked")
public <T> void createConsensusSequence() {
import java.util.List;
import java.util.UUID;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
import eu.etaxonomy.cdm.model.molecular.Sequence;
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @author Ben Stöver
* @date 04.08.2014
*/
-public class AlignmentEditorInput extends CdmEntitySessionInput implements IEditorInput {
- private static final String name = Messages.AlignmentEditorInput_EDITOR_NAME;
-
+public class AlignmentEditorInput extends CdmEntitySessionInput {
private final UUID sequenceNodeUuid;
private Sequence sequenceNode;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- */
- @Override
- public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#exists()
- */
- @Override
- public boolean exists() {
- // TODO Auto-generated method stub
- return false;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
- */
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return name;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getPersistable()
- */
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return name;
- }
-
-
/**
* Returns the {@link UUID} of the sequence CDM node that should be edited by the {@link AlignmentEditor} this object
* is used with.
@Override
public void merge() {
CdmStore.getService(ISequenceService.class).merge(sequenceNode, true);
-
+
}
}
--- /dev/null
+/**
+* Copyright (C) 2014 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.molecular.editor.e4;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.biojava.bio.chromatogram.ChromatogramFactory;
+import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
+import org.eclipse.core.runtime.IProgressMonitor;
+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.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.media.MediaUtils;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SequenceString;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorActionUpdater;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramMouseListener;
+import eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler;
+import eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import info.bioinfweb.commons.swt.SWTUtils;
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
+import info.bioinfweb.libralign.alignmentarea.tokenpainter.NucleotideTokenPainter;
+import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea;
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.libralign.dataarea.implementations.sequenceindex.SequenceIndexArea;
+import info.bioinfweb.libralign.editsettings.EditSettingsChangeEvent;
+import info.bioinfweb.libralign.editsettings.EditSettingsListener;
+import info.bioinfweb.libralign.model.AlignmentModel;
+import info.bioinfweb.libralign.model.AlignmentModelChangeListener;
+import info.bioinfweb.libralign.model.adapters.StringAdapter;
+import info.bioinfweb.libralign.model.events.SequenceChangeEvent;
+import info.bioinfweb.libralign.model.events.SequenceRenamedEvent;
+import info.bioinfweb.libralign.model.events.TokenChangeEvent;
+import info.bioinfweb.libralign.model.implementations.PackedAlignmentModel;
+import info.bioinfweb.libralign.model.tokenset.CharacterTokenSet;
+import info.bioinfweb.libralign.model.tokenset.TokenSet;
+import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
+import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList;
+import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer;
+import info.bioinfweb.libralign.pherogram.model.PherogramAlignmentRelation;
+import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel;
+import info.bioinfweb.libralign.pherogram.model.ShiftChange;
+import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider;
+import info.bioinfweb.libralign.pherogram.provider.PherogramProvider;
+import info.bioinfweb.libralign.pherogram.provider.ReverseComplementPherogramProvider;
+import info.bioinfweb.tic.SWTComponentFactory;
+
+
+
+/**
+ * Editor component to edit a contig alignment used to combine different overlapping pherograms from Sanger sequencing to
+ * a consensus sequence.
+ * <p>
+ * The contained GUI components used to edit the alignment come from <a href="http://bioinfweb.info/LibrAlign/">LibrAlign</a>.
+ *
+ * @author Ben Stöver
+ * @author pplitzner
+ * @date 04.08.2014
+ */
+public class AlignmentEditorE4 {
+ public static final String ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor"; //$NON-NLS-1$
+
+ public static final int READS_AREA_INDEX = 1;
+ public static final int EDITABLE_CONSENSUS_AREA_INDEX = READS_AREA_INDEX + 1;
+ public static final int CONSENSUS_HINT_AREA_INDEX = EDITABLE_CONSENSUS_AREA_INDEX + 1;
+ public static final int PHEROGRAM_AREA_INDEX = 0;
+ public static final int CONSENSUS_DATA_AREA_INDEX = 0;
+ public static final String DEFAULT_READ_NAME_PREFIX = "Read "; //$NON-NLS-1$
+ public static final String CONSENSUS_NAME = "Consensus"; //$NON-NLS-1$
+
+
+ private ConversationHolder conversationHolder;
+ private final AlignmentModelChangeListener DIRTY_LISTENER = new AlignmentModelChangeListener() {
+ @Override
+ public <T> void afterTokenChange(TokenChangeEvent<T> e) {
+ setDirty();
+ }
+
+ @Override
+ public <T> void afterSequenceRenamed(SequenceRenamedEvent<T> e) {
+ setDirty();
+ }
+
+ @Override
+ public <T> void afterSequenceChange(SequenceChangeEvent<T> e) {
+ setDirty();
+ }
+
+ @Override
+ public <T, U> void afterProviderChanged(AlignmentModel<T> oldProvider,
+ AlignmentModel<U> newProvider) { // Not expected.
+
+ setDirty();
+ }
+ };
+ private final AlignmentEditorActionUpdater ACTION_UPDATER = new AlignmentEditorActionUpdater();
+ public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent()); //TODO Move to global EDITor class.
+
+
+ private MultipleAlignmentsContainer alignmentsContainer = null;
+ private final Map<String, SingleReadAlignment> cdmMap = new TreeMap<String, SingleReadAlignment>(); //TODO Move this to ContigSequenceDataProvider
+
+
+ @Inject
+ private MDirtyable dirty;
+
+ private AlignmentEditorInput input;
+
+ @Inject
+ public AlignmentEditorE4() {
+ }
+
+
+ private void refreshToolbarElement(String id) {
+ ICommandService commandService =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
+ if (commandService != null) {
+ commandService.refreshElements(id, Collections.EMPTY_MAP);
+ }
+ }
+
+
+ private void registerEditSettingListener(MultipleAlignmentsContainer container) {
+ container.getEditSettings().addListener(new EditSettingsListener() {
+ @Override
+ public void workingModeChanged(EditSettingsChangeEvent e) {} // Currently nothing to do
+
+ @Override
+ public void insertLeftInDataAreaChanged(EditSettingsChangeEvent e) {
+ updateStatusBar();
+ refreshToolbarElement(ToggleLeftRightInsertionHandler.COMMAND_ID);
+ }
+
+ @Override
+ public void insertChanged(EditSettingsChangeEvent e) {
+ updateStatusBar();
+ refreshToolbarElement(ToggleInsertOverwriteHandler.COMMAND_ID);
+ }
+ });
+ }
+
+
+ private AlignmentArea createIndexArea(MultipleAlignmentsContainer container, AlignmentArea labeledArea) {
+ AlignmentArea result = new AlignmentArea(container);
+ result.setAllowVerticalScrolling(false);
+ result.getDataAreas().getTopAreas().add(new SequenceIndexArea(result.getContentArea(), labeledArea));
+ return result;
+ }
+
+
+ private AlignmentArea createEditableAlignmentArea(MultipleAlignmentsContainer container, boolean allowVerticalScrolling) {
+ AlignmentArea result = new AlignmentArea(container);
+ result.setAllowVerticalScrolling(allowVerticalScrolling);
+
+ CharacterTokenSet tokenSet = CharacterTokenSet.newDNAInstance(); //TODO Should NUCLEOTIDE be used instead?
+ AlignmentModel<Character> model = new PackedAlignmentModel<Character>(tokenSet);
+ result.setAlignmentModel(model, false);
+ model.getChangeListeners().add(DIRTY_LISTENER);
+ result.getPaintSettings().getTokenPainterList().set(0, new NucleotideTokenPainter());
+
+ return result;
+ }
+
+
+ private AlignmentArea createConsensusHintArea(MultipleAlignmentsContainer container,
+ AlignmentArea labeledArea) {
+
+ AlignmentArea result = new AlignmentArea(container);
+ result.setAllowVerticalScrolling(false);
+ result.getDataAreas().getBottomAreas().add(
+ new ConsensusSequenceArea(result.getContentArea(), labeledArea));
+ return result;
+ }
+
+
+ private MultipleAlignmentsContainer getAlignmentsContainer() {
+ if (alignmentsContainer == null) {
+ alignmentsContainer = new MultipleAlignmentsContainer();
+
+ AlignmentAreaList list = alignmentsContainer.getAlignmentAreas();
+ AlignmentArea readsArea = createEditableAlignmentArea(alignmentsContainer, true);
+ readsArea.getSelection().addSelectionListener(ACTION_UPDATER);
+ list.add(createIndexArea(alignmentsContainer, readsArea));
+ list.add(readsArea); // Make sure READS_AREA_INDEX is correct.
+ AlignmentArea editableConsensusArea = createEditableAlignmentArea(alignmentsContainer, false);
+ editableConsensusArea.getSelection().addSelectionListener(ACTION_UPDATER);
+ list.add(editableConsensusArea); // Make sure COMSENSUS_AREA_INDEX is correct.
+ list.add(createConsensusHintArea(alignmentsContainer, readsArea));
+
+ registerEditSettingListener(alignmentsContainer);
+ }
+ return alignmentsContainer;
+ }
+
+
+ public AlignmentArea getReadsArea() {
+ return getAlignmentsContainer().getAlignmentAreas().get(READS_AREA_INDEX);
+ }
+
+
+ public AlignmentArea getEditableConsensusArea() {
+ return getAlignmentsContainer().getAlignmentAreas().get(EDITABLE_CONSENSUS_AREA_INDEX);
+ }
+
+
+ /**
+ * Checks whether {@link #getReadsArea()} or {@link #getEditableConsensusArea()} currently
+ * have the user focus and returns the according component.
+ *
+ * @return either the reads or the consensus alignment area or {@code null} if none of these
+ * components is currently focused
+ */
+ public AlignmentArea getFocusedArea() {
+ AlignmentArea result = getReadsArea();
+ if (hasFocus(result)) {
+ return result;
+ }
+ else {
+ result = getEditableConsensusArea();
+ if (hasFocus(result)) {
+ return result;
+ }
+ else {
+ return null;
+ }
+ }
+ }
+
+
+ /**
+ * Checks whether the specified alignment area or one of its subcomponents currently has the
+ * focus.
+ *
+ * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or
+ * {@link #getEditableConsensusArea()}.)
+ * @return {@code true} if the specified component is focused and is either equal to
+ * {@link #getReadsArea()} or {@link #getEditableConsensusArea()}or {@code false} otherwise
+ */
+ private boolean hasFocus(AlignmentArea area) {
+ return SWTUtils.childHasFocus((Composite)area.getToolkitComponent());
+ }
+
+
+ public boolean hasPherogram(String sequenceID) {
+ return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX;
+ }
+
+
+ public PherogramArea getPherogramArea(String sequenceID) {
+ if (hasPherogram(sequenceID)) {
+ return (PherogramArea)getReadsArea().getDataAreas().getSequenceAreas(sequenceID).get(PHEROGRAM_AREA_INDEX);
+ }
+ else {
+ return null;
+ }
+ }
+
+
+ private ConsensusSequenceArea getConsensusHintDataArea() {
+ return (ConsensusSequenceArea)getAlignmentsContainer().getAlignmentAreas().
+ get(CONSENSUS_HINT_AREA_INDEX).getDataAreas().getBottomAreas().
+ get(CONSENSUS_DATA_AREA_INDEX);
+ }
+
+
+ @Deprecated //TODO Remove as soon as testing period is over
+ private void createTestContents() {
+ // Just for testing:
+ try {
+ addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI(), false); //$NON-NLS-1$
+ //addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1").toURI(), false);
+ addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/Test_qualityScore.scf").toURI(), false); //$NON-NLS-1$
+
+ // Add test consensus sequence:
+ AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
+ String id = consensusModel.addSequence(CONSENSUS_NAME);
+ Collection<Object> tokens = new ArrayList<Object>(); // First save tokens in a collection to avoid GUI updated for each token.
+ tokens.add(consensusModel.getTokenSet().tokenByRepresentation("A")); //$NON-NLS-1$
+ tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C")); //$NON-NLS-1$
+ tokens.add(consensusModel.getTokenSet().tokenByRepresentation("G")); //$NON-NLS-1$
+ tokens.add(consensusModel.getTokenSet().tokenByRepresentation("T")); //$NON-NLS-1$
+ consensusModel.insertTokensAt(id, 0, tokens);
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ private void readCDMData(Sequence sequenceNode) {
+ //TODO If called from somewhere else than createPartControl() the editorInput needs to be checked and previous contents need to be cleared (or updated).
+
+ // Add reads:
+ for (SingleReadAlignment singleReadAlignment : sequenceNode.getSingleReadAlignments()) {
+ try {
+ SingleRead pherogramInfo = singleReadAlignment.getSingleRead();
+ String id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
+ getPherogramURI(pherogramInfo),
+ singleReadAlignment.isReverseComplement(),
+ singleReadAlignment.getEditedSequence(),
+ singleReadAlignment.getFirstSeqPosition(),
+ singleReadAlignment.getLeftCutPosition(),
+ singleReadAlignment.getRightCutPosition(),
+ singleReadAlignment.getShifts());
+ cdmMap.put(id, singleReadAlignment);
+ }
+ catch (Exception e) { // Usually due to an error while trying to read the pherogram (e.g. due to an unsupported format or an invalid URI).
+ MessagingUtils.errorDialog(Messages.AlignmentEditor_ERROR_SINGLE_READ, null, Messages.AlignmentEditor_ERROR_SINGLE_READ_MESSAGE +
+ e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);
+ }
+ }
+
+ // Set consensus sequence:
+ AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
+ String id = consensusModel.addSequence(CONSENSUS_NAME);
+ consensusModel.insertTokensAt(id, 0, AlignmentModelUtils.charSequenceToTokenList(
+ sequenceNode.getConsensusSequence().getString(), consensusModel.getTokenSet()));
+ //TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
+ }
+
+
+ @PostConstruct
+ public void createPartControl(Composite parent) {
+ if (CdmStore.isActive()){
+ if(conversationHolder == null){
+ conversationHolder = CdmStore.createConversation();
+ }
+ }
+ else{
+ return;
+ }
+ SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
+ Display.getCurrent().addFilter(SWT.FocusIn, ACTION_UPDATER);
+ Display.getCurrent().addFilter(SWT.FocusOut, ACTION_UPDATER);
+ }
+
+
+ @PreDestroy
+ public void dispose() {
+ Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER);
+ Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER);
+ CLIPBOARD.dispose();
+ input.dispose();
+ }
+
+
+ private void updateStatusBar() {
+ //FIXME E4 migrate
+// IActionBars bars = getEditorSite().getActionBars();
+// bars.getStatusLineManager().setMessage(
+// Messages.AlignmentEditor_EDIT_MODE + (getReadsArea().getEditSettings().isInsert() ? Messages.AlignmentEditor_INSERT : Messages.AlignmentEditor_OVERWRITE) + " " + //$NON-NLS-1$
+// Messages.AlignmentEditor_INSERTION_PHEROGRAM +
+// (getReadsArea().getEditSettings().isInsertLeftInDataArea() ? Messages.AlignmentEditor_LEFT : Messages.AlignmentEditor_RIGHT)); //TODO multi language
+ }
+
+
+ private SingleReadAlignment.Shift[] convertToCDMShifts(PherogramAreaModel model) {
+ Iterator<ShiftChange> iterator = model.shiftChangeIterator();
+ List<SingleReadAlignment.Shift> shifts = new ArrayList<SingleReadAlignment.Shift>();
+ while (iterator.hasNext()) {
+ ShiftChange shiftChange = iterator.next();
+ shifts.add(new SingleReadAlignment.Shift(shiftChange.getBaseCallIndex(), shiftChange.getShiftChange()));
+ }
+ return shifts.toArray(new SingleReadAlignment.Shift[shifts.size()]);
+ }
+
+
+ @Persist
+ public void doSave(IProgressMonitor monitor) {
+ String taskName = Messages.AlignmentEditor_SAVING_ALIGNMENT; //TODO multi language
+ monitor.beginTask(taskName, 3);
+
+ //re-loading sequence to avoid session conflicts
+ Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(input.getSequenceNodeUuid());
+ input.setSequenceNode(sequenceNode);
+ StringAdapter stringProvider = new StringAdapter(getEditableConsensusArea().getAlignmentModel(), false); // Throws an exception if a token has more than one character.
+
+ // Write consensus sequence:
+ SequenceString consensusSequenceObj = sequenceNode.getConsensusSequence();
+ String newConsensusSequence = stringProvider.getSequence(
+ getEditableConsensusArea().getAlignmentModel().sequenceIDByName(CONSENSUS_NAME));
+ if (consensusSequenceObj == null) {
+ sequenceNode.setConsensusSequence(SequenceString.NewInstance(newConsensusSequence));
+ }
+ else {
+ consensusSequenceObj.setString(newConsensusSequence);
+ }
+
+ // Write single reads:
+ stringProvider.setUnderlyingModel(getReadsArea().getAlignmentModel());
+ sequenceNode.getSingleReadAlignments().retainAll(cdmMap.values()); // Remove all reads that are not in the alignment anymore.
+ Iterator<String> iterator = getReadsArea().getAlignmentModel().sequenceIDIterator();
+ while (iterator.hasNext()) {
+ String id = iterator.next();
+ SingleReadAlignment singleRead = cdmMap.get(id);
+ if (singleRead == null) {
+ throw new InternalError(Messages.AlignmentEditor_NEW_READ_FAILURE); //TODO multi language
+ //TODO Create new read object. => Shall it be allowed to add reads in the alignment editor which are not represented in the CDM tree before the alignment editor is saved?
+ //singleRead = SingleReadAlignment.NewInstance(consensusSequence, singleRead, shifts, editedSequence);
+ }
+
+ singleRead.setEditedSequence(stringProvider.getSequence(id));
+
+ PherogramArea pherogramArea = getPherogramArea(id);
+ if (pherogramArea != null) {
+ PherogramAreaModel model = pherogramArea.getModel();
+ singleRead.setReverseComplement(model.getPherogramProvider() instanceof ReverseComplementPherogramProvider); // Works only if ReverseComplementPherogramProvider instances are not nested.
+ singleRead.setShifts(convertToCDMShifts(getPherogramArea(id).getModel()));
+ singleRead.setFirstSeqPosition(model.getFirstSeqPos());
+ singleRead.setLeftCutPosition(model.getLeftCutPosition());
+ singleRead.setRightCutPosition(model.getRightCutPosition());
+ }
+ }
+
+ if (!conversationHolder.isBound()) {
+ conversationHolder.bind();
+ }
+ monitor.worked(1);
+
+ input.merge();
+ // Commit the conversation and start a new transaction immediately:
+ conversationHolder.commit(true);
+ monitor.worked(1);
+
+ dirty.setDirty(false);
+ monitor.worked(1);
+ monitor.done();
+ }
+
+
+ public void init(AlignmentEditorInput input) throws PartInitException {
+ this.input = input;
+
+ updateStatusBar();
+
+ if (input.getSequenceNodeUuid() != null) {
+ Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(input.getSequenceNodeUuid());
+ //re-load into the current session if it is already persisted in the DB
+ if(sequenceNode!=null && sequenceNode.getId()!=0){
+ sequenceNode = CdmStore.getService(ISequenceService.class).load(sequenceNode.getUuid());
+ }
+ readCDMData(sequenceNode);
+ }
+ else {
+ createTestContents(); // This case will removed after the test phase and an exception should probably be thrown.
+ }
+ }
+
+
+ public boolean isDirty() {
+ return dirty.isDirty();
+ }
+
+
+ private void setDirty() {
+ dirty.setDirty(true);
+ }
+
+
+ @Focus
+ public void setFocus() {
+ if(conversationHolder != null){
+ conversationHolder.bind();
+ }
+ if(input!=null){
+ input.bind();
+ }
+ }
+
+ public boolean isInsertMode() {
+ return getAlignmentsContainer().getEditSettings().isInsert();
+ }
+
+
+ public boolean isInsertLeftInPherogram() {
+ return getAlignmentsContainer().getEditSettings().isInsertLeftInDataArea();
+ }
+
+
+ public void toggleLeftRightInsertionInPherogram() {
+ getAlignmentsContainer().getEditSettings().toggleInsertLeftInDataArea();
+ }
+
+
+ public void toggleInsertOverwrite() {
+ getAlignmentsContainer().getEditSettings().toggleInsert();
+ }
+
+
+ private String cutPherogram(boolean left) {
+ SelectionModel selection = getReadsArea().getSelection();
+ if (selection.getCursorHeight() != 1) {
+ return Messages.AlignmentEditor_CUTTING_FAILURE; //TODO multi language
+ }
+ else {
+ PherogramArea pherogramArea =
+ getPherogramArea(getReadsArea().getSequenceOrder().idByIndex(selection.getCursorRow()));
+ if (pherogramArea == null) {
+ return Messages.AlignmentEditor_NO_ATTACHED_PHEROGRAM; //TODO multi language
+ }
+ else {
+ if (left) {
+ if (pherogramArea.setLeftCutPositionBySelection()) {
+ return null;
+ }
+ else {
+ return Messages.AlignmentEditor_LEFT_END_OUTSIDE; //TODO multi language
+ }
+ }
+ else {
+ if (pherogramArea.setRightCutPositionBySelection()) {
+ return null;
+ }
+ else {
+ return Messages.AlignmentEditor_RIGHT_END_OUTSIDE; //TODO multi language
+ }
+ }
+ }
+ }
+ }
+
+
+ public String cutPherogramLeft() {
+ return cutPherogram(true);
+ }
+
+
+ public String cutPherogramRight() {
+ return cutPherogram(false);
+ }
+
+
+ public void reverseComplementSelectedSequences() {
+ SelectionModel selection = getReadsArea().getSelection();
+ AlignmentModel<?> model = getReadsArea().getAlignmentModel();
+ for (int row = selection.getFirstRow(); row < selection.getFirstRow() + selection.getCursorHeight(); row++) {
+ String sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
+ PherogramArea area = getPherogramArea(sequenceID);
+ PherogramAreaModel pherogramAlignmentModel = area.getModel();
+
+ PherogramAlignmentRelation rightRelation = pherogramAlignmentModel.editableIndexByBaseCallIndex(
+ pherogramAlignmentModel.getRightCutPosition());
+ int rightBorder;
+ if (rightRelation.getCorresponding() == PherogramAlignmentRelation.OUT_OF_RANGE) {
+ rightBorder = rightRelation.getBeforeValidIndex() + 1;
+ }
+ else {
+ rightBorder = rightRelation.getAfterValidIndex();
+ }
+
+ AlignmentModelUtils.reverseComplement(model, sequenceID,
+ pherogramAlignmentModel.editableIndexByBaseCallIndex(
+ pherogramAlignmentModel.getLeftCutPosition()).getBeforeValidIndex(),
+ rightBorder);
+ pherogramAlignmentModel.reverseComplement();
+ }
+ }
+
+
+ /**
+ * Recreates the whole consensus sequence from all single read sequences. The previous consensus
+ * sequence is overwritten.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void createConsensusSequence() {
+ ConsensusSequenceArea area = getConsensusHintDataArea();
+ AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
+ String sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
+ int length = getReadsArea().getAlignmentModel().getMaxSequenceLength();
+
+ Collection<T> tokens = new ArrayList<T>(length);
+ for (int column = 0; column < length; column++) {
+ tokens.add(model.getTokenSet().tokenByRepresentation(area.getConsensusToken(column)));
+ }
+
+ model.removeTokensAt(sequenceID, 0, model.getSequenceLength(sequenceID));
+ model.insertTokensAt(sequenceID, 0, tokens);
+ }
+
+
+ /**
+ * Updates the current consensus sequence by replacing gaps by the according consensus tokens
+ * calculated from the single read sequences and extends the consensus sequence if necessary.
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void updateConsensusSequence() {
+ ConsensusSequenceArea area = getConsensusHintDataArea();
+ AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
+ TokenSet<T> tokenSet = model.getTokenSet();
+ String sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
+ int currentConsensusLength = model.getSequenceLength(sequenceID);
+ int overallLength = getReadsArea().getAlignmentModel().getMaxSequenceLength();
+
+ // Replace gaps by new information:
+ for (int column = 0; column < currentConsensusLength; column++) {
+ if (tokenSet.isGapToken(model.getTokenAt(sequenceID, column))) {
+ T newToken = tokenSet.tokenByRepresentation(area.getConsensusToken(column));
+ if (!tokenSet.isGapToken(newToken)) {
+ model.setTokenAt(sequenceID, column, newToken);
+ }
+ }
+ }
+
+ // Append additional tokens:
+ if (overallLength > currentConsensusLength) {
+ Collection<T> tokens = new ArrayList<T>(overallLength);
+ for (int column = currentConsensusLength; column < overallLength; column++) {
+ tokens.add(tokenSet.tokenByRepresentation(area.getConsensusToken(column)));
+ }
+ model.appendTokens(sequenceID, tokens);
+ }
+ }
+
+
+ public static PherogramProvider readPherogram(URI uri) throws IOException, UnsupportedChromatogramFormatException {
+ PherogramProvider result;
+ InputStream stream = uri.toURL().openStream();
+ try {
+ result = new BioJavaPherogramProvider(ChromatogramFactory.create(stream));
+ }
+ finally {
+ stream.close();
+ }
+ return result;
+ }
+
+
+ private String newReadName() {
+ int index = 1;
+ while (getReadsArea().getAlignmentModel().sequenceIDByName(DEFAULT_READ_NAME_PREFIX + index) != null) {
+ index++;
+ }
+ return DEFAULT_READ_NAME_PREFIX + index;
+ }
+
+
+ public void addRead(URI pherogramURI, boolean reverseComplemented) throws IOException, UnsupportedChromatogramFormatException {
+ addRead(newReadName(), pherogramURI, reverseComplemented, null, null, null, null, null);
+ }
+
+
+ /**
+ * Adds a new sequence with attached phergram data area to the reads alignment.
+ * <p>
+ * If {@code null} is specified as {@code editedSequence} the base call sequence from the pherogram will
+ * be set as the edited sequence. If {@code null} is specified as {@code shifts} no shifts between the edited
+ * and the base calls sequence are assumed.
+ *
+ * @param name the name of the new sequence
+ * @param pherogramURI the URI where the associated pherogram file is located
+ * @param reverseComplemented Specify {@code true} here, if the reverse complement of the pherogram data should
+ * be added, {@code false} otherwise.
+ * @param editedSequence the edited version of the base call sequence (May be {@code null}.)
+ * @param shifts the alignment information that links the edited and the base call sequence (May be {@code null}.)
+ * @return the sequence ID of the added read
+ * @throws IOException if an error occurred when trying to read the pherogram file
+ * @throws UnsupportedChromatogramFormatException if the format of the pherogram file is not supported
+ */
+ public String addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence,
+ Integer firstSeqPos, Integer leftCutPos, Integer rightCutPos, SingleReadAlignment.Shift[] shifts)
+ throws IOException, UnsupportedChromatogramFormatException {
+
+ AlignmentModel model = getReadsArea().getAlignmentModel();
+ PherogramProvider pherogramProvider = null;
+ if (pherogramURI != null) {
+ pherogramProvider = readPherogram(pherogramURI); // Must happen before a sequence is added, because it might throw an exception.
+ if (reverseComplemented) {
+ pherogramProvider = new ReverseComplementPherogramProvider(pherogramProvider);
+ }
+ }
+
+ // Create sequence:
+ model.addSequence(name);
+ String id = model.sequenceIDByName(name);
+
+ // Set edited sequence:
+ Collection<Object> tokens = null; // First save tokens in a collection to avoid GUI updated for each token.
+ if (editedSequence != null) {
+ tokens = AlignmentModelUtils.charSequenceToTokenList(editedSequence, model.getTokenSet());
+ }
+ else if (pherogramProvider != null) { // Copy base call sequence into alignment:
+ tokens = new ArrayList<Object>();
+ for (int i = 0; i < pherogramProvider.getSequenceLength(); i++) {
+ tokens.add(model.getTokenSet().tokenByRepresentation(
+ Character.toString(pherogramProvider.getBaseCall(i))));
+ }
+ setDirty();
+ }
+
+ if (tokens != null) { // If either an edited sequence or a pherogram URI was provided.
+ model.insertTokensAt(id, 0, tokens);
+
+ if (pherogramProvider != null) {
+ // Create pherogram area:
+ PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(),
+ new PherogramAreaModel(pherogramProvider));
+
+ // Set position properties and shifts:
+ PherogramAreaModel phergramModel = pherogramArea.getModel();
+ if ((firstSeqPos != null) && (leftCutPos != null)) {
+ phergramModel.setFirstSeqLeftCutPos(firstSeqPos, leftCutPos);
+ }
+ if (rightCutPos != null) {
+ phergramModel.setRightCutPosition(rightCutPos);
+ }
+ if ((shifts != null) && (shifts.length > 0)) {
+ for (int i = 0; i < shifts.length; i++) {
+ phergramModel.addShiftChange(shifts[i].position, shifts[i].shift);
+ }
+ setDirty();
+ }
+
+ // Add pherogram area to GUI:
+ pherogramArea.addMouseListener(new PherogramMouseListener(pherogramArea));
+ getReadsArea().getDataAreas().getSequenceAreas(id).add(pherogramArea);
+ }
+ }
+ return id;
+ }
+
+
+ public static URI getPherogramURI(SingleRead pherogramInfo) {
+ if (pherogramInfo.getPherogram() != null) {
+ return MediaUtils.getFirstMediaRepresentationPart(pherogramInfo.getPherogram()).getUri();
+ }
+ else {
+ return null;
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4;
+
+
+import javax.annotation.PostConstruct;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import info.bioinfweb.libralign.pherogram.PherogramFormats.QualityOutputType;
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+import info.bioinfweb.libralign.pherogram.view.PherogramView;
+import info.bioinfweb.tic.SWTComponentFactory;
+
+
+
+/**
+ * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
+ * {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date Nov 20, 2014
+ */
+public class PherogramPartE4 {
+ public static final String ID = "eu.etaxonomy.taxeditor.molecular.PherogramView"; //$NON-NLS-1$
+
+ private PherogramView pherogramView = null;
+
+ public PherogramView getPherogramView() {
+ if (pherogramView == null) {
+ pherogramView = new PherogramView();
+ pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(true);
+ pherogramView.getTraceCurveView().setHorizontalScale(1);
+ pherogramView.getTraceCurveView().setVerticalScale(100);
+ pherogramView.getTraceCurveView().getFormats().setQualityOutputType(QualityOutputType.NONE); //TODO Make this user defined
+ pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(false);
+ }
+ return pherogramView;
+ }
+
+
+ @PostConstruct
+ public void createPartControl(Composite parent) {
+ SWTComponentFactory.getInstance().getSWTComponent(getPherogramView(), parent, SWT.NONE);
+ getPherogramView().assignSize();
+ }
+
+ public void init(PherogramComponentModel model){
+ getPherogramView().getTraceCurveView().setModel(model);
+ getPherogramView().assignSize();
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.molecular.editor.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.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
+import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
+
+
+
+/**
+ * Handler that copies the currently selected nucleotides from an alignment editor to the clipboard.
+ * <p>
+ * The copied contents either come from the single reads or the consensus sequence alignment area,
+ * depending on which component currently has the focus. If none of these components has the focus,
+ * nothing will be copied, even if nucleotides are currently selected.
+ * <p>
+ * If the selection contains parts of multiple sequence, these are separated by the line separator
+ * of the current operating system.
+ *
+ * @author Ben Stöver
+ * @date 25.08.2015
+ */
+public class AlignmentEditorCopyHandlerE4 {
+
+ @Execute
+ protected void doExecute2(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ AlignmentArea focusedArea = editor.getFocusedArea();
+ SelectionModel selection = focusedArea.getSelection();
+ if (!selection.isEmpty()) {
+ editor.CLIPBOARD.setContents(new Object[]{AlignmentModelUtils.selectionAsString(focusedArea, false)},
+ new Transfer[]{TextTransfer.getInstance()});
+ }
+ }
+
+
+ @CanExecute
+ public boolean isEnabled(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ if (editor != null) {
+ AlignmentArea focusedArea = editor.getFocusedArea();
+ if (focusedArea != null) {
+ return !focusedArea.getSelection().isEmpty();
+ }
+ }
+ return false;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.molecular.editor.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 eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+
+
+
+/**
+ * Handler that cuts the currently selected nucleotides from an alignment editor to the clipboard.
+ * <p>
+ * The cut contents either come from the single reads or the consensus sequence alignment area,
+ * depending on which component currently has the focus. If none of these components has the focus,
+ * nothing will be cut, even if nucleotides are currently selected.
+ * <p>
+ * If the selection contains parts of multiple sequence, these are separated by the line separator
+ * of the current operating system.
+ *
+ * @author Ben Stöver
+ * @date 25.08.2015
+ */
+public class AlignmentEditorCutHandlerE4 extends AlignmentEditorCopyHandlerE4 {
+
+ @Override
+ @Execute
+ protected void doExecute2(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ super.doExecute2(activePart); // Copy selected contents.
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ AlignmentArea focusedArea = editor.getFocusedArea();
+ focusedArea.getActionProvider().deleteSelection();
+ }
+
+
+ @Override
+ @CanExecute
+ public boolean isEnabled(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ if (editor != null) {
+ AlignmentArea focusedArea = editor.getFocusedArea();
+ if (focusedArea != null) {
+ return !focusedArea.getSelection().isEmpty();
+ }
+ }
+ return false;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+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.dialogs.MessageDialog;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder;
+import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
+import info.bioinfweb.libralign.model.AlignmentModel;
+import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
+
+
+
+/**
+ * Handler that pastes the current contents of the clipboard into an active instance of {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date 26.08.2015
+ */
+public class AlignmentEditorPasteHandlerE4 {
+
+ private void pasteString(AlignmentArea area, String sequenceID, String content) {
+ area.getActionProvider().deleteSelection(); // Overwrite selected tokens.
+ area.getActionProvider().elongateSequence(sequenceID, area.getSelection().getCursorColumn());
+
+ @SuppressWarnings("unchecked")
+ AlignmentModel<Object> alignmentModel = (AlignmentModel<Object>)area.getAlignmentModel();
+ alignmentModel.insertTokensAt(sequenceID, area.getSelection().getCursorColumn(),
+ AlignmentModelUtils.charSequenceToTokenList(content, alignmentModel.getTokenSet(),
+ true, alignmentModel.getTokenSet().getGapToken()));
+ }
+
+
+ @Execute
+ protected void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ AlignmentArea focusedArea = editor.getFocusedArea();
+
+ SelectionModel selection = focusedArea.getSelection();
+ String clipboardText = (String)editor.CLIPBOARD.getContents(TextTransfer.getInstance());
+ if (clipboardText != null) {
+ List<String> lines = new ArrayList<String>();
+ Scanner scanner = new Scanner(clipboardText);
+ try {
+ while (scanner.hasNext()) {
+ lines.add(scanner.nextLine());
+ }
+ if (lines.get(lines.size() - 1).equals("")) { //$NON-NLS-1$
+ lines.remove(lines.size() - 1);
+ }
+ }
+ finally {
+ scanner.close();
+ }
+
+ if (!lines.isEmpty()) { //TODO Can lines be empty? (Can an empty string "" be copied to the clipboard?)
+ if (selection.getCursorHeight() == 1) { // If the consensus sequence is focused, this is the only possible case.
+ String sequenceID = focusedArea.getSequenceOrder().idByIndex(selection.getCursorRow());
+ if (lines.size() == 1) {
+ pasteString(focusedArea, sequenceID, lines.get(0));
+ }
+ else {
+ MessageDialog dialog = new MessageDialog(shell,
+ Messages.AlignmentEditorPasteHandler_PASTING_LINES, null,
+ String.format(Messages.AlignmentEditorPasteHandler_PASTING_LINES_QUESTION, lines.size()),
+ MessageDialog.QUESTION,
+ new String[]{Messages.AlignmentEditorPasteHandler_PASTING_LINES_IGNORE,
+ Messages.AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE, Messages.AlignmentEditorPasteHandler_CANCEL},
+ 0);
+ //TODO Does the dialog have to be disposed in some way?
+
+ switch (dialog.open()) {
+ case 0: // Paste all lines in one sequence.
+ pasteString(focusedArea, sequenceID, clipboardText);
+ break;
+ case 1: // Paste only first line.
+ pasteString(focusedArea, sequenceID, lines.get(0));
+ break;
+ }
+ }
+ }
+ else {
+ if (selection.getCursorHeight() == lines.size()) {
+ SequenceOrder order = focusedArea.getSequenceOrder();
+ for (int i = 0; i < selection.getCursorHeight(); i++) {
+ pasteString(focusedArea, order.idByIndex(selection.getCursorRow() + i), lines.get(i)); // Multiple calls of deleteSelection() in here are unnecessary, but should have no effect.
+ }
+ }
+ else {
+ MessageDialog.openError(shell,
+ Messages.AlignmentEditorPasteHandler_PASTE_FAILURE,
+ String.format(Messages.AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE, selection.getCursorHeight(), lines.size(), System.getProperty("line.separator"))); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ }
+
+
+ @CanExecute
+ public boolean isEnabled(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ AlignmentArea focusedArea = editor.getFocusedArea();
+ focusedArea = editor.getFocusedArea();
+ return (focusedArea != null);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
+
+
+
+/**
+ * Switches between the quality output types available for components displaying pherograms.
+ *
+ * @author Ben Stöver
+ * @date 19.06.2015
+ */
+public class ChangePherogramQualityOutputTypeE4 {
+
+ @Execute
+ public void doExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ PherogramPartE4 pherogramPart = (PherogramPartE4) activePart.getObject();
+ pherogramPart.getPherogramView().getTraceCurveView().getFormats().changeQualityOutputType();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+
+
+
+
+/**
+ * Handler that creates the consensus sequence from all single read sequences in the active instance
+ * of {@link AlignmentEditor}. A previously present consensus sequence will be overwritten.
+ *
+ * @author Ben Stöver
+ * @date 19.06.2015
+ * @see UpdateConsensusSequenceHandlerE4
+ * @see AlignmentEditor#createConsensusSequence()
+ */
+public class CreateConsensusSequenceHandlerE4 {
+
+ @Execute
+ public void doExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ editor.createConsensusSequence();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+
+
+
+/**
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the left
+ * of the current selection or cursor position.
+ *
+ * @author Ben Stöver
+ * @date 15.06.2015
+ */
+public class CutPherogramLeftHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ String errorMessage = editor.cutPherogramLeft();
+ if (errorMessage != null) {
+ MessagingUtils.errorDialog(Messages.CutPherogramLeftHandler_CUT_FAILURE, this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false);
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+
+
+
+/**
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the right
+ * of the current selection or cursor position.
+ *
+ * @author BenStoever
+ * @date 15.06.2015
+ */
+public class CutPherogramRightHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ String errorMessage = editor.cutPherogramRight();
+ if (errorMessage != null) {
+ MessagingUtils.errorDialog(Messages.CutPherogramRightHandler_CUT_FAILURE, this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false);
+ }
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.molecular.editor.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.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+
+
+
+/**
+ * Opens the alignment editor from the CDM tree.
+ *
+ * @author Ben Stöver
+ * @author pplitzner
+ */
+public class EditSequenceHandlerE4 {
+ private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EditSequenceHandlerE4.class);
+
+
+ @Execute
+ public void execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection,
+ EPartService partService) {
+ if(treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence){
+ AlignmentEditorInput input = new AlignmentEditorInput(((Sequence)treeNodeOfSelection.getValue()).getUuid()); //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
+ try {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ AlignmentEditorE4 alignmentEditor = (AlignmentEditorE4) part.getObject();
+ alignmentEditor.init(input);
+ }
+ catch (PartInitException e) {
+ logger.error(Messages.EditSequenceHandler_COULD_NOT_OPEN, e);
+ }
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ if(selectedTreeNode!=null){
+ Object value = selectedTreeNode.getValue();
+ canExecute = value instanceof Sequence;
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2016 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.molecular.editor.e4.handler;
+
+
+import java.io.File;
+import java.io.IOException;
+
+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.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.io.CDMPherogramAlignmentObjectTranslator;
+import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter;
+import eu.etaxonomy.taxeditor.molecular.io.SingleReadAlignmentRDFXMLConstants;
+import eu.etaxonomy.taxeditor.molecular.io.wizard.ExportSingleReadAlignmentWizard;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+import eu.etaxonomy.taxeditor.util.ApplicationUtil;
+import info.bioinfweb.jphyloio.JPhyloIOEventWriter;
+import info.bioinfweb.jphyloio.ReadWriteParameterMap;
+import info.bioinfweb.jphyloio.ReadWriteParameterNames;
+import info.bioinfweb.jphyloio.dataadapters.implementations.ListBasedDocumentDataAdapter;
+import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory;
+import info.bioinfweb.jphyloio.objecttranslation.ObjectTranslatorFactory;
+
+
+
+/**
+ * Allows to export a single read alignment to various alignment formats using
+ * <a href="http://bioinfweb.info/JPhyloIO/"><i>JPhyloIO</i></a>.
+ *
+ * @author Ben Stöver
+ * @date 24.04.2016
+ */
+public class ExportSequenceToFileHandlerE4 {
+ private static final JPhyloIOReaderWriterFactory factory = new JPhyloIOReaderWriterFactory();
+
+
+ @Execute
+ public Object execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence) {
+ Sequence sequence = (Sequence)treeNodeOfSelection.getValue();
+
+ final ExportSingleReadAlignmentWizard wizard = new ExportSingleReadAlignmentWizard();
+ final WizardDialog dialog = new WizardDialog(shell, wizard);
+ if (dialog.open() == IStatus.OK) {
+ // Prepare writer parameters:
+ ReadWriteParameterMap parameters = new ReadWriteParameterMap();
+ parameters.put(ReadWriteParameterNames.KEY_APPLICATION_NAME, ApplicationUtil.getTitle());
+ //parameters.put(ReadWriteParameterNames.KEY_APPLICATION_VERSION, ApplicationUtil.getVersion()); // Setting the version unnecessary, since its already contained in the title.
+ parameters.put(ReadWriteParameterNames.KEY_APPLICATION_URL, "http://cybertaxonomy.eu/taxeditor/"); //TODO Specify URL obtained from a central class? //$NON-NLS-1$
+ parameters.put(ReadWriteParameterNames.KEY_SEQUENCE_EXTENSION_TOKEN, wizard.getModel().getElongationToken());
+
+ // Create and register object translator for writing pherogram alignment shifts:
+ ObjectTranslatorFactory translatorFactory = new ObjectTranslatorFactory();
+ translatorFactory.addXSDTranslators(true);
+ translatorFactory.addTranslator(new CDMPherogramAlignmentObjectTranslator(), true, SingleReadAlignmentRDFXMLConstants.DATA_TYPE_PHERORAGM_ALIGNMENT);
+ parameters.put(ReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORY, translatorFactory);
+
+ // Create writer and document adapters:
+ JPhyloIOEventWriter writer = factory.getWriter(wizard.getModel().getFormatInfo().getFormatID());
+ ListBasedDocumentDataAdapter document = new ListBasedDocumentDataAdapter();
+ document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, wizard.getModel().getConsensusSequenceLabel(),
+ wizard.getModel().isExportConsensusSequence(), wizard.getModel().isExportSingleReads()));
+
+ // Write document:
+ File file = new File(wizard.getModel().getFileName());
+ if (!file.exists() || MessagingUtils.confirmDialog(Messages.exportSequenceToFileHandlerOverwriteTitle, String.format(
+ Messages.exportSequenceToFileHandlerOverwriteText, file.getAbsolutePath()))) {
+
+ try {
+ writer.writeDocument(document, file, parameters);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ MessagingUtils.errorDialog(Messages.exportSequenceToFileHandlerIOErrorTitle, this,
+ String.format(Messages.exportSequenceToFileHandlerIOErrorMessage,
+ file.getAbsolutePath()), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);
+ }
+ }
+
+ }
+ }
+ return null;
+ }
+
+ @CanExecute
+ public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ if(selectedTreeNode!=null){
+ Object value = selectedTreeNode.getValue();
+ canExecute = value instanceof Sequence;
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.inject.Named;
+
+import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
+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.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+
+
+
+/**
+ * Handler that loads an additional read into the contig alignment displayed by an instance of {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @author pplitzner
+ */
+public class LoadPherogramHandlerE4 {
+ //TODO Change so that also URIs which do not point to files can be specified.
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+ AlignmentEditorE4 alignmentEditor = (AlignmentEditorE4) activePart.getObject();
+
+ FileDialog fileDialog = new FileDialog(shell);
+ fileDialog.setText(Messages.LoadPherogramHandler_IMPORT_PHEROGRAM);
+ fileDialog.setFilterNames(new String[]{Messages.LoadPherogramHandler_ALL_FORMATS, Messages.LoadPherogramHandler_AB1, Messages.LoadPherogramHandler_SCF, Messages.LoadPherogramHandler_ALL});
+ fileDialog.setFilterExtensions(new String[]{"*.ab1;*.scf", "*.ab1", "*.scf", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ String path = fileDialog.open();
+ if (path != null) {
+ try {
+ alignmentEditor.addRead(new File(path).toURI(), false);
+ }
+ catch (UnsupportedChromatogramFormatException e) {
+ MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT, this,
+ String.format(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE, path), TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID
+ }
+ catch (IOException e) {
+ MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE, this,
+ Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE + path,
+ TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID
+ }
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+
+
+
+
+/**
+ * Reverse complements the single read sequence in an active {@link AlignmentEditor}, where the alignment cursor
+ * is currently located.
+ *
+ * @author Ben Stöver
+ */
+public class ReverseComplementHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ editor.reverseComplementSelectedSequences();
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import java.net.URI;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.viewers.TreeNode;
+
+import eu.etaxonomy.cdm.model.media.MediaUtils;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
+import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+
+
+
+/**
+ * Displays an undistorted pherogram with {@link PherogramViewPart}.
+ *
+ * @author Ben Stöver
+ */
+public class ShowPherogramHandlerE4 {
+
+ @Execute
+ public Object execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection,
+ EPartService partService) {
+ if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof SingleRead) {
+ //TODO Can the parent node (containing the cut positions) be extracted from SingleRead?
+ try {
+ SingleRead singleRead = (SingleRead)treeNodeOfSelection.getValue();
+ URI uri = null;
+ if (singleRead.getPherogram() != null) { // Pherogram objects without URI are possible.
+ uri = MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri();
+ }
+
+ if (uri == null) {
+ MessagingUtils.messageDialog(Messages.ShowPherogramHandler_NO_PHEROGRAM, this,
+ Messages.ShowPherogramHandler_NO_PHEROGRAM_MESSAGE);
+ }
+ else {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ PherogramPartE4 pherogramPart = (PherogramPartE4) part.getObject();
+ pherogramPart.init(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));
+ }
+ }
+ catch (Exception e) {
+ MessagingUtils.errorDialog(Messages.ShowPherogramHandler_ERROR, null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID,
+ e, false);
+ }
+ }
+ return null;
+ }
+
+ @CanExecute
+ public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ if(selectedTreeNode!=null){
+ Object value = selectedTreeNode.getValue();
+ canExecute = value instanceof SingleRead;
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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.resource.ImageDescriptor;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.handler.HandlerTools;
+
+
+
+/**
+ * Switches an {@link AlignmentEditor} between insertion and overwrite mode.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleInsertOverwriteHandlerE4 {
+ public static final String COMMAND_ID =
+ "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"; //$NON-NLS-1$
+
+
+ private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png"); //$NON-NLS-1$
+ private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png"); //$NON-NLS-1$
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ editor.toggleInsertOverwrite();
+ }
+
+
+ //FIXME E4 convert
+// @Override
+// public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+// Object activeEditor = AbstractUtility.getActiveE4Editor();
+// if (activeEditor instanceof AlignmentEditor) {
+// if (((AlignmentEditor)activeEditor).isInsertMode()) {
+// element.setIcon(INSERT_DESCRIPTOR);
+// element.setText("INS"); //$NON-NLS-1$
+// element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_OVERWRITE);
+// }
+// else {
+// element.setIcon(OVERWRITE_DESCRIPTOR);
+// element.setText("OVR"); //$NON-NLS-1$
+// element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_INSERTION);
+// }
+// PlatformUI.getWorkbench().getService(ICommandService.class).refreshElements(
+// ToggleLeftRightInsertionHandlerE4.COMMAND_ID, null);
+// }
+// }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+import javax.inject.Named;
+
+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.resource.ImageDescriptor;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+import eu.etaxonomy.taxeditor.molecular.handler.HandlerTools;
+
+
+
+/**
+ * Switches an {@link AlignmentEditor} between insertion in the base sequence to
+ * the left or to the right.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleLeftRightInsertionHandlerE4 {
+ public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"; //$NON-NLS-1$
+
+
+ private final ImageDescriptor INSERT_LEFT_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png"); //$NON-NLS-1$
+ private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png"); //$NON-NLS-1$
+ private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png"); //$NON-NLS-1$
+ private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR =
+ HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png"); //$NON-NLS-1$
+
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ editor.toggleLeftRightInsertionInPherogram();
+ }
+
+
+// @Override
+// public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+// Object activeEditor = AbstractUtility.getActiveE4Editor();
+// if (activeEditor instanceof AlignmentEditor) {
+// setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());
+// if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {
+// element.setIcon(INSERT_LEFT_DESCRIPTOR);
+// element.setDisabledIcon(INSERT_LEFT_DISABLED_DESCRIPTOR);
+// element.setText(Messages.ToggleLeftRightInsertionHandler_LEFT);
+// element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_RIGHT);
+// }
+// else {
+// element.setIcon(INSERT_RIGHT_DESCRIPTOR);
+// element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR);
+// element.setText(Messages.ToggleLeftRightInsertionHandler_RIGHT);
+// element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_LEFT);
+// }
+// }
+// }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
+
+
+
+/**
+ * @author BenStoever
+ * @date 23.06.2015
+ *
+ */
+public class ToggleShowPherogramBaseCallLinesHandlerE4 {
+
+ @Execute
+ public void doExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ PherogramPartE4 pherogramPart = (PherogramPartE4) activePart.getObject();
+ pherogramPart.getPherogramView().getTraceCurveView().getFormats().toggleShowBaseCallLines();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
+
+
+
+
+/**
+ * Toggles whether probability values (substitution, overcall and undercall) should be displayed
+ * in pherogram areas of {@link AlignmentEditor} or {@link PherogramViewPart}.
+ *
+ * @author Ben Stöver
+ * @date 23.06.2015
+ */
+public class ToggleShowPherogramProbabilitiesHandlerE4 {
+
+ @Execute
+ public void doExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ PherogramPartE4 pherogramPart = (PherogramPartE4) activePart.getObject();
+ pherogramPart.getPherogramView().getTraceCurveView().getFormats().toggleShowProbabilityValues();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.molecular.editor.e4.handler;
+
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
+
+public class UpdateConsensusSequenceHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ AlignmentEditorE4 editor = (AlignmentEditorE4) activePart.getObject();
+ editor.updateConsensusSequence();
+ }
+}
*/
public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
public static AlignmentEditor getActiveAlignmentEditor() {
- Object activeEditor = AbstractUtility.getActiveE4Editor();
+ Object activeEditor = AbstractUtility.getActiveEditor();
if (activeEditor instanceof AlignmentEditor) {
return (AlignmentEditor)activeEditor;
}
public abstract class AbstractPherogramComponentHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- Object activePart = AbstractUtility.getActiveE4Part();
+ Object activePart = AbstractUtility.getActivePart();
if (activePart instanceof AlignmentEditor) {
AlignmentEditor editor = (AlignmentEditor)activePart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
@Execute
public void execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection) {
if(treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence){
- AlignmentEditorInput input = new AlignmentEditorInput(((Sequence)treeNodeOfSelection.getValue()).getUuid()); //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
- try {
- TaxeditorMolecularPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().openEditor(input, AlignmentEditor.ID);
- }
- catch (PartInitException e) {
- logger.error(Messages.EditSequenceHandler_COULD_NOT_OPEN, e);
- }
+// AlignmentEditorInput input = new AlignmentEditorInput(((Sequence)treeNodeOfSelection.getValue()).getUuid()); //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
+// try {
+// TaxeditorMolecularPlugin.getDefault().getWorkbench()
+// .getActiveWorkbenchWindow().getActivePage().openEditor(input, AlignmentEditor.ID);
+// }
+// catch (PartInitException e) {
+// logger.error(Messages.EditSequenceHandler_COULD_NOT_OPEN, e);
+// }
}
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- Object activeEditor = AbstractUtility.getActiveE4Editor();
+ Object activeEditor = AbstractUtility.getActiveEditor();
if (activeEditor instanceof AlignmentEditor) {
AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
- Object activeEditor = AbstractUtility.getActiveE4Editor();
+ Object activeEditor = AbstractUtility.getActiveEditor();
if (activeEditor instanceof AlignmentEditor) {
if (((AlignmentEditor)activeEditor).isInsertMode()) {
element.setIcon(INSERT_DESCRIPTOR);
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
- Object activeEditor = AbstractUtility.getActiveE4Editor();
+ Object activeEditor = AbstractUtility.getActiveEditor();
if (activeEditor instanceof AlignmentEditor) {
setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());
if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {
*/
/**
* Contains handlers that trigger actions in an active instance of
- * {@link main.java.eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor}. Handlers opening
+ * {@link AlignmentEditorE4.java.eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor}. Handlers opening
* an alignment editor or pherogram view are not contained in here.
*
* @author Ben Stöver
Bundle-ManifestVersion: 2
Bundle-Name: Navigation Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.cdm,
eu.etaxonomy.taxeditor.cdmlib,
eu.etaxonomy.taxeditor.store,
eu.etaxonomy.taxeditor.editor,
- org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0.v20160229-1459"
+ eu.etaxonomy.taxeditor.workbench,
+ org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0.v20160229-1459",
+ org.eclipse.e4.ui.di,
+ javax.inject,
+ org.eclipse.e4.ui.services,
+ org.eclipse.e4.ui.workbench,
+ org.eclipse.e4.core.di.annotations,
+ org.eclipse.e4.core.contexts;bundle-version="1.5.1",
+ org.eclipse.e4.core.commands,
+ org.eclipse.e4.core.di
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.core.resources,
org.eclipse.core.runtime,
command.label.14 = Classification\r
command.label.15 = New\r
command.label.16 = Edit\r
+command.label.subtreeOperations = Set for subtree\r
+\r
menu.label.0 = Refresh\r
command.label.17 = List\r
command.label.18 = Key Nodes\r
command.name.moveFactualData = Move factual data\r
command.label.setSecForSubtree = Set secundum for subtree\r
command.name.setSecForSubtree = set secundum for subtree\r
+command.label.setPublishForSubtree = Set publish flag for subtree\r
+command.name.setPublishForSubtree = Set publish flag for subtree\r
+wizard.name = TCS\r
+wizard.name.2 = Excel Normal Explicit Taxa\r
+wizard.name.3 = ABCD\r
+wizard.name.4 = SDD\r
+wizard.name.5 = Specimen CDM Excel\r
+wizard.name.6 = JAXB\r
+wizard.name.8 = SDD\r
+wizard.name.9 = DwC-A\r
+wizard.name.14 = Specimen\r
+wizard.name.18 = CSV\r
+wizard.name.19 = CSV_NAME\r
+wizard.name.20 = CSV_PRINT\r
+wizard.name.22 = CDM light (csv)\r
+wizard.name.23 = Excel Distribution Data Update\r
+wizard.name.24 = RIS Reference\r
command.label.15 = Neu\r
command.label.16 = Bearbeiten\r
command.label.fixClassificationHierarchy = Erzeuge Taxon-Hierarchie\r
+command.label.subtreeOperations = Setze für Teilbaum\r
\r
menu.label.0 = Aktualisieren\r
command.label.17 = Liste\r
navigatorContent.name.1 = Synonyme (experimentell)\r
command.label.moveFactualData = Verschiebe Faktendaten zu Taxon\r
command.name.moveFactualData = Verschiebe Faktendaten\r
-command.label.setSecForSubtree = Setze Secundum für Teilbaum\r
-command.name.setSecForSubtree = Setze Secundum für Teilbaum
\ No newline at end of file
+command.label.setSecForSubtree = Secundum Referenz\r
+command.name.setSecForSubtree = Setze Secundum für Teilbaum\r
+command.label.setPublishForSubtree = Publish Flag\r
+command.name.setPublishForSubtree = Setze Publish Flag für Teilbaum\r
+wizard.name = TCS\r
+wizard.name.2 = Excel Normal Explicit Taxa\r
+wizard.name.3 = ABCD\r
+wizard.name.4 = SDD\r
+wizard.name.5 = Beleg CDM Excel\r
+wizard.name.14 = Beleg\r
+wizard.name.23 = Excel Verbreitungsdaten Update\r
+wizard.name.24 = RIS Referenzen
\ No newline at end of file
<?xml version="1.0" encoding="ASCII"?>
-<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+ <imports xsi:type="commands:Command" xmi:id="_ZkWNgKkOEeejedk4mZQIGw" elementId="org.eclipse.ui.file.export"/>
+ <imports xsi:type="commands:Command" xmi:id="_zm9lYKkPEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
+ <imports xsi:type="commands:Command" xmi:id="_yBC78KnJEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.workbench.command.importSpecimens"/>
+ <imports xsi:type="commands:Command" xmi:id="_AOq4QKnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importAbcd"/>
+ <imports xsi:type="commands:Command" xmi:id="_Anfn8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelDistribution"/>
+ <imports xsi:type="commands:Command" xmi:id="_AqZK8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelTaxa"/>
+ <imports xsi:type="commands:Command" xmi:id="_AsTPcKnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importRisReference"/>
+ <imports xsi:type="commands:Command" xmi:id="_AuNT8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importSdd"/>
+ <imports xsi:type="commands:Command" xmi:id="_Av4u8KnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelSpecimen"/>
+ <imports xsi:type="commands:Command" xmi:id="_LCsbgKnKEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importTcs"/>
+ <imports xsi:type="commands:Command" xmi:id="_fQX7EKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportJaxb"/>
+ <imports xsi:type="commands:Command" xmi:id="_iaZnEKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportSdd"/>
+ <imports xsi:type="commands:Command" xmi:id="_juMxQKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportDwca"/>
+ <imports xsi:type="commands:Command" xmi:id="_kuP5AKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsv"/>
+ <imports xsi:type="commands:Command" xmi:id="_lMwZ8KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsvName"/>
+ <imports xsi:type="commands:Command" xmi:id="_mOC30KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsvPrint"/>
+ <imports xsi:type="commands:Command" xmi:id="_n1FHEKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCdmLight"/>
+ <imports xsi:type="commands:Command" xmi:id="_aN3BsL2gEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.command.collapse"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_oDvMsCTfEeeiN5lBIuqN3g" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.trimcontribution.mainToolbar">
<elements xsi:type="menu:ToolControl" xmi:id="_7kZI4CTfEeeiN5lBIuqN3g" elementId="eu.etaxonomy.taxeditor.navigation.toolcontrol.search_bar" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.search.SearchBar"/>
</fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Z-4rwJIVEeeJAdt8ZUxyaw" featurename="descriptors" parentElementId="xpath:/">
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_gH5RYJIVEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator" label="%view.name.2" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.navigation/icons/edit_16x16.gif" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4">
+ <handlers xmi:id="_Ic-1EJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveTaxonNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveTaxonNodeHandlerE4" command="_w4RNkJIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_xeEM0JIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RefreshTreeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RefreshTreeHandlerE4" command="_ukhM0JIyEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_0d3l0JIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CopyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CopyHandlerE4" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_3I_vUJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingChangeAcceptedTaxonToSynonymHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingChangeAcceptedTaxonToSynonymHandlerE4" command="_p7Oi8JIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_6l8-YJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetSecReferenceForSubtreeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetSecReferenceForSubtreeHandlerE4" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_eEul0K5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetPublishFlagForSubtreeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetPublishFlagForSubtreeHandlerE4" command="_Jb45kK5bEeeDTZvTg-vKRg"/>
+ <handlers xmi:id="_-QYowJIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewClassificationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewClassificationHandlerE4" command="_Vco-4JIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_Bc8EUJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4" command="_Nx06MJIvEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_GTyegJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveFactualDataHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveFactualDataHandlerE4" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_JPKqgJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CreateClassificationHierarchyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CreateClassificationHierarchyHandlerE4" command="_jXX0YJIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_M64uUJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingDeleteTaxonNodeHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingDeleteTaxonNodeHandlerE4" command="__n644JIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_QQq-YJIzEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CloneClassificationHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CloneClassificationHandlerE4" command="_nOOxMJIxEeeJAdt8ZUxyaw"/>
+ <handlers xmi:id="_rydzsJMpEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForTaxonNode" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForTaxonNode">
+ <command href="../eu.etaxonomy.taxeditor.editor/fragment.e4xmi#_j2cfsJMmEeeR4YRjNqCKeA"/>
+ </handlers>
+ <handlers xmi:id="_-GirMLVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4" command="_6iiY8LVbEeeZf_R8QJbACw"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_XNXnkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_5ydggKkeEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:Menu" xmi:id="_yzFmYJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new" label="%menu.label">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_wzftMJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new.taxon" label="%command.label.2" command="_Nx06MJIvEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_33c4IJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.0"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_4dTXMJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new.classification" label="%command.label.3" command="_Vco-4JIxEeeJAdt8ZUxyaw"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_24NMMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.5"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_3d1BwJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.openInCdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_h3uU0JJYEee-eM8NeuXskA" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.6"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_9hdNkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.fixclassificationhierarchy" label="%command.label.fixClassificationHierarchy" command="_jXX0YJIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_ivOrwJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.cloneclassification" label="Clone Classification" command="_nOOxMJIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_ktyqMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.1"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_lALasJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.accTaxonToSynonym" label="%command.label.6" command="_p7Oi8JIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_nh_3MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.moveTaxon" label="%command.label.7" command="_w4RNkJIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_o1PAsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.movefactualdata" label="%command.label.moveFactualData" command="_3PRy8JIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_rBdnsJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.2"/>
+ <children xsi:type="menu:Menu" xmi:id="_T8ey0KkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.menu.import" label="Import">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_YMugAKkeEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSpecimens" label="Import Specimens" command="_yBC78KnJEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_2NC0kKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importAbcd" label="%wizard.name.3" command="_AOq4QKnKEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_3rMNkKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_Anfn8KnKEeeTAPHmaMLwQQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3rMNkanEEeeTAPHmaMLwQQ" coreExpressionId="isShowExperimentalFeatures"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_6YeTMKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelTaxa" label="%wizard.name.2" command="_AqZK8KnKEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_6uLdcKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelSpecimen" label="%wizard.name.5" command="_Av4u8KnKEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_7B5qsKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importRisReference" label="%wizard.name.24" command="_AsTPcKnKEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_7XgHQKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSdd" label="%wizard.name.4" command="_AuNT8KnKEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_7w_lUKnEEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.importTcs" label="%wizard.name" command="_LCsbgKnKEeeTAPHmaMLwQQ"/>
+ </children>
+ <children xsi:type="menu:Menu" xmi:id="_rbInwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.menu.export" label="Export">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_tPAZIKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_fQX7EKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_xwZgsKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportSdd" label="%wizard.name.8" command="_iaZnEKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_zDuJwKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca" label="%wizard.name.9" command="_juMxQKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_0e68cKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsv" label="%wizard.name.18" command="_kuP5AKqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_2C_-UKqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvName" label="%wizard.name.19" command="_lMwZ8KqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_3p8G8KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvPrint" label="%wizard.name.20" command="_mOC30KqhEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_44XB4KqhEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_n1FHEKqhEeeXcJGhyhlrKA"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_x0uEMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.3"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_yH9JQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.delete" label="%command.label.10" command="__n644JIxEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_1JIbQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.copy" label="%command.label.12" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_zV31EMBrEeevuODeDZxr4Q" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.7"/>
+ <children xsi:type="menu:Menu" xmi:id="_o2JjUMBqEeevuODeDZxr4Q" elementId="eu.etaxonomy.taxeditor.navigation.menu.setforsubtree" label="%command.label.subtreeOperations">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_SNIFsK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree" label="%command.label.setPublishForSubtree" command="_Jb45kK5bEeeDTZvTg-vKRg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_mLjosJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree" label="%command.label.setSecForSubtree" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_z0Q6EJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.4"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_0FX4MJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh" label="%command.label.11" command="_ukhM0JIyEeeJAdt8ZUxyaw"/>
+ </menus>
+ <toolbar xmi:id="_fbAfML2kEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.navigation.toolbar.1">
+ <children xsi:type="menu:HandledToolItem" xmi:id="_KoxjML2gEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.navigation.handledtoolitem.collapse" label="Collapse" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/collapseall.gif" command="_aN3BsL2gEeeyWfw0n8-ICQ"/>
+ <children xsi:type="menu:HandledToolItem" xmi:id="_IO57EL2bEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.navigation.handledtoolitem.syncwithtaxonselectio" label="Sync with taxon selectio" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.editor/icons/synced.gif" type="Check" command="_6iiY8LVbEeeZf_R8QJbACw"/>
+ </toolbar>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_AcycAKOkEee6lJH578buGg" elementId="eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.navigation/icons/system-search.png" allowMultiple="true" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4">
+ <tags>nonRestore</tags>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_A-rBEKOkEee6lJH578buGg" elementId="eu.etaxonomy.taxeditor.navigation.popupmenu.searchresults">
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_tVmTQKOkEee6lJH578buGg" elementId="eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.searchResult.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
+ </menus>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_FajhoKQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4" label="%view.name.1" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4">
+ <handlers xmi:id="_qXpqEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.NewPolytomousKeyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.NewPolytomousKeyHandlerE4" command="_lAZG8KQUEeeTrq_CRrR-jg"/>
+ <handlers xmi:id="_tvg9wKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4" command="_BrgnkKQVEeeTrq_CRrR-jg"/>
+ <handlers xmi:id="_xhc-UKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingUpdatePolytomousKeyAllNodesHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingUpdatePolytomousKeyAllNodesHandlerE4" command="_6S6M4KQVEeeTrq_CRrR-jg"/>
+ <handlers xmi:id="_CoKnoKQWEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RefreshPolytomousKeyListHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RefreshPolytomousKeyListHandlerE4" command="_4BQ6YKQVEeeTrq_CRrR-jg"/>
+ <handlers xmi:id="_GjyIoKQWEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.navigation/eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4" command="_8C8AEKQVEeeTrq_CRrR-jg"/>
+ <menus xsi:type="menu:PopupMenu" xmi:id="_FajhpKQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.popupmenu.polytomouskeyview">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_FajhpaQUEeeTrq_CRrR-jg" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FajhpqQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.new" label="%command.label.15" command="_lAZG8KQUEeeTrq_CRrR-jg"/>
+ <children xsi:type="menu:DynamicMenuContribution" xmi:id="_ot9k4KQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.polytomouskey.dynamicmenucontribution.cdmViewer" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.CdmViewerContextMenuE4"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_Fajhp6QUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.edit" label="%command.label.16" command="_BrgnkKQVEeeTrq_CRrR-jg"/>
+ <children xsi:type="menu:Menu" xmi:id="_IKePEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.menu.polytomouskey.refresh" label="%menu.label.0">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_JS0-QKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshlist" label="%command.label.17" command="_4BQ6YKQVEeeTrq_CRrR-jg"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_JsJdMKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshnodes" label="%command.label.18" command="_6S6M4KQVEeeTrq_CRrR-jg"/>
+ </children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_FajhqKQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.18"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FajhqaQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refresh" label="%command.label.19" command="_8C8AEKQVEeeTrq_CRrR-jg"/>
+ </menus>
+ </elements>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_wITZ8JIVEeeJAdt8ZUxyaw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="before:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_X73BkLMmEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.navigator.showViewMenu.polytomouskeys" label="%view.name.1" iconURI="" tooltip="%view.name.1" command="_zm9lYKkPEeejedk4mZQIGw">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_X73BkbMmEeeMU61m8yqdaA" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_X73BkrMmEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.taxonNavigator" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_wITZ8ZIVEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.showViewMenu.navigator" label="%command.label" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.navigation/icons/edit_16x16.gif" tooltip="%command.label" command="_zm9lYKkPEeejedk4mZQIGw">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wITZ8pIVEeeJAdt8ZUxyaw" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_wITZ85IVEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.taxonNavigator" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.navigation.navigator"/>
+ </elements>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_MOKIAJIvEeeJAdt8ZUxyaw" featurename="commands" parentElementId="xpath:/">
+ <elements xsi:type="commands:Command" xmi:id="_Nx06MJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode" commandName="%command.name"/>
+ <elements xsi:type="commands:Command" xmi:id="_Vco-4JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.create.classification" commandName="%command.name.0"/>
+ <elements xsi:type="commands:Command" xmi:id="_jXX0YJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler" commandName="%command.name.10"/>
+ <elements xsi:type="commands:Command" xmi:id="_nOOxMJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.cloneClassification" commandName="Clone Classification"/>
+ <elements xsi:type="commands:Command" xmi:id="_p7Oi8JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym" commandName="%command.name.5"/>
+ <elements xsi:type="commands:Command" xmi:id="_uFj1YJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree" commandName="%command.name.setSecForSubtree"/>
+ <elements xsi:type="commands:Command" xmi:id="_Jb45kK5bEeeDTZvTg-vKRg" elementId="eu.etaxonomy.taxeditor.navigator.command.update.setPublishForSubtree" commandName="%command.name.setPublishForSubtree"/>
+ <elements xsi:type="commands:Command" xmi:id="_w4RNkJIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon" commandName="%command.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_3PRy8JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.moveFactualData" commandName="%command.name.moveFactualData"/>
+ <elements xsi:type="commands:Command" xmi:id="__n644JIxEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.delete" commandName="%command.name.11"/>
+ <elements xsi:type="commands:Command" xmi:id="_EJ-u0JIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.copyTaxonName" commandName="%command.name.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_ukhM0JIyEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.command.refreshNavigator" commandName="Refresh Navigator"/>
+ <elements xsi:type="commands:Command" xmi:id="_lAZG8KQUEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.newKey" commandName="%command.name.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_BrgnkKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes" commandName="%command.name.7"/>
+ <elements xsi:type="commands:Command" xmi:id="_4BQ6YKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyList" commandName="%command.name.8"/>
+ <elements xsi:type="commands:Command" xmi:id="_6S6M4KQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes" commandName="%command.name.9"/>
+ <elements xsi:type="commands:Command" xmi:id="_8C8AEKQVEeeTrq_CRrR-jg" elementId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete" commandName="%command.name.11"/>
+ <elements xsi:type="commands:Command" xmi:id="_6iiY8LVbEeeZf_R8QJbACw" elementId="eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon" commandName="Link with taxon"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3CbhIK25EeeykrJkROy5EA" featurename="children" parentElementId="eu.etaxonomy.navigation.menu.new">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_M9FakK26EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.commandlabel13" label="%command.label.13" tooltip="%command.label.13" command="_Nx06MJIvEeeJAdt8ZUxyaw">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_Pucu8K26EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_SCz-QK26EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.commandlabel14" label="%command.label.14" tooltip="%command.label.14" command="_Vco-4JIxEeeJAdt8ZUxyaw">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_SecxYK26EeeykrJkROy5EA" coreExpressionId="isCdmStoreConnected"/>
+ </elements>
+ </fragments>
</fragment:ModelFragments>
</run>
</application>
</extension>
- <extension
- point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.navigation.search.SearchResultView"
- icon="icons/system-search.png"
- id="eu.etaxonomy.taxeditor.navigation.search.searchResultView"
- name="%view.name"
- restorable="false">
- </view>
- <view
- allowMultiple="false"
- class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator"
- icon="icons/preferences-system-windows.png"
- id="eu.etaxonomy.taxeditor.navigation.navigator"
- name="%view.name.0"
- restorable="true">
- </view>
- <view
- allowMultiple="false"
- class="eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart"
- name="%view.name.1"
- restorable="true">
- </view>
- </extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution
</visibleWhen>
</dynamic>
</menuContribution>
- <menuContribution
- locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.editor.showViewMenu">
- <command
- commandId="org.eclipse.ui.views.showView"
- label="%command.label"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.navigation.navigator">
- </parameter>
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.ui.views.showView"
- label="%command.label.0"
- style="push">
- <parameter
- name="org.eclipse.ui.views.showView.viewId"
- value="eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart">
- </parameter>
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.search.searchResultView">
- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
- </dynamic>
- <separator
- name="eu.etaxonomy.taxeditor.navigation.separator2">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup">
- <menu
- id="eu.etaxonomy.navigation.menu.new"
- label="%menu.label">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
- label="%command.label.2"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <with
- variable="selection">
- <count
- value="+">
- </count>
- </with>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.navigation.menu.new.separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.create.classification"
- id="eu.etaxonomy.taxeditor.navigation.create.classificationHandler"
- label="%command.label.3"
- style="push">
- </command>
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </menu>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler"
- label="%command.label.fixClassificationHierarchy"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isShowExperimentalFeatures">
- </reference>
- <test
- property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
- </test>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.cloneClassification"
- label="Clone Classification"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isShowExperimentalFeatures">
- </reference>
- <test
- property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
- </test>
- </and>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-navigation.separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
- label="%command.label.6"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- <reference
- definitionId="isTaxonNode">
- </reference>
- <not>
- <test
- property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
- </test>
- </not>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree"
- label="%command.label.setSecForSubtree"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon"
- label="%command.label.7"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isTaxonNode">
- </reference>
- <not>
- <test
- property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
- </test>
- </not>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.moveFactualData"
- label="%command.label.moveFactualData"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- <reference
- definitionId="isTaxonNode">
- </reference>
- <not>
- <test
- property="eu.etaxonomy.taxeditor.navigation.navigator.navigatorPropertyTester.isClassification">
- </test>
- </not>
-
- </and>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-navigation.separator2"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.import"
- label="%command.label.8"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.ui.file.export"
- label="%command.label.9"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-navigation.separator4"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.delete"
- label="%command.label.10"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- <not>
- <reference
- definitionId="isSynonymNode">
- </reference>
- </not>
- <with
- variable="selection">
- <count
- value="+">
- </count>
- </with>
- </and>
- </visibleWhen>
- </command>
- <separator
- name="taxeditor-navigation.separator5"
- visible="true">
- </separator>
- <command
- commandId="org.eclipse.ui.file.refresh"
- label="%command.label.11"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.copyTaxonName"
- label="%command.label.12"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <and>
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- <reference
- definitionId="isTaxonNode">
- </reference></and>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.navigation.separator2"
- visible="true">
- </separator>
- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
- </dynamic>
- <!--command
- commandId="eu.etaxonomy.taxeditor.navigation.command.createChildTaxon"
- label="New Child"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.quickCreateChildTaxon"
- label="Quick Add Child "
- style="push">
- </command-->
- </menuContribution>
- <menuContribution
- locationURI="menu:eu.etaxonomy.navigation.menu.new">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
- label="%command.label.13"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.navigation.menu.new.separator1"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.create.classification"
- id="eu.etaxonomy.taxeditor.navigation.create.classificationHandler"
- label="%command.label.14"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isCdmStoreConnected">
- </reference>
- </visibleWhen>
- </command>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.newKey"
- label="%command.label.15"
- style="push">
- </command>
- <dynamic
- class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
- id="eu.etaxonomy.taxeditor.navigation.polytomous.cdmViewerContextMenu">
- </dynamic>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes"
- label="%command.label.16"
- style="push">
- </command>
- <menu
- label="%menu.label.0">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyList"
- label="%command.label.17"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes"
- label="%command.label.18"
- style="push">
- </command>
- </menu>
- <separator
- name="eu.etaxonomy.eu.polytomousKeyView.separator2"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete"
- label="%command.label.19"
- style="push">
- </command>
-
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.MoveTaxonHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon"
- name="%command.name.2">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.RefreshTreeHandler"
- id="org.eclipse.ui.file.refresh"
- name="%command.name.3">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.CopyHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.copyTaxonName"
- name="%command.name.4">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.ChangeAcceptedTaxonToSynonymHandler"
- id="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
- name="%command.name.5">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.SetSecReferenceForSubtreeHandler"
- id="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree"
- name="%command.name.setSecForSubtree">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewClassificationHandler"
- id="eu.etaxonomy.taxeditor.navigation.create.classification"
- name="%command.name.0">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.NewTaxonNodeHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.create.taxonNode"
- name="%command.name">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.NewPolytomousKeyHandler"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.newKey"
- name="%command.name.6">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.EditPolytomousKeyNodesHandler"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes"
- name="%command.name.7">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RefreshPolytomousKeyListHandler"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyList"
- name="%command.name.8">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RefreshPolytomousKeyNodesHandler"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes"
- name="%command.name.9">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.MoveFactualDataHandler"
- id="eu.etaxonomy.taxeditor.navigation.moveFactualData"
- name="%command.name.moveFactualData">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.CreateClassificationHierarchyHandler"
- id="eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler"
- name="%command.name.10">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.DeleteHandler"
- id="eu.etaxonomy.taxeditor.navigation.command.delete"
- name="%command.name.11">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.DeleteHandler"
- id="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete"
- name="%command.name.11">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.CloneClassificationHandler"
- id="eu.etaxonomy.taxeditor.navigation.cloneClassification"
- name="Clone Classification">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.DeleteHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.navigator.command.delete">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.navigation.navigator">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.DeleteHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingChangeAcceptedTaxonToSynonymHandler"
- commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.SetSecReferenceForSubtreeHandler"
- commandId="eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingMoveFactualDataHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.moveFactualData">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingMoveTaxonNodeHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.navigator.handler.RemotingDeleteTaxonNodeHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.command.delete">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingDeletePolytomousKeyHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingUpdatePolytomousKeyAllNodesHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.navigation.key.polytomous.handler.RemotingEditPolytomousKeyNodesHandler"
- commandId="eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
- commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.navigation.navigator">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorForTaxonBaseHandler"
- commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon">
- <activeWhen>
- <and>
- <not>
- <reference
- definitionId="isOrphanedTaxon">
- </reference>
- </not>
- </and>
- </activeWhen>
- </handler>
- </extension>
-
-
- <!--extension
- point="org.eclipse.ui.navigator.viewer">
- <viewer
- viewerId="org.eclipse.ui.examples.navigator.view">
- </viewer>
- <viewerContentBinding
- viewerId="org.eclipse.ui.examples.navigator.view">
- <includes>
- <contentExtension
- pattern="org.eclipse.ui.navigator.resourceContent" />
- <contentExtension
- pattern="org.eclipse.ui.navigator.resources.filters.*" />
- </includes>
- </viewerContentBinding>
- <viewerActionBinding
- viewerId="org.eclipse.ui.examples.navigator.view">
- <includes>
- <actionExtension
- pattern="org.eclipse.ui.navigator.resources.*">
- </actionExtension>
- </includes>
- </viewerActionBinding>
- </extension>
- <extension
- point="org.eclipse.ui.navigator.navigatorContent">
- <commonFilter
- id="org.eclipse.ui.examples.navigator.filters.hideNonJavaProjects"
- name="Hide non-Java projects">
- <filterExpression>
- <not>
- <adapt
- type="org.eclipse.core.resources.IProject">
- <test
- property="org.eclipse.core.resources.projectNature"
- value="org.eclipse.jdt.core.javanature">
- </test>
- </adapt>
- </not>
- </filterExpression>
- </commonFilter>
- </extension-->
-
-
-
-
-
-
- <extension
- point="org.eclipse.ui.views">
- <view
- class="eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator"
- icon="icons/edit_16x16.gif"
- id="eu.etaxonomy.taxeditor.navigation.navigator"
- name="%view.name.2"/>
</extension>
<extension
point="org.eclipse.ui.navigator.navigatorContent">
</contentExtension>
</includes>
</viewerContentBinding>
- <!--viewer
- popupMenuId="eu.etaxonomy.taxeditor.navigation.navigator#PopupMenu"
- viewerId="eu.etaxonomy.taxeditor.navigation.navigator">
- <options>
- <property
- name="org.eclipse.ui.navigator.hideAvailableExtensionsTab"
- value="true">
- </property>
- </options>
- </viewer-->
<dragAssistant
class="eu.etaxonomy.taxeditor.navigation.navigator.dnd.TaxonNavigatorDragAdapterAssistant"
viewerId="eu.etaxonomy.taxeditor.navigation.navigator">
properties="hasTaxa"
type="eu.etaxonomy.cdm.model.taxon.TaxonNode">
</propertyTester>
- <propertyTester
- class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
- id="eu.etaxonomy.taxeditor.preferences.propertyTester"
- namespace="eu.etaxonomy.taxeditor.preferences.propertyTester"
- properties="isShowExperimentalFeatures, isChecklistEditorEnabled"
- type="org.eclipse.jface.viewers.IStructuredSelection">
- </propertyTester>
<propertyTester
class="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
id="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester"
property="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester.isCdmStoreConnected">
</test>
</definition>
- <definition
- id="isShowExperimentalFeatures">
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.preferences.propertyTester.isShowExperimentalFeatures">
- </test>
- </with>
- </definition>
<definition
id="isRemoting">
<test
property="eu.etaxonomy.taxeditor.preference.CdmStorePropertyTester.isStandAlone">
</test>
</definition>
+ <definition
+ id="isCdmStoreConnectedAndShowExperimental">
+ <and>
+ <reference
+ definitionId="isShowExperimentalFeatures">
+ </reference>
+ <reference
+ definitionId="isCdmStoreConnected">
+ </reference>
+ </and>
+ </definition>
</extension>
<extension
id="eu.etaxonomy.taxeditor.navigation.workbench.model"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation;
+
+public class AppModelId {
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENPART = "eu.etaxonomy.taxeditor.command.openPart";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_CLONECLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.cloneClassification";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_COPYTAXONNAME = "eu.etaxonomy.taxeditor.navigation.command.copyTaxonName";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_CREATE_TAXONNODE = "eu.etaxonomy.taxeditor.navigation.command.create.taxonNode";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_DELETE = "eu.etaxonomy.taxeditor.navigation.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_LINKWITHTAXON = "eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_REFRESHNAVIGATOR = "eu.etaxonomy.taxeditor.navigation.command.refreshNavigator";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_COMMAND_UPDATE_MOVETAXON = "eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_CREATE_CLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.create.classification";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_COMMAND_DELETE = "eu.etaxonomy.taxeditor.navigation.key.polytomous.command.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_EDITNODES = "eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_NEWKEY = "eu.etaxonomy.taxeditor.navigation.key.polytomous.newKey";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_REFRESHKEYLIST = "eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyList";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_REFRESHKEYNODES = "eu.etaxonomy.taxeditor.navigation.key.polytomous.refreshKeyNodes";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MOVEFACTUALDATA = "eu.etaxonomy.taxeditor.navigation.moveFactualData";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_HANDLER_OPENFIXCLASSIFICATIONHIERARCHYHANDLER = "eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_COMMAND_UPDATE_CHANGEACCEPTEDTOSYNONYM = "eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_COMMAND_UPDATE_SETPUBLISHFORSUBTREE = "eu.etaxonomy.taxeditor.navigator.command.update.setPublishForSubtree";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_COMMAND_UPDATE_SETSECUNDUMFORSUBTREE = "eu.etaxonomy.taxeditor.navigator.command.update.setSecundumForSubtree";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCDMLIGHT = "eu.etaxonomy.taxeditor.store.command.exportCdmLight";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSV = "eu.etaxonomy.taxeditor.store.command.exportCsv";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSVNAME = "eu.etaxonomy.taxeditor.store.command.exportCsvName";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSVPRINT = "eu.etaxonomy.taxeditor.store.command.exportCsvPrint";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTDWCA = "eu.etaxonomy.taxeditor.store.command.exportDwca";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTJAXB = "eu.etaxonomy.taxeditor.store.command.exportJaxb";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTSDD = "eu.etaxonomy.taxeditor.store.command.exportSdd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTABCD = "eu.etaxonomy.taxeditor.store.command.importAbcd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELDISTRIBUTION = "eu.etaxonomy.taxeditor.store.command.importExcelDistribution";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELSPECIMEN = "eu.etaxonomy.taxeditor.store.command.importExcelSpecimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELTAXA = "eu.etaxonomy.taxeditor.store.command.importExcelTaxa";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTRISREFERENCE = "eu.etaxonomy.taxeditor.store.command.importRisReference";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTSDD = "eu.etaxonomy.taxeditor.store.command.importSdd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTTCS = "eu.etaxonomy.taxeditor.store.command.importTcs";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMAND_IMPORTSPECIMENS = "eu.etaxonomy.taxeditor.workbench.command.importSpecimens";
+ public static final String COMMAND_ORG_ECLIPSE_UI_FILE_EXPORT = "org.eclipse.ui.file.export";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_DYNAMICMENUCONTRIBUTION_OPENINCDMVIEWER = "eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.openInCdmViewer";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_DYNAMICMENUCONTRIBUTION_SEARCHRESULT_CDMVIEWER = "eu.etaxonomy.taxeditor.navigation.dynamicmenucontribution.searchResult.cdmViewer";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_POLYTOMOUSKEY_DYNAMICMENUCONTRIBUTION_CDMVIEWER = "eu.etaxonomy.taxeditor.navigation.polytomouskey.dynamicmenucontribution.cdmViewer";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_ACCTAXONTOSYNONYM = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.accTaxonToSynonym";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_CLONECLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.cloneclassification";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_COPY = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.copy";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_DELETE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTCDMLIGHT = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCdmLight";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTCSV = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsv";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTCSVNAME = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvName";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTCSVPRINT = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportCsvPrint";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTDWCA = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportDwca";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTSDD = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportSdd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_EXPORTJAXB = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.exportJaxb";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_FIXCLASSIFICATIONHIERARCHY = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.fixclassificationhierarchy";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTABCD = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importAbcd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTEXCELDISTRIBUTION = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExceldistribution";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTEXCELSPECIMEN = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelSpecimen";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTEXCELTAXA = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importExcelTaxa";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTRISREFERENCE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importRisReference";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTSDD = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSdd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTSPECIMENS = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importSpecimens";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_IMPORTTCS = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.importTcs";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_MOVEFACTUALDATA = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.movefactualdata";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_MOVETAXON = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.moveTaxon";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_POLYTOMOUSKEY_EDIT = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.edit";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_POLYTOMOUSKEY_NEW = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.new";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_POLYTOMOUSKEY_REFRESH = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refresh";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_POLYTOMOUSKEY_REFRESHLIST = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshlist";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_POLYTOMOUSKEY_REFRESHNODES = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.polytomouskey.refreshnodes";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_REFRESH = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.refresh";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETPUBLISHFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setpublishforsubtree";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SETSECFORSUBTREE = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_HANDLEDMENUITEM_SYNCWITHTAXON = "eu.etaxonomy.taxeditor.navigation.handledmenuitem.syncwithtaxon";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_CLASSIFICATION = "eu.etaxonomy.taxeditor.navigation.menu.new.classification";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW_TAXON = "eu.etaxonomy.taxeditor.navigation.menu.new.taxon";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_SHOWVIEWMENU_NAVIGATOR = "eu.etaxonomy.taxeditor.navigator.showViewMenu.navigator";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_SHOWVIEWMENU_POLYTOMOUSKEYS = "eu.etaxonomy.taxeditor.navigator.showViewMenu.polytomouskeys";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_OPENDERIVATIVEEDITORFORTAXONNODE = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivativeEditorForTaxonNode";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_HANDLER_NEWPOLYTOMOUSKEYHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.NewPolytomousKeyHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_HANDLER_REFRESHPOLYTOMOUSKEYLISTHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RefreshPolytomousKeyListHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_HANDLER_REMOTINGDELETEPOLYTOMOUSKEYHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_HANDLER_REMOTINGEDITPOLYTOMOUSKEYNODESHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingEditPolytomousKeyNodesHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_HANDLER_REMOTINGUPDATEPOLYTOMOUSKEYALLNODESHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingUpdatePolytomousKeyAllNodesHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_CLONECLASSIFICATIONHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CloneClassificationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_COPYHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CopyHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_CREATECLASSIFICATIONHIERARCHYHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.CreateClassificationHierarchyHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_LINKWITHTAXONHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.LinkWithTaxonHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_NEWCLASSIFICATIONHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewClassificationHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_NEWTAXONNODEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.NewTaxonNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_REFRESHTREEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RefreshTreeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_REMOTINGCHANGEACCEPTEDTAXONTOSYNONYMHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingChangeAcceptedTaxonToSynonymHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_REMOTINGDELETETAXONNODEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingDeleteTaxonNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_REMOTINGMOVEFACTUALDATAHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveFactualDataHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_REMOTINGMOVETAXONNODEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.RemotingMoveTaxonNodeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_SETPUBLISHFLAGFORSUBTREEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetPublishFlagForSubtreeHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR_E4_HANDLER_SETSECREFERENCEFORSUBTREEHANDLERE4 = "eu.etaxonomy.taxeditor.navigation.navigator.e4.handler.SetSecReferenceForSubtreeHandlerE4";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_18 = "eu.etaxonomy.taxeditor.editor.menuseparator.18";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_0 = "eu.etaxonomy.taxeditor.navigation.menuseparator.0";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_1 = "eu.etaxonomy.taxeditor.navigation.menuseparator.1";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_2 = "eu.etaxonomy.taxeditor.navigation.menuseparator.2";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_3 = "eu.etaxonomy.taxeditor.navigation.menuseparator.3";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_4 = "eu.etaxonomy.taxeditor.navigation.menuseparator.4";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_5 = "eu.etaxonomy.taxeditor.navigation.menuseparator.5";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENUSEPARATOR_6 = "eu.etaxonomy.taxeditor.navigation.menuseparator.6";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_EXPORT = "eu.etaxonomy.taxeditor.navigation.menu.export";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_IMPORT = "eu.etaxonomy.taxeditor.navigation.menu.import";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_NEW = "eu.etaxonomy.taxeditor.navigation.menu.new";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_MENU_POLYTOMOUSKEY_REFRESH = "eu.etaxonomy.taxeditor.navigation.menu.polytomouskey.refresh";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_TAXONNAVIGATOR = "eu.etaxonomy.taxeditor.store.showView.parameter.taxonNavigator";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_KEY_POLYTOMOUS_E4_POLYTOMOUSKEYVIEWPARTE4 = "eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_NAVIGATOR = "eu.etaxonomy.taxeditor.navigation.navigator";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_SEARCH_E4_SEARCHRESULTVIEWE4 = "eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_POPUPMENU_POLYTOMOUSKEYVIEW = "eu.etaxonomy.taxeditor.navigation.popupmenu.polytomouskeyview";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_POPUPMENU_SEARCHRESULTS = "eu.etaxonomy.taxeditor.navigation.popupmenu.searchresults";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_NAVIGATOR_POPUPMENU_TAXONNAVIGATOR = "eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator";
+ public static final String TOOLCONTROL_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_TOOLCONTROL_SEARCH_BAR = "eu.etaxonomy.taxeditor.navigation.toolcontrol.search_bar";
+}
\ No newline at end of file
package eu.etaxonomy.taxeditor.navigation;
-import java.util.HashMap;
+import java.util.Collection;
import java.util.HashSet;
-import java.util.Map;
import java.util.Set;
import java.util.UUID;
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.ParameterizedCommand;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.UndoContext;
-import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.navigator.CommonViewer;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.INameService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.model.common.ICdmBase;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
- * <p>NavigationUtil class.</p>
*
* @author n.hoffmann
* @created 24.03.2009
public class NavigationUtil extends AbstractUtility{
private static final String NOT_IMPLEMENTED_YET = Messages.NavigationUtil_NOT_IMPLEMENTED;
- private static final String ERROR_OPENING_THE_EDITOR = Messages.NavigationUtil_OPEN_ERROR;
private static IUndoContext defaultUndoContext;
/**
*
* @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object.
*/
- public static void openEditor(UuidAndTitleCache uuidAndTitleCache){
+ public static void openEditor(UuidAndTitleCache uuidAndTitleCache, Shell shell, EModelService modelService, EPartService partService, MApplication application){
Class<?> type = uuidAndTitleCache.getType();
ICdmBase cdmBase = null;
if(type.equals(Classification.class)){
MessagingUtils.warningDialog(Messages.NavigationUtil_UNKNOWN_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNKNOWN_TYPE_MESSAGE);
}
if(cdmBase!=null){
- openEditor(cdmBase);
+ openEditor(cdmBase, shell, modelService, partService, application);
}
else{
MessagingUtils.warningDialog(Messages.NavigationUtil_NOT_FOUND, NavigationUtil.class, Messages.NavigationUtil_NOT_FOUND_MESSAGE);
}
}
- public static void openEditor(ICdmBase selectedObject){
+ public static void openEditor(ICdmBase selectedObject, Shell shell, EModelService modelService, EPartService partService, MApplication application){
UUID entityUuid = selectedObject.getUuid();
try {
if(selectedObject instanceof TaxonNode){
NewClassificationWizard classificationWizard = new NewClassificationWizard();
classificationWizard.init(null, null);
classificationWizard.setEntity(classification);
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
+ WizardDialog dialog = new WizardDialog(shell, classificationWizard);
dialog.open();
}
else{
- EditorUtil.openTaxonNode(entityUuid);
+ EditorUtil.openTaxonNodeE4(entityUuid, modelService, partService, application);
}
- }else if(selectedObject instanceof TaxonBase){
- TaxonBase taxonBase = (TaxonBase)selectedObject;
- if(taxonBase.isOrphaned()){
- openInBulkEditor(taxonBase);
- }
- else{
- EditorUtil.openTaxonBase(entityUuid);
- }
- }else if(selectedObject instanceof TaxonName){
- openInBulkEditor(selectedObject);
- }else if(selectedObject instanceof PolytomousKey){
- EditorUtil.openPolytomousKey(entityUuid);
- }else{
+ }
+ else if(selectedObject instanceof TaxonBase){
+ EditorUtil.openTaxonBaseE4(entityUuid, modelService, partService, application);
+ }
+ else{
MessagingUtils.warningDialog(Messages.NavigationUtil_UNSUPPORTED_TYPE, NavigationUtil.class, Messages.NavigationUtil_UNSUPPORTED_TYPE_MESSAGE + selectedObject);
}
- } catch (PartInitException e) {
- MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
} catch (Exception e) {
MessagingUtils.errorDialog(Messages.NavigationUtil_CREATE_FAILED,
NavigationUtil.class,
}
}
- private static void openInBulkEditor(ICdmBase selectedObject) {
- ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
- IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class);
- String openInBulkEditorCommand = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"; //$NON-NLS-1$
- Command command = commandService.getCommand(openInBulkEditorCommand);
- if(command.isDefined()){
- Map<String, UUID> params = new HashMap<String, UUID>();
- params.put(openInBulkEditorCommand+".uuid", selectedObject.getUuid()); //$NON-NLS-1$
- ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params);
- try {
- if(parameterizedCommand!=null){
- handlerService.executeCommand(parameterizedCommand, null);
- return;
- }
- else{
- handlerService.executeCommand(command.getId(), null);
- return;
- }
- } catch (NotDefinedException nde) {
- throw new RuntimeException("Could not find open command: " + command.getId()); //$NON-NLS-1$
- } catch (Exception exception) {
- MessagingUtils.error(NavigationUtil.class, "An exception occured while trying to execute "+command.getId(), exception); //$NON-NLS-1$
- }
- }
- }
-
/**
* <p>openEmpty</p>
*
* @param parentNodeUuid a {@link java.util.UUID} object.
*/
public static void openEmpty(UUID parentNodeUuid) {
- try {
- EditorUtil.openEmpty(parentNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
- }
- }
-
- /**
- * <p>getShell</p>
- *
- * @return a {@link org.eclipse.swt.widgets.Shell} object.
- */
- public static Shell getShell() {
- return getActiveWindow().getShell();
- }
-
- /**
- * <p>getActiveWindow</p>
- *
- * @return a {@link org.eclipse.ui.IWorkbenchWindow} object.
- */
- public static IWorkbenchWindow getActiveWindow() {
- return TaxeditorNavigationPlugin.getDefault().getWorkbench().
- getActiveWorkbenchWindow();
- }
-
- /**
- * <p>getWorkbenchUndoContext</p>
- *
- * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- */
- public static IUndoContext getWorkbenchUndoContext() {
- return TaxeditorEditorPlugin.getDefault().getWorkbench().
- getOperationSupport().getUndoContext();
+ EditorUtil.openEmptyE4(parentNodeUuid);
}
/**
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
* @return a boolean.
*/
- public static boolean isDirty(TaxonNode taxonNode){
-
- for (IEditorReference reference : getActivePage().getEditorReferences()) {
-
- try {
- if (reference.getEditorInput() instanceof TaxonEditorInput) {
- TaxonEditorInput editorInput = (TaxonEditorInput) reference.getEditorInput();
- if(editorInput.getTaxonNode().equals(taxonNode) && reference.isDirty()){
- return true;
- }
- }
- } catch (PartInitException e) {
- MessagingUtils.error(NavigationUtil.class, e.getMessage(), e);
- throw new RuntimeException(e);
- }
-
- }
+ public static boolean isDirty(TaxonNode taxonNode, EPartService partService){
+
+ Collection<MPart> dirtyParts = partService.getDirtyParts();
+ for (MPart part : dirtyParts) {
+ if(part.getObject() instanceof TaxonNameEditorE4){
+ TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput();
+ if(input.getTaxonNode().equals(taxonNode)){
+ return true;
+ }
+ }
+ }
return false;
}
- /**
- * <p>selectInNavigator</p>
- *
- * @param element a {@link java.lang.Object} object.
- * @param parentElement a {@link java.lang.Object} object.
- */
- public static void selectInNavigator(final Object element, final Object parentElement) {
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- TaxonNavigator navigator = showNavigator();
-
- if (navigator != null) {
- CommonViewer viewer = navigator.getCommonViewer();
- if (viewer != null) {
- if (parentElement != null) {
- viewer.setExpandedState(parentElement, true);
- }
- viewer.setSelection(new StructuredSelection(element));
- }
- }
- }
-
- });
- }
-
/**
* <p>openSearch</p>
*
}
private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) {
- if(acceptedTaxa.size() == 1){
- openEditor(acceptedTaxa.iterator().next());
- }else if(acceptedTaxa.size() > 1){
- // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
- MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE);
- }else if(acceptedTaxa.size() == 0){
- // this is an undesired state
- MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON);
- }
+ //FIXME E4 migrate/delete
+// if(acceptedTaxa.size() == 1){
+// openEditor(acceptedTaxa.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+// }else if(acceptedTaxa.size() > 1){
+// // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
+// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_MULTI_TREE);
+// }else if(acceptedTaxa.size() == 0){
+// // this is an undesired state
+// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, Messages.NavigationUtil_ORPHAN_TAXON);
+// }
}
/**
*/
private static void handleOpeningOfMultipleTaxonNodes(
Set<TaxonNode> taxonNodes) {
-
- if(taxonNodes.size() == 1){
- openEditor(taxonNodes.iterator().next());
- }else if(taxonNodes.size() > 1){
- // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
- MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software.");
- }else if(taxonNodes.size() == 0){
- // this is an undesired state
- MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE);
- }
- }
-
- /**
- * <p>showNavigator</p>
- *
- * @return the TaxonNavigator instance if present
- */
- public static TaxonNavigator showNavigator() {
- return (TaxonNavigator) showView(TaxonNavigator.ID);
- }
-
- /**
- * <p>getNavigator</p>
- *
- * @param restore a boolean.
- * @return a {@link eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator} object.
- */
- public static TaxonNavigator getNavigator(boolean restore) {
- return (TaxonNavigator) getView(TaxonNavigator.ID, restore);
- }
-
- /**
- * <p>getOpenEditors</p>
- *
- * @return a {@link java.util.Set} object.
- */
- public static Set<IEditorPart> getOpenEditors() {
- return EditorUtil.getOpenEditors();
+ //FIXME E4 migrate/delete
+//
+// if(taxonNodes.size() == 1){
+// openEditor(taxonNodes.iterator().next(), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+// }else if(taxonNodes.size() > 1){
+// // FIXME implement a dialog that shows all possible taxa and let the user choose which he wants to open.
+// MessagingUtils.warningDialog(NOT_IMPLEMENTED_YET, NavigationUtil.class, "The accepted taxon is in multiple taxonomic trees. We currently do not know which one you want to open. This case is not handled yet by the software.");
+// }else if(taxonNodes.size() == 0){
+// // this is an undesired state
+// MessagingUtils.warningDialog(Messages.NavigationUtil_INCORRECT_STATE, NavigationUtil.class, Messages.NavigationUtil_INCORRECT_STATE_MESSAGE);
+// }
}
/**
import org.eclipse.ui.IMemento;
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.preference.CdmPreferences;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
- * <p>NavigatorStateManager class.</p>
- *
* @author n.hoffmann
* @created Apr 1, 2010
* @version 1.0
*/
public class NavigatorStateManager extends ContextListenerAdapter {
-
+
/**
* {@inheritDoc}
*
*/
@Override
public void contextStart(IMemento memento, IProgressMonitor monitor) {
- TaxonNavigator navigator = NavigationUtil.getNavigator(true);
- if(navigator != null){
- navigator.init();
- if (PreferencesUtil.isStoreNavigatorState()){
- navigator.restore(memento, monitor);
- } else {
- navigator.restore(null, monitor);
- }
-
- }
+// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
+// if(navigator != null){
+// navigator.init();
+// if (PreferencesUtil.isStoreNavigatorState()){
+// navigator.restore(memento, monitor);
+// } else {
+// navigator.restore(null, monitor);
+// }
+//
+// }
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextRefresh(org.eclipse.core.runtime.IProgressMonitor)
- */
+
@Override
public void contextRefresh(IProgressMonitor monitor) {
- TaxonNavigator navigator = NavigationUtil.getNavigator(true);
- if(navigator != null){
- navigator.refresh();
- }
+// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
+// if(navigator != null){
+// navigator.refresh();
+// }
}
-
+
/**
* {@inheritDoc}
*
*/
@Override
public void contextStop(IMemento memento, IProgressMonitor monitor) {
- saveNavigatorState(memento, monitor);
- clearNavigator();
+// saveNavigatorState(memento, monitor);
+// clearNavigator();
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#workbenchShutdown(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
- */
/** {@inheritDoc} */
@Override
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
- saveNavigatorState(memento, monitor);
-
+// saveNavigatorState(memento, monitor);
+
}
-
+
/**
* @param memento
*/
private void saveNavigatorState(IMemento memento, IProgressMonitor monitor) {
- TaxonNavigator navigator = NavigationUtil.getNavigator(false);
- if(navigator != null){
- navigator.save(memento, monitor);
- }
+// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
+// if(navigator != null){
+// //FIXME E4 migrate or delete
+//// navigator.save(memento, monitor);
+// }
}
-
+
/**
* Removes all content form the TaxonNavigator
*/
private void clearNavigator() {
- TaxonNavigator navigator = NavigationUtil.getNavigator(false);
- if(navigator != null){
- navigator.clear();
- }
+// TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
+// if(navigator != null){
+// navigator.clear();
+// }
}
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.actions.ContributionItemFactory;
-import org.eclipse.ui.internal.IPreferenceConstants;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* This is a wrapper for Eclipse's recently opened editors functionality. IsDirty()
* @version 1.0
*/
public class RecentNamesContributionItem extends ContributionItem {
+ //FIXME E4 migrate recent menu items
private static final Logger logger = Logger
.getLogger(RecentNamesContributionItem.class);
//// WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 10);
// TaxeditorNavigationPlugin.getDefault().getPreferenceStore().setValue("RECENT_FILES", 10);
// }
-
+
private IContributionItem getRecentWindows() {
- if (recentWindows == null) {
-
-// int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore()
-// .getInt("RECENT_FILES");
-
- recentWindows = ContributionItemFactory.REOPEN_EDITORS.create(NavigationUtil.getActiveWindow());
- recentWindows.setParent(parent);
- }
+// if (recentWindows == null) {
+//
+//// int itemsToShow = TaxeditorNavigationPlugin.getDefault().getPreferenceStore()
+//// .getInt("RECENT_FILES");
+//
+// recentWindows = ContributionItemFactory.REOPEN_EDITORS.create(NavigationUtil.getActiveWindow());
+// recentWindows.setParent(parent);
+// }
return recentWindows;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.action.IContributionItem#dispose()
*/
/**
* 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.
*/
private UndoContext defaultUndoContext;
private static final Class[] ADAPTER_LIST = new Class[] { IUndoContext.class };
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
/** {@inheritDoc} */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (IUndoContext.class.equals(adapterType)) {
- return NavigationUtil.getWorkbenchUndoContext();
- }
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+// if (IUndoContext.class.equals(adapterType)) {
+// return NavigationUtil.getWorkbenchUndoContext();
+// }
return null;
}
*
* @return an array of {@link java.lang.Class} objects.
*/
- public Class[] getAdapterList() {
+ @Override
+ public Class[] getAdapterList() {
return ADAPTER_LIST;
}
}
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Text;
private ListViewer viewer;
private ConversationHolder conversation;
private IContextListener contextListener;
- private final CdmFormFactory formFactory;
+ private CdmFormFactory formFactory;
private Text text_filter;
private ICdmEntitySession cdmEntitySession;
private PolytomousKeyViewPartDataChangeBehavior dataChangeBehavior;
public PolytomousKeyViewPart(){
- formFactory = new CdmFormFactory(Display.getDefault());
+// formFactory = new CdmFormFactory(Display.getDefault());
}
/* (non-Javadoc)
}
public void openSelectedKeyNodes() {
- ICommandService commandService = (ICommandService)getSite().getService(ICommandService.class);
+ ICommandService commandService = getSite().getService(ICommandService.class);
Command command = commandService.getCommand(OPEN_COMMAND_ID);
if(command.isEnabled()) {
- IHandlerService handlerService = (IHandlerService)getSite().getService(IHandlerService.class);
+ IHandlerService handlerService = getSite().getService(IHandlerService.class);
try {
handlerService.executeCommand(OPEN_COMMAND_ID, null);
} catch (NotDefinedException e) {
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.key.polytomous.e4;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ */
+public class PolytomousKeyViewPartDataChangeBehaviorE4 extends
+ AbstractDataChangeBehaviour {
+
+ private static final String UPDATING_POLYTOMOUS_KEY_VIEWER = Messages.PolytomousKeyViewPartDataChangeBehavior_UPDATE;
+ private final PolytomousKeyViewPartE4 source;
+
+ public PolytomousKeyViewPartDataChangeBehaviorE4(
+ PolytomousKeyViewPartE4 polytomousKeyViewPart) {
+ source = polytomousKeyViewPart;
+ }
+
+ @Override
+ public void reactOnDataChange(CdmDataChangeMap changeEvents) {
+ if(isRelevant(changeEvents)){
+ final Display display = Display.getCurrent();
+ Job job = new Job(UPDATING_POLYTOMOUS_KEY_VIEWER) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(UPDATING_POLYTOMOUS_KEY_VIEWER, 3);
+ monitor.worked(1);
+
+ // clear the session completely
+ monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_CLEAR);
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ source.getConversationHolder().clear();
+ }
+ });
+ // FIXME completely clearing the session is a brute force approach.
+ // It would be much more elegant to clear only those elements that have been changed.
+ // I could not get that to work but we should consider workin on this because we might
+ // run into serious performance issues, especially when it comes to large trees
+ //
+ // at least, we moved this to a job so it can run in a background thred
+ // seems to improve the situation but not sure if final solution
+ monitor.worked(1);
+
+ monitor.subTask(Messages.PolytomousKeyViewPartDataChangeBehavior_REFRESH);
+
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ source.refresh();
+ }
+ });
+
+
+
+ monitor.worked(1);
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();
+
+ }
+ }
+
+ private boolean isRelevant(CdmDataChangeMap changeEvents) {
+ for(CdmDataChangeEvent event : changeEvents.getAllEvents()){
+ EventType eventType = event.getEventType();
+ CdmBase eventEntity = event.getEntity();
+
+ // all poyltomous key changes are relevant
+ if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
+ && eventEntity instanceof PolytomousKey){
+ return true;
+ }
+ }
+ return false;
+ }
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.navigation.key.polytomous.e4;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.commands.ECommandService;
+import org.eclipse.e4.core.commands.EHandlerService;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
+import eu.etaxonomy.cdm.api.application.ICdmDataChangeService;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyContentProvider;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ */
+public class PolytomousKeyViewPartE4 implements
+IConversationEnabled, ICdmEntitySessionEnabled, IPostOperationEnabled,
+ICdmChangeListener {
+
+ private class FilterModifyListener implements ModifyListener{
+ @Override
+ public void modifyText(ModifyEvent e) {
+ ViewerFilter filter = new ViewerFilter(){
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+
+ if(element instanceof PolytomousKey){
+ PolytomousKey key = (PolytomousKey) element;
+ if(key.getTitleCache().contains(text_filter.getText())){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ };
+
+ viewer.setFilters(new ViewerFilter[]{filter});
+ }
+ }
+
+
+ public static final String ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.polytomousKeyViewPart"; //$NON-NLS-1$
+
+ public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.key.polytomous.editNodes"; //$NON-NLS-1$
+
+ private class ContextListener extends ContextListenerAdapter{
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ monitor.subTask(Messages.PolytomousKeyViewPart_SHUTDOWN);
+ if(!viewer.getControl().isDisposed()){
+ viewer.setInput(null);
+ }
+ }
+
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+ monitor.subTask(Messages.PolytomousKeyViewPart_INIT);
+ setInput();
+ }
+ }
+
+ private ListViewer viewer;
+ private ConversationHolder conversation;
+ private IContextListener contextListener;
+ private final CdmFormFactory formFactory;
+ private Text text_filter;
+ private ICdmEntitySession cdmEntitySession;
+
+ private PolytomousKeyViewPartDataChangeBehaviorE4 dataChangeBehavior;
+
+
+ @Inject
+ private EHandlerService handlerService;
+
+ @Inject
+ private ECommandService commandService;
+
+ @Inject
+ private ESelectionService selService;
+
+ @Inject
+ private MDirtyable dirty;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ @Inject
+ private MPart thisPart;
+
+ public PolytomousKeyViewPartE4(){
+ formFactory = new CdmFormFactory(Display.getDefault());
+ }
+
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService) {
+
+ Composite container = new Composite(parent, SWT.NONE);
+ container.setLayout(new GridLayout());
+
+ contextListener = new ContextListener();
+ CdmStore.getContextManager().addContextListener(contextListener);
+
+ text_filter = formFactory.createText(container, ""); //$NON-NLS-1$
+ text_filter.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ text_filter.addModifyListener(new FilterModifyListener());
+
+ viewer = new ListViewer(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
+ viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ viewer.setContentProvider(new PolytomousKeyContentProvider());
+ viewer.setLabelProvider(new ColumnLabelProvider());
+
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ openSelectedKeyNodes();
+ }
+ });
+
+
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.navigation.popupmenu.polytomouskeyview");
+
+ if(CdmStore.isActive()){
+ setInput();
+ }
+ }
+
+ public void openSelectedKeyNodes() {
+ Command command = commandService.getCommand(OPEN_COMMAND_ID);
+ ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, null);
+ if(command.isEnabled()) {
+ try {
+ handlerService.executeHandler(parameterizedCommand);
+ } catch (Exception e) {
+ MessagingUtils.error(getClass(), Messages.PolytomousKeyViewPart_EXCEPTION, e);
+ }
+ }
+ }
+
+ public void setViewerSelection(ISelection selection, boolean reveal) {
+ viewer.setSelection(selection,reveal);
+ viewer.getList().notifyListeners(SWT.Selection,new Event());
+ }
+
+ private void setInput() {
+ conversation = CdmStore.createConversation();
+ conversation.registerForDataStoreChanges(this);
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ CdmApplicationState.getCurrentDataChangeService().register(this);
+
+ List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
+ if(!viewer.getControl().isDisposed()){
+ viewer.setInput(input);
+ }
+ }
+
+ @Focus
+ public void setFocus() {
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()) {
+ viewer.getControl().setFocus();
+ }
+ }
+
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ if (dataChangeBehavior == null) {
+ dataChangeBehavior = new PolytomousKeyViewPartDataChangeBehaviorE4(this);
+ }
+
+ DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ @PreDestroy
+ public void dispose() {
+ if(conversation!=null){
+ conversation.unregisterForDataStoreChanges(this);
+ conversation.close();
+ CdmStore.getContextManager().removeContextListener(contextListener);
+ }
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ ICdmDataChangeService currentDataChangeService = CdmApplicationState.getCurrentDataChangeService();
+ if(currentDataChangeService!=null){
+ currentDataChangeService.unregister(this);
+ }
+ }
+
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ getConversationHolder().bind();
+ getConversationHolder().commit(true);
+ viewer.refresh();
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return true;
+ }
+
+ public void refresh() {
+ getConversationHolder().bind();
+ //FIXME : Need to make sure this is a stable fix (ticket 3822)
+ getConversationHolder().commit();
+ List<PolytomousKey> input = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);
+ if(!viewer.getControl().isDisposed()){
+ viewer.setInput(input);
+ }
+ }
+
+ public List<PolytomousKey> getKeys() {
+ return (List<PolytomousKey>)viewer.getInput();
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ @Override
+ public List<PolytomousKey> getRootEntities() {
+ return getKeys();
+ }
+
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ if(event.getAction() == Action.Delete && PolytomousKey.class.equals(event.getEntityType())) {
+ refresh();
+ }
+
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ return null;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IStatus;
+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.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4;
+import eu.etaxonomy.taxeditor.newWizard.NewPolytomousKeyWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 28, 2017
+ *
+ */
+public class NewPolytomousKeyHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ PolytomousKeyViewPartE4 view = (PolytomousKeyViewPartE4) activePart.getObject();
+ NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard();
+ wizard.init(null,null);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ int status = dialog.open();
+ if(status == IStatus.OK) {
+ view.refresh();
+ view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true);
+ view.openSelectedKeyNodes();
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.key.polytomous.e4.handler;
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4;
+
+
+/**
+ * <p>Handler class which Refreshes each key node in the polytomous key navigation view</p>
+ *
+ * @author c.mathew
+ * @created Jan 17 2013
+ * @version 1.0
+ */
+public class RefreshPolytomousKeyListHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ PolytomousKeyViewPartE4 view = (PolytomousKeyViewPartE4) activePart.getObject();
+ view.refresh();
+ }
+}
+
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.key.polytomous.e4.handler;
+
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.PolytomousKeyViewPartE4;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RefreshNodesOperation;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+
+/**
+ * <p>RefreshPolytomousKeyNodesHandler class, which refreshes each key node in the polytomous key navigation view</p>
+ *
+ * @author c.mathew
+ * @created Jan 17 2013
+ * @version 1.0
+ */
+public class RefreshPolytomousKeyNodesHandlerE4 {
+
+ private static final String REFRESHING_POLYTOMOUS_KEY_NODES = Messages.RefreshPolytomousKeyNodesHandler_REFRESHING;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ UISynchronize sync) {
+
+ PolytomousKeyViewPartE4 view = (PolytomousKeyViewPartE4) activePart.getObject();
+
+ final List<PolytomousKey> keys = view.getKeys();
+
+ final String label = Messages.RefreshPolytomousKeyNodesHandler_REFRESH;
+
+ final IUndoContext undoContext = NavigationUtil.getUndoContext();
+ if (keys.size() > 0) {
+ Job job = new Job(REFRESHING_POLYTOMOUS_KEY_NODES){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(REFRESHING_POLYTOMOUS_KEY_NODES, keys.size());
+
+
+ for (final PolytomousKey key : keys) {
+ if(key.getRoot() != null) {
+
+ Display.getDefault().asyncExec(new Runnable(){
+
+ @Override
+ public void run() {
+ AbstractPostOperation operation = new RefreshNodesOperation(label, undoContext, key, view);
+ AbstractUtility.executeOperation(operation, sync);
+ }
+
+ });
+ monitor.worked(1);
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();
+
+ }
+ }
+ }
+
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+import eu.etaxonomy.taxeditor.util.OperationsUtil;
+
+/**
+ * @author cmathew
+ * @date 25 Jun 2015
+ *
+ */
+public class RemotingDeletePolytomousKeyHandlerE4 extends RemotingCdmHandlerE4 {
+
+ List<UUID> keysToDelete;
+ public static final String CONFIRM = Messages.DeleteHandler_CONFIRM;
+ public static final String CONFIRM_MESSAGE = Messages.DeleteHandler_CONFIRM_MESSAGE;
+
+ public RemotingDeletePolytomousKeyHandlerE4() {
+ super(PolytomousKeyViewLabels.DELETE_POLYTOMOUS_KEY_LABEL);
+ }
+
+ @Override
+ public IStatus allowOperations(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+
+ keysToDelete = OperationsUtil.convertToUuidList(selection.toList());
+
+ if(keysToDelete.isEmpty()){
+ return Status.CANCEL_STATUS;
+ }
+
+ boolean confirmation = MessagingUtils.confirmDialog(CONFIRM, CONFIRM_MESSAGE);
+
+ if(!confirmation) {
+ return Status.CANCEL_STATUS;
+ }
+ closeObsoleteEditor(partService);
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+ return new RemotingDeletePolytomousKeyOperation(getTrigger(),
+ false,
+ keysToDelete);
+ }
+
+ @Override
+ public void onComplete() {
+ }
+
+ protected void closeObsoleteEditor(EPartService partService){
+ Collection<MPart> parts = partService.getParts();
+ for (MPart part : parts) {
+ if(part.getElementId().equals("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4")){
+ PolytomousKeyListEditorE4 keyListEditor = (PolytomousKeyListEditorE4) part.getObject();
+ UUID uuidForKey = keyListEditor.getEditorInput().getKey().getUuid();
+ for (UUID keyUuid :keysToDelete) {
+ if(uuidForKey.equals(keyUuid)){
+ partService.hidePart(part, true);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler;
+
+import java.util.Collection;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+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.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingEditPolytomousKeyNodesHandlerE4 {
+
+ public static final String OPENING_POLYTOMOUS_KEYS = Messages.EditPolytomousKeyNodesHandler_OPEN_KEYS;
+
+ @Execute
+ public void execute(EModelService modelService, EPartService partService, MApplication application,
+ @Named(IServiceConstants.ACTIVE_SELECTION)Object selection) {
+
+ if(selection instanceof StructuredSelection){
+
+ final StructuredSelection structuredSelection = (StructuredSelection) selection;
+
+ Job job = new Job(OPENING_POLYTOMOUS_KEYS){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
+
+ for(final Object selectedObject : structuredSelection.toArray()){
+ if(selectedObject instanceof PolytomousKey){
+
+ Display.getDefault().asyncExec(new Runnable(){
+
+ @Override
+ public void run() {
+ try {
+ PolytomousKey key = (PolytomousKey) selectedObject;
+ PolytomousKeyEditorInput input = PolytomousKeyEditorInput.NewInstance(key.getUuid());
+
+ //check if editor already open
+ Collection<MPart> parts = partService.getParts();
+ MPart part = null;
+ //check if part is already opened
+ for (MPart mPart : parts) {
+ if(mPart.getObject() instanceof PolytomousKeyListEditorE4
+ && ((PolytomousKeyListEditorE4) mPart.getObject()).getViewerInputKey().equals(input.getKey())){
+ part = mPart;
+ break;
+ }
+ }
+ if(part==null){
+ part = partService.createPart("eu.etaxonomy.taxeditor.editor.key.polytomous.e4.PolytomousKeyListEditorE4");
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ PolytomousKeyListEditorE4 editor = (PolytomousKeyListEditorE4) part.getObject();
+ editor.init(input);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ } catch(Exception ex) {
+ MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE,
+ RemotingEditPolytomousKeyNodesHandlerE4.this,
+ ex.getLocalizedMessage());
+ ex.printStackTrace();
+ }
+ }
+
+ });
+ monitor.worked(1);
+ }
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();
+
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = ((IStructuredSelection)selection).getFirstElement() instanceof PolytomousKey;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingUpdatePolytomousKeyAllNodesOperation;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+
+/**
+ * @author cmathew
+ * @date 29 Jun 2015
+ *
+ */
+public class RemotingUpdatePolytomousKeyAllNodesHandlerE4 extends RemotingCdmHandlerE4 {
+
+ public RemotingUpdatePolytomousKeyAllNodesHandlerE4() {
+ super(PolytomousKeyViewLabels.UPDATE_ALL_POLYTOMOUS_KEY_NODES_LABEL);
+ }
+
+ @Override
+ public IStatus allowOperations(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+ return new RemotingUpdatePolytomousKeyAllNodesOperation(getTrigger(), false);
+ }
+
+ @Override
+ public void onComplete() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
+}
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.DeleteOperation;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4;
/**
* @author n.hoffmann
*/
public class DeleteHandler extends AbstractHandler {
- protected static final String CONFIRM_MESSAGE = Messages.DeleteHandler_CONFIRM_MESSAGE;
- protected static final String CONFIRM = Messages.DeleteHandler_CONFIRM;
-
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
return null;
}
- boolean confirmation = MessagingUtils.confirmDialog(CONFIRM, CONFIRM_MESSAGE);
+ boolean confirmation = MessagingUtils.confirmDialog(RemotingDeletePolytomousKeyHandlerE4.CONFIRM, RemotingDeletePolytomousKeyHandlerE4.CONFIRM_MESSAGE);
if(confirmation){
- for(PolytomousKey key : keys){
- try {
- PolytomousKeyViewPart pkvp = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
- AbstractPostOperation operation = new DeleteOperation(
- event.getCommand().getName(),
- NavigationUtil.getUndoContext(), key,
- pkvp,
- pkvp,
- pkvp);
- NavigationUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- MessagingUtils.error(getClass(), e);
- }
- }
+// for(PolytomousKey key : keys){
+// try {
+// PolytomousKeyViewPart pkvp = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+// AbstractPostOperation operation = new DeleteOperation(
+// event.getCommand().getName(),
+// NavigationUtil.getUndoContext(), key,
+// pkvp,
+// pkvp,
+// pkvp);
+// NavigationUtil.executeOperation(operation);
+// } catch (NotDefinedException e) {
+// MessagingUtils.error(getClass(), e);
+// }
+// }
}
return null;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Display;
-
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
/**
* @author n.hoffmann
*/
public class EditPolytomousKeyNodesHandler extends AbstractHandler {
- protected static final String OPENING_POLYTOMOUS_KEYS = Messages.EditPolytomousKeyNodesHandler_OPEN_KEYS;
-
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
-
- ISelection selection = view.getSite().getSelectionProvider().getSelection();
- if(selection instanceof StructuredSelection){
-
- final StructuredSelection structuredSelection = (StructuredSelection) selection;
-
- Job job = new Job(OPENING_POLYTOMOUS_KEYS){
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
-
- for(final Object selectedObject : structuredSelection.toArray()){
- if(selectedObject instanceof PolytomousKey){
-
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- NavigationUtil.openEditor((PolytomousKey) selectedObject);
- }
-
- });
- monitor.worked(1);
- }
- }
- monitor.done();
- return Status.OK_STATUS;
- }
-
- };
-
- job.setPriority(Job.SHORT);
- job.schedule();
-
- }
+// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+//
+// ISelection selection = view.getSite().getSelectionProvider().getSelection();
+// if(selection instanceof StructuredSelection){
+//
+// final StructuredSelection structuredSelection = (StructuredSelection) selection;
+//
+// Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
+//
+// for(final Object selectedObject : structuredSelection.toArray()){
+// if(selectedObject instanceof PolytomousKey){
+//
+// Display.getDefault().asyncExec(new Runnable(){
+//
+// @Override
+// public void run() {
+//// NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+// }
+//
+// });
+// monitor.worked(1);
+// }
+// }
+// monitor.done();
+// return Status.OK_STATUS;
+// }
+//
+// };
+//
+// job.setPriority(Job.SHORT);
+// job.schedule();
+//
+// }
return null;
}
/**\r
* Copyright (C) 2007 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
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.commands.IHandler;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.jface.viewers.StructuredSelection;\r
-import org.eclipse.jface.wizard.WizardDialog;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;\r
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;\r
-import eu.etaxonomy.taxeditor.newWizard.NewPolytomousKeyWizard;\r
\r
/**\r
* <p>NewTaxonNodeHandler class.</p>\r
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
*/\r
/** {@inheritDoc} */\r
+ @Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
- NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard();\r
- wizard.init(null,null);\r
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);\r
- int status = dialog.open(); \r
- if(status == Status.OK) { \r
- PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false); \r
- //List<PolytomousKey> pklist = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null); \r
- view.refresh(); \r
- view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true); \r
- view.openSelectedKeyNodes(); \r
- }\r
+// NewPolytomousKeyWizard wizard = new NewPolytomousKeyWizard();\r
+// wizard.init(null,null);\r
+// WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);\r
+// int status = dialog.open();\r
+// if(status == Status.OK) {\r
+// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);\r
+// //List<PolytomousKey> pklist = CdmStore.getService(IPolytomousKeyService.class).list(PolytomousKey.class, null, null, null, null);\r
+// view.refresh();\r
+// view.setViewerSelection(new StructuredSelection(wizard.getEntity()),true);\r
+// view.openSelectedKeyNodes();\r
+// }\r
return null;\r
}\r
}\r
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
-
/**
* <p>Handler class which Refreshes each key node in the polytomous key navigation view</p>
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
- view.refresh();
+// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+// view.refresh();
return null;
}
}
package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler;
-import java.util.List;
-
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.swt.widgets.Display;
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RefreshNodesOperation;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
/**
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- final PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
- final List<PolytomousKey> keys = view.getKeys();
-
- final String label = Messages.RefreshPolytomousKeyNodesHandler_REFRESH;
-
- final IUndoContext undoContext = NavigationUtil.getUndoContext();
- if (keys.size() > 0) {
- Job job = new Job(REFRESHING_POLYTOMOUS_KEY_NODES){
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(REFRESHING_POLYTOMOUS_KEY_NODES, keys.size());
-
-
- for (final PolytomousKey key : keys) {
- if(key.getRoot() != null) {
-
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- AbstractPostOperation operation = new RefreshNodesOperation(label, undoContext, key, view);
- NavigationUtil.executeOperation(operation);
- }
-
- });
- monitor.worked(1);
- }
- }
- monitor.done();
- return Status.OK_STATUS;
- }
-
- };
-
- job.setPriority(Job.SHORT);
- job.schedule();
-
- }
+// final PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+// final List<PolytomousKey> keys = view.getKeys();
+//
+// final String label = Messages.RefreshPolytomousKeyNodesHandler_REFRESH;
+//
+// final IUndoContext undoContext = NavigationUtil.getUndoContext();
+// if (keys.size() > 0) {
+// Job job = new Job(REFRESHING_POLYTOMOUS_KEY_NODES){
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// monitor.beginTask(REFRESHING_POLYTOMOUS_KEY_NODES, keys.size());
+//
+//
+// for (final PolytomousKey key : keys) {
+// if(key.getRoot() != null) {
+//
+// Display.getDefault().asyncExec(new Runnable(){
+//
+// @Override
+// public void run() {
+// AbstractPostOperation operation = new RefreshNodesOperation(label, undoContext, key, view);
+// NavigationUtil.executeOperation(operation);
+// }
+//
+// });
+// monitor.worked(1);
+// }
+// }
+// monitor.done();
+// return Status.OK_STATUS;
+// }
+//
+// };
+//
+// job.setPriority(Job.SHORT);
+// job.schedule();
+//
+// }
return null;
}
}
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
+import eu.etaxonomy.taxeditor.navigation.key.polytomous.e4.handler.RemotingDeletePolytomousKeyHandlerE4;
import eu.etaxonomy.taxeditor.navigation.key.polytomous.operation.RemotingDeletePolytomousKeyOperation;
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
import eu.etaxonomy.taxeditor.util.OperationsUtil;
return Status.CANCEL_STATUS;
}
- boolean confirmation = MessagingUtils.confirmDialog(DeleteHandler.CONFIRM, DeleteHandler.CONFIRM_MESSAGE);
+ boolean confirmation = MessagingUtils.confirmDialog(RemotingDeletePolytomousKeyHandlerE4.CONFIRM, RemotingDeletePolytomousKeyHandlerE4.CONFIRM_MESSAGE);
if(!confirmation) {
return Status.CANCEL_STATUS;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Display;
-
-import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewLabels;
-import eu.etaxonomy.taxeditor.navigation.key.polytomous.PolytomousKeyViewPart;
/**
* @author cmathew
*/
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
- PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
-
- ISelection selection = view.getSite().getSelectionProvider().getSelection();
- if(selection instanceof StructuredSelection){
-
- final StructuredSelection structuredSelection = (StructuredSelection) selection;
-
- Job job = new Job(EditPolytomousKeyNodesHandler.OPENING_POLYTOMOUS_KEYS){
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(EditPolytomousKeyNodesHandler.OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
-
- for(final Object selectedObject : structuredSelection.toArray()){
- if(selectedObject instanceof PolytomousKey){
-
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- try {
- PolytomousKey key = (PolytomousKey) selectedObject;
- EditorUtil.openPolytomousKey(key.getUuid());
- } catch(Exception ex) {
- MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE,
- event.getTrigger(),
- ex.getLocalizedMessage());
- ex.printStackTrace();
- }
- }
-
- });
- monitor.worked(1);
- }
- }
- monitor.done();
- return Status.OK_STATUS;
- }
-
- };
-
- job.setPriority(Job.SHORT);
- job.schedule();
-
- }
+// PolytomousKeyViewPart view = (PolytomousKeyViewPart) NavigationUtil.getView(PolytomousKeyViewPart.ID, false);
+//
+// ISelection selection = view.getSite().getSelectionProvider().getSelection();
+// if(selection instanceof StructuredSelection){
+//
+// final StructuredSelection structuredSelection = (StructuredSelection) selection;
+//
+// Job job = new Job(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS){
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// monitor.beginTask(RemotingEditPolytomousKeyNodesHandlerE4.OPENING_POLYTOMOUS_KEYS, structuredSelection.size());
+//
+// for(final Object selectedObject : structuredSelection.toArray()){
+// if(selectedObject instanceof PolytomousKey){
+//
+// Display.getDefault().asyncExec(new Runnable(){
+//
+// @Override
+// public void run() {
+// try {
+// PolytomousKey key = (PolytomousKey) selectedObject;
+// EditorUtil.openPolytomousKey(key.getUuid());
+// } catch(Exception ex) {
+// MessagingUtils.warningDialog(PolytomousKeyViewLabels.ERROR_OPENING_KEY_EDITOR_MESSAGE,
+// event.getTrigger(),
+// ex.getLocalizedMessage());
+// ex.printStackTrace();
+// }
+// }
+//
+// });
+// monitor.worked(1);
+// }
+// }
+// monitor.done();
+// return Status.OK_STATUS;
+// }
+//
+// };
+//
+// job.setPriority(Job.SHORT);
+// job.schedule();
+//
+// }
return null;
}
public static String NavigationUtil_NOT_FOUND;
public static String NavigationUtil_NOT_FOUND_MESSAGE;
public static String NavigationUtil_NOT_IMPLEMENTED;
- public static String NavigationUtil_OPEN_ERROR;
public static String NavigationUtil_ORPHAN_NAME_MESSAGE;
public static String NavigationUtil_ORPHAN_TAXON;
public static String NavigationUtil_UNKNOWN_TYPE;
public static String TreeNodeDropAdapter_TARGET_NODE;
public static String TreeNodeDropAdapter_UNSAVED_PARENT;
public static String TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE;
+ public static String SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP;
+ public static String TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN;
static {
NavigationUtil_NOT_FOUND=Cdm entity not found
NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database.
NavigationUtil_NOT_IMPLEMENTED=Not implemented yet
-NavigationUtil_OPEN_ERROR=Error opening the editor
NavigationUtil_ORPHAN_NAME_MESSAGE=You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.
NavigationUtil_ORPHAN_TAXON=This taxon is not connected to a classification. Currently editing of such taxa is not supported yet.
NavigationUtil_UNKNOWN_TYPE=Unknown type
TreeNodeDropAdapter_TARGET_NODE=Target node
TreeNodeDropAdapter_UNSAVED_PARENT=Unsaved Parent Taxon
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=There are unsaved changes in the parent taxon. Please save first.
+SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Change publish flag for all children
+TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=Change publish flag for all children
NavigationUtil_NOT_FOUND=Cdm entity not found
NavigationUtil_NOT_FOUND_MESSAGE=CDM entity could not be found in the database.
NavigationUtil_NOT_IMPLEMENTED=Noch nicht implementiert
-NavigationUtil_OPEN_ERROR=Fehler beim Öffnen des Editors
NavigationUtil_ORPHAN_NAME_MESSAGE=Sie versuchen eine Namen ohne Verbindung zu einem Taxon zu öffnen. Der Taxonomic Editor unterstützt aktuell kein Editieren solcher Objekte.
NavigationUtil_ORPHAN_TAXON=Das Taxon ist in keine Klassifikation vorhanden. Der Taxonomic Editor unterstützt aktuell kein Editieren solcher Objekte.
NavigationUtil_UNKNOWN_TYPE=Unknown type
RemotingUpdatePolytomousKeyAllNodesOperation_UPDATE_OP=Alle polytomen Schlüssel updaten
Root_CREATE_CLASSIFICATION=Initiale Klassifikation erstellen
Root_MY_CLASSIFICATION=My Classification
-SearchBar_0=Benutze "*" f\u00FCr Platzhalter-Suche
+SearchBar_0='*' f\u00FCr Platzhalter-Suche benutzen
SearchBar_1=Suche
SearchBar_2=Suche konnte nicht ausgef\u00FChrt werden
SearchBar_3=Bitte geben Sie mindestens einen Buchstaben ein
TreeNodeDropAdapter_UNSAVED_PARENT=Ungespeichertes Eltern-Taxon
TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE=Es gibt Änderungen in dem Eltern-Taxon. Bitte speichern Sie erst.
+SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP=Publish Flag für alle Kinder ändern
+TaxonNavigatorLabels_SET_PUBLISH_FOR_CHILDREN=Ändere Publish Flag für alle Kinder
+
import eu.etaxonomy.cdm.model.common.ITreeNode;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.operation.CreateClassification;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
List<Classification> classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths);
List<ITreeNode> rootNodes = new ArrayList<>();
-
- if(classifications.size() == 0){
- Classification classification = Classification.NewInstance(Messages.Root_MY_CLASSIFICATION);
- AbstractPostOperation operation = new CreateClassification(Messages.Root_CREATE_CLASSIFICATION, NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
- NavigationUtil.executeOperation(operation);
- classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths);
+ if(classifications.size() == 0){
+ //FIXME E4 migrate or delete; when does this happen and SHOULD this happen?
+// Classification classification = Classification.NewInstance(Messages.Root_MY_CLASSIFICATION);
+// AbstractPostOperation operation = new CreateClassification(Messages.Root_CREATE_CLASSIFICATION, NavigationUtil.getUndoContext(), classification, NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
+// NavigationUtil.executeOperation(operation);
+//
+// classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, propertyPaths);
}
for (Classification classification: classifications){
rootNodes.add(classification.getRootNode());
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
-import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.ICdmBase;
import eu.etaxonomy.cdm.model.common.ITreeNode;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
// closing the whole application
// should be handled by the state manager too
root = new Root(conversation);
-
+
return root;
}
return new EmptyRoot();
CdmApplicationState.getCurrentDataChangeService().register(this);
}
CdmStore.getLoginManager().addObserver(this);
-
-
+
+
}
/**
/** {@inheritDoc} */
@Override
protected void handleDoubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if(selection instanceof IStructuredSelection){
- Object firstElement = ((IStructuredSelection) selection).getFirstElement();
- if(firstElement instanceof ICdmBase){
- NavigationUtil.openEditor((ICdmBase) firstElement);
- }
- }
+// ISelection selection = event.getSelection();
+// if(selection instanceof IStructuredSelection){
+// Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+// if(firstElement instanceof ICdmBase){
+// NavigationUtil.openEditor((ICdmBase) firstElement, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
+// }
+// }
// If the double click is passed up to the super-class it will
// expand/collapse trees.
// We do not want that
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
/**
return true;
}
- // name updates of the accepted taxon of open editors are relevant
- if(eventType == EventType.UPDATE && event.getEntity() instanceof TaxonName){
- TaxonName name = null;
- if(eventEntity instanceof TaxonName){
- name = (TaxonName) eventEntity;
- }else if(eventEntity instanceof Taxon){
- name = ((Taxon) eventEntity).getName();
- }else{
- continue;
- }
-
- Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
- /*for(IEditorPart editor : openEditors){
-
- if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){
- return true;
- }
- }*/
- }
if (eventType == EventType.DELETE){
return true;
}
return ((Classification)e1).getTitleCache().compareTo(((Classification)e2).getTitleCache());
} else{
if (((TaxonNode)e1).getTaxon() == null && ((TaxonNode)e2).getTaxon() == null){
- return ((TaxonNode)e1).getClassification().getTitleCache().compareTo(((TaxonNode)e2).getClassification().getTitleCache());
+ String title1 = ((TaxonNode)e1).getClassification().getTitleCache();
+ title1 = title1 == null ? "" : title1;
+ return title1.compareTo(((TaxonNode)e2).getClassification().getTitleCache());
}else{
return comparator.compare((TaxonNode)e1, (TaxonNode)e2);
}
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.UUID;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
private boolean moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) {
- TaxonNavigator taxonNavigator;
- taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
-
- if(targetITaxonTreeNode instanceof TaxonNode){
-
- TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode;
- // Make sure parent taxon does not have unsaved changes
- if (NavigationUtil.isDirty(targetTaxonNode)){
- MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE);
- return false;
- }
-
- }
- Iterator<TaxonNode> taxIterator = taxonNodes.iterator();
- Set<UUID> uuids = new HashSet<UUID>();
- TaxonNode node = null;
- while(taxIterator.hasNext()){
- node = taxIterator.next();
- uuids.add(node.getUuid());
- }
- if (!PreferencesUtil.getSortNodesNaturally()){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return false;
- }
-
- AbstractPostOperation<?> operation = new MoveTaxonOperation
- (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
- NavigationUtil.executeOperation(operation);
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return true;
- }else{
- String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL};
- MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
- dialog.open();
- int returnCode = dialog.getReturnCode();
- if (returnCode == 0){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return false;
- }
-
- AbstractPostOperation<?> operation = new MoveTaxonOperation
- (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
- NavigationUtil.executeOperation(operation);
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return true;
- }else if (returnCode == 1){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return false;
- }
- TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
-
- AbstractPostOperation<?> operation = new MoveTaxonOperation
- (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS);
- NavigationUtil.executeOperation(operation);
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return true;
- }
-// } else if (returnCode == 2){
-// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
-// if (workspaceUndoContext == null) {
-// logger.error("Workspace undo context is null. DND operation cancelled");
-// return false;
-// }
-// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+// TaxonNavigator taxonNavigator;
+// taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
+//
+// if(targetITaxonTreeNode instanceof TaxonNode){
+//
+// TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode;
+// // Make sure parent taxon does not have unsaved changes
+//// if (NavigationUtil.isDirty(targetTaxonNode)){
+//// MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE);
+//// return false;
+//// }
+//
+// }
+// Iterator<TaxonNode> taxIterator = taxonNodes.iterator();
+// Set<UUID> uuids = new HashSet<UUID>();
+// TaxonNode node = null;
+// while(taxIterator.hasNext()){
+// node = taxIterator.next();
+// uuids.add(node.getUuid());
+// }
+// if (!PreferencesUtil.getSortNodesNaturally()){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return false;
+// }
+//
+// AbstractPostOperation<?> operation = new MoveTaxonOperation
+// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
+// NavigationUtil.executeOperation(operation);
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return true;
+// }else{
+// String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL};
+// MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+// dialog.open();
+// int returnCode = dialog.getReturnCode();
+// if (returnCode == 0){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return false;
+// }
//
-// AbstractPostOperation operation = new MoveTaxonOperation
-// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
-// NavigationUtil.executeOperation(operation);
+// AbstractPostOperation<?> operation = new MoveTaxonOperation
+// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, this, taxonNavigator, MovingType.CHILD);
+// NavigationUtil.executeOperation(operation);
//
-// logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
-// return true;
-// }
- else{
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return true;
+// }else if (returnCode == 1){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return false;
+// }
+// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+//
+// AbstractPostOperation<?> operation = new MoveTaxonOperation
+// (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS);
+// NavigationUtil.executeOperation(operation);
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return true;
+// }
+//// } else if (returnCode == 2){
+//// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+//// if (workspaceUndoContext == null) {
+//// logger.error("Workspace undo context is null. DND operation cancelled");
+//// return false;
+//// }
+//// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+////
+//// AbstractPostOperation operation = new MoveTaxonOperation
+//// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
+//// NavigationUtil.executeOperation(operation);
+////
+//// logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+//// return true;
+//// }
+// else{
return false;
- }
-
-
- }
+// }
+//
+//
+// }
}
/** {@inheritDoc} */
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import java.util.UUID;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.operations.AbstractOperation;
-import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreeSelection;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
*/
private IStatus moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) {
- TaxonNavigator taxonNavigator;
- taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
-
- if(targetITaxonTreeNode instanceof TaxonNode){
-
- TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode;
- // Make sure parent taxon does not have unsaved changes
- if (NavigationUtil.isDirty(targetTaxonNode)){
- MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE);
- return Status.CANCEL_STATUS;
- }
-
- }
- Iterator<TaxonNode> taxIterator = taxonNodes.iterator();
- Set<UUID> uuids = new HashSet<>();
- TaxonNode node = null;
- while(taxIterator.hasNext()){
- node = taxIterator.next();
- uuids.add(node.getUuid());
- }
- if (!PreferencesUtil.getSortNodesNaturally()){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return Status.CANCEL_STATUS;
- }
-
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
- NavigationUtil.executeOperation(operation, null);
-
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return Status.OK_STATUS;
- }else{
- String[] buttonLables = {TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CHILD, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_BEHIND, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CANCEL};
- MessageDialog dialog = new MessageDialog(null, TreeNodeDropAdapter.TARGET_NODE, null, TreeNodeDropAdapter.DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
- dialog.open();
- int returnCode = dialog.getReturnCode();
- if (returnCode == 0){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return Status.CANCEL_STATUS;
- }
-
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
- NavigationUtil.executeOperation(operation, null);
-
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return Status.OK_STATUS;
- }else if (returnCode == 1){
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
- return Status.CANCEL_STATUS;
- }
- TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
-
- AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND);
- NavigationUtil.executeOperation(operation, null);
-
- logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
- return Status.OK_STATUS;
-// }else if (returnCode == 2){
-// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
-// if (workspaceUndoContext == null) {
-// logger.error("Workspace undo context is null. DND operation cancelled");
-// return Status.CANCEL_STATUS;
-// }
-// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+// TaxonNavigator taxonNavigator;
+// taxonNavigator = (TaxonNavigator) AbstractUtility.showView(TaxonNavigator.ID);
+//
+// if(targetITaxonTreeNode instanceof TaxonNode){
+//
+// TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode;
+// // Make sure parent taxon does not have unsaved changes
+//// if (NavigationUtil.isDirty(targetTaxonNode)){
+//// MessageDialog.openWarning(NavigationUtil.getShell(), TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE);
+//// return Status.CANCEL_STATUS;
+//// }
+//
+// }
+// Iterator<TaxonNode> taxIterator = taxonNodes.iterator();
+// Set<UUID> uuids = new HashSet<>();
+// TaxonNode node = null;
+// while(taxIterator.hasNext()){
+// node = taxIterator.next();
+// uuids.add(node.getUuid());
+// }
+// if (!PreferencesUtil.getSortNodesNaturally()){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return Status.CANCEL_STATUS;
+// }
+//
+// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
+// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
//
-// if(CdmStore.getCurrentSessionManager().isRemoting()) {
-// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.PREVIOUS);
-// NavigationUtil.executeOperation(operation, null);
-// } else {
-// AbstractPostOperation operation = new MoveTaxonOperation
-// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS);
-// NavigationUtil.executeOperation(operation);
-// }
-// logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
-// return Status.OK_STATUS;
- } else{
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return Status.OK_STATUS;
+// }else{
+// String[] buttonLables = {TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CHILD, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_BEHIND, TreeNodeDropAdapter.TREE_NODE_DROP_ADAPTER_CANCEL};
+// MessageDialog dialog = new MessageDialog(null, TreeNodeDropAdapter.TARGET_NODE, null, TreeNodeDropAdapter.DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+// dialog.open();
+// int returnCode = dialog.getReturnCode();
+// if (returnCode == 0){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return Status.CANCEL_STATUS;
+// }
+//
+// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
+// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
+//
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return Status.OK_STATUS;
+// }else if (returnCode == 1){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+// return Status.CANCEL_STATUS;
+// }
+// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+//
+// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND);
+// AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+// return Status.OK_STATUS;
+//// }else if (returnCode == 2){
+//// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+//// if (workspaceUndoContext == null) {
+//// logger.error("Workspace undo context is null. DND operation cancelled");
+//// return Status.CANCEL_STATUS;
+//// }
+//// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+////
+//// if(CdmStore.getCurrentSessionManager().isRemoting()) {
+//// AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.PREVIOUS);
+//// NavigationUtil.executeOperation(operation, null);
+//// } else {
+//// AbstractPostOperation operation = new MoveTaxonOperation
+//// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.PREVIOUS);
+//// NavigationUtil.executeOperation(operation);
+//// }
+//// logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+//// return Status.OK_STATUS;
+// } else{
return Status.CANCEL_STATUS;
- }
- }
+// }
+// }
}
/** {@inheritDoc} */
--- /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.navigation.navigator.e4;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+import eu.etaxonomy.cdm.hibernate.HHH_9751_Util;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.Root;
+
+/**
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class TaxonNavigatorContentProviderE4 implements ITreeContentProvider {
+
+ private static final Object[] NO_CHILDREN = new Object[0];
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return this.getChildren(inputElement);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] children = null;
+
+ if (parentElement instanceof Root) {
+ children = ((Root) parentElement).getParentBeans().toArray();
+ }else if(parentElement instanceof Classification){
+ children = ((Classification) parentElement).getChildNodes().toArray();
+ }
+ //FIXME E4 show synonym in navigator?
+// //synonym
+// if (parentElement instanceof Synonym) {
+// children = NO_CHILDREN;
+// } else if (parentElement instanceof TaxonNode) {
+// List<TaxonBase> list = new ArrayList<TaxonBase>();
+//
+// Taxon taxon = ((TaxonNode) parentElement).getTaxon();
+//
+// for (TaxonBase taxonBase : new IterableSynonymyList(taxon)) {
+// if (taxonBase instanceof Synonym) {
+// list.add(taxonBase);
+// }
+// }
+// children = list.toArray();
+// }
+ //taxon node
+ if(parentElement instanceof ITaxonTreeNode){
+ ITaxonTreeNode treeNode = (ITaxonTreeNode) HibernateProxyHelper.deproxy(parentElement);
+ List<TaxonNode> childrenSet = treeNode.getChildNodes();
+ HHH_9751_Util.removeAllNull(childrenSet);
+ children = childrenSet.toArray();
+ }
+ return children != null ? children : NO_CHILDREN;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Object getParent(Object element) {
+ if(element instanceof TaxonNode){
+ return ((TaxonNode) element).getParent();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean hasChildren(Object element) {
+ if(element instanceof TaxonNode){
+ return ((TaxonNode) element).getCountChildren() > 0;
+ }
+ return this.getChildren(element).length > 0;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.navigator.e4;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonName;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeEvent.EventType;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractDataChangeBehaviour;
+import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+
+/**
+ * <p>TaxonNavigatorDataChangeBehavior class.</p>
+ *
+ * @author n.hoffmann
+ * @created 01.04.2009
+ * @version 1.0
+ */
+public class TaxonNavigatorDataChangeBehaviorE4 extends AbstractDataChangeBehaviour implements
+ IDataChangeBehavior {
+
+ private static final String UPDATING_TAXON_NAVIGATOR = Messages.TaxonNavigatorDataChangeBehavior_UPDATE_NAVIGATOR;
+
+ private final TaxonNavigatorE4 source;
+
+ private Set<CdmBase> staleObjects;
+
+ /**
+ * <p>Constructor for TaxonNavigatorDataChangeBehavior.</p>
+ *
+ * @param taxonNavigator a {@link eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator} object.
+ */
+ public TaxonNavigatorDataChangeBehaviorE4(TaxonNavigatorE4 taxonNavigator) {
+ source = taxonNavigator;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.store.model.IDataChangeBehavior#isRelevant(java.lang.Object, eu.etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
+ */
+ /**
+ * <p>isRelevant</p>
+ *
+ * @param events a {@link eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap} object.
+ * @return a boolean.
+ */
+ public boolean isRelevant(CdmDataChangeMap events) {
+
+ // TODO react only on insert/update/delete of taxon and synonym objects
+ // and on update of name objects
+ boolean relevant = false;
+ staleObjects = new HashSet<CdmBase>();
+
+ for(CdmDataChangeEvent event : events.getAllEvents()){
+ EventType eventType = event.getEventType();
+ CdmBase eventEntity = event.getEntity();
+
+ Set<CdmBase> affectedObjects = event.getAffectedObjects();
+ if(affectedObjects != null) {
+ for(CdmBase cb : affectedObjects) {
+ staleObjects.add(HibernateProxyHelper.deproxy(cb));
+ }
+ }
+
+ // all tree node changes are relevant
+ if((eventType == EventType.INSERT || eventType == EventType.DELETE || eventType == EventType.UPDATE)
+ && event.getEntity() instanceof ITaxonTreeNode){
+ return true;
+ }
+
+ if (eventType == EventType.DELETE){
+ return true;
+ }
+
+
+
+ if(eventType == EventType.UPDATE && event.getEntity() instanceof Taxon){
+ TaxonName name = null;
+ if(eventEntity instanceof Taxon){
+ name = ((Taxon) eventEntity).getName();
+ }else{
+ continue;
+ }
+
+ // Set<IEditorPart> openEditors = NavigationUtil.getOpenEditors();
+ /*for(IEditorPart editor : openEditors){
+
+ if(name.equals(((TaxonEditorInput) editor.getEditorInput()).getTaxon().getName())){
+ return true;
+ }
+ }*/
+ }
+
+// if(eventType == EventType.UPDATE){
+// relevant = true;
+// CdmBase entity = event.getEntity();
+// if((entity instanceof TaxonNameBase)
+// || (entity instanceof Taxon)
+// || (entity instanceof Synonym)){
+// staleObjects.add(entity);
+// }
+// }
+ }
+
+ return false;
+
+ // @deprecated
+ // react on everything except load
+// if(events.sizeByEventType(EventType.INSERT) > 0){
+// return true;
+// }else if(events.sizeByEventType(EventType.UPDATE) > 0){
+// return true;
+// }else if(events.sizeByEventType(EventType.DELETE) > 0){
+// return true;
+// }else{
+// return false;
+// }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void reactOnDataChange(CdmDataChangeMap events) {
+ if(isRelevant(events)){
+
+ final Display display = Display.getCurrent();
+ Job job = new Job(UPDATING_TAXON_NAVIGATOR) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask(UPDATING_TAXON_NAVIGATOR, 3);
+ monitor.worked(1);
+
+ // clear the session completely
+ monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_CLEAR_SESSION);
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ source.getConversationHolder().clear();
+ }
+ });
+ // FIXME completely clearing the session is a brute force approach.
+ // It would be much more elegant to clear only those elements that have been changed.
+ // I could not get that to work but we should consider workin on this because we might
+ // run into serious performance issues, especially when it comes to large trees
+ //
+ // at least, we moved this to a job so it can run in a background thred
+ // seems to improve the situation but not sure if final solution
+ monitor.worked(1);
+
+ monitor.subTask(Messages.TaxonNavigatorDataChangeBehavior_REFRESH_VIEWER);
+
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if(staleObjects != null && staleObjects.size() > 0) {
+ source.refresh(staleObjects);
+ } else {
+ source.refresh();
+ }
+ }
+ });
+
+
+
+ monitor.worked(1);
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+ };
+
+ job.setPriority(Job.SHORT);
+ job.schedule();
+
+ }
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.navigation.navigator.e4;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.core.commands.operations.UndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
+import eu.etaxonomy.cdm.api.application.ICdmChangeListener;
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.ITreeNode;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNaturalComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeByNameComparator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNodeByRankAndNameComparator;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.DataChangeBridge;
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.EmptyRoot;
+import eu.etaxonomy.taxeditor.navigation.navigator.Root;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNodeNavigatorComparator;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.LoginManager;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 7, 2017
+ *
+ */
+public class TaxonNavigatorE4 implements
+ IPostOperationEnabled, IConversationEnabled, Observer,
+ ICdmEntitySessionEnabled, ICdmChangeListener, IContextListener,
+ ICollapsableExpandable {
+
+ private static final String RESTORING_TAXON_NAVIGATOR = Messages.TaxonNavigator_RESTORE;
+
+ private static final String TREE_PATH = "treepath"; //$NON-NLS-1$
+
+ private static final String TREE_PATHS = "treepaths"; //$NON-NLS-1$
+
+ private final int dndOperations = DND.DROP_MOVE;
+
+ private ConversationHolder conversation;
+
+ private ICdmEntitySession cdmEntitySession;
+
+ private IDataChangeBehavior dataChangeBehavior;
+
+ private Root root;
+
+ private TreeViewer viewer;
+
+ @Inject
+ private ESelectionService selService;
+
+ @Inject
+ private UISynchronize sync;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ private UndoContext undoContext;
+
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private EPartService partService;
+
+ private boolean linkWithTaxon = false;
+
+ @Inject
+ public TaxonNavigatorE4() {
+ undoContext = new UndoContext();
+ CdmStore.getContextManager().addContextListener(this);
+ }
+
+ @PostConstruct
+ private void create(Composite parent, EMenuService menuService){
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.type = SWT.VERTICAL;
+
+ parent.setLayout(layout);
+ viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
+ viewer.getControl().setLayoutData(LayoutConstants.FILL());
+
+ viewer.setContentProvider(new TaxonNavigatorContentProviderE4());
+ viewer.setLabelProvider(new TaxonNavigatorLabelProviderE4());
+ viewer.addDoubleClickListener(event->{
+ ISelection selection = event.getSelection();
+ if(selection instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if(firstElement instanceof ICdmBase){
+ NavigationUtil.openEditor((ICdmBase) firstElement, viewer.getControl().getShell(), modelService, partService, application);
+ }
+ }
+ });
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+ viewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator");
+
+ //add drag'n'drop support
+ Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer()};
+ viewer.addDragSupport(dndOperations, transfers, new TreeNodeDragListenerE4(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new TreeNodeDropAdapterE4(this));
+
+ //add toolbar
+// MToolBar toolBar = MMenuFactory.INSTANCE.createToolBar();
+// MHandledToolItem linkWithEditor = MMenuFactory.INSTANCE.createHandledToolItem();
+// linkWithEditor.setIconURI("platform:/plugin/eu.etaxonomy.taxeditor.store/icons/synced.gif");
+// Command command = commandService.getCommand("eu.etaxonomy.taxeditor.navigation.command.linkWithTaxon");
+// MCommand mCommand = MCommandsFactory.INSTANCE.createCommand();
+// mCommand.setElementId(command.getId());
+// try {
+// mCommand.setCommandName(command.getName());
+// } catch (NotDefinedException e) {
+// e.printStackTrace();
+// }
+// linkWithEditor.setCommand(mCommand);
+// linkWithEditor.setType(ItemType.CHECK);
+// toolBar.getChildren().add(linkWithEditor);
+// thisPart.setToolbar(toolBar);
+
+ init();
+ }
+
+ /** {@inheritDoc} */
+ protected IAdaptable getInitialInput() {
+ Comparator<TaxonNode> comparator;
+ if (PreferencesUtil.getSortNodesNaturally()){
+ comparator = new TaxonNaturalComparator();
+ } else if (PreferencesUtil.getSortNodesStrictlyAlphabetically()){
+ comparator = new TaxonNodeByNameComparator();
+ }else {
+ comparator = new TaxonNodeByRankAndNameComparator();
+ }
+ TaxonNodeNavigatorComparator viewerComparator = new TaxonNodeNavigatorComparator(comparator);
+ viewer.setComparator(viewerComparator);
+
+ if (CdmStore.isActive()) {
+
+ // TODO when closing and reopening the taxon navigator
+ // we do not preserve state. Closing the view, in contrary to
+ // closing the whole application
+ // should be handled by the state manager too
+ root = new Root(conversation);
+
+ return root;
+ }
+ return new EmptyRoot();
+ }
+
+ public void init() {
+ if (CdmStore.isActive() && conversation == null) {
+ conversation = CdmStore.createConversation();
+ conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
+ }
+ if (CdmStore.isActive()) {
+ cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
+ CdmApplicationState.getCurrentDataChangeService().register(this);
+ }
+ CdmStore.getLoginManager().addObserver(this);
+ viewer.setInput(getInitialInput());
+ }
+
+ //Link with taxon selection
+ @Inject
+ @Optional
+ public void updateCurrentTaxon(@UIEventTopic(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR)ITaxonEditor editor){
+ if(linkWithTaxon && editor!=null){
+ viewer.refresh();
+ TaxonNode taxonNode = null;
+ if(editor.getTaxon()!=null && editor.getTaxon().getTaxonNodes()!=null){
+ taxonNode = editor.getTaxon().getTaxonNodes().iterator().next();
+ viewer.reveal(taxonNode);
+ viewer.setSelection(new StructuredSelection(taxonNode));
+ }
+ }
+ }
+
+ public void setLinkWithTaxon(boolean linkWithTaxon) {
+ this.linkWithTaxon = linkWithTaxon;
+ }
+
+ public boolean isLinkWithTaxon() {
+ return linkWithTaxon;
+ }
+
+ /**
+ * Refresh this navigators viewer
+ */
+ public void refresh() {
+ if(getConversationHolder() != null){
+ getConversationHolder().bind();
+ //FIXME : Need to make sure this is a stable fix (ticket 3822)
+ if(!getConversationHolder().isCompleted()){
+ getConversationHolder().commit();
+ }
+ }
+ if(!viewer.getTree().isDisposed()){
+ viewer.refresh();
+ }
+ }
+
+ /**
+ * Refresh this navigators viewer
+ */
+ public void refresh(Set<?> objects) {
+ for(Object obj : objects) {
+ viewer.refresh(obj);
+ }
+ }
+
+ /**
+ * Removes all content
+ */
+ public void clear() {
+ viewer.setInput(new EmptyRoot());
+ }
+
+ public void restore(IMemento memento, IProgressMonitor monitor) {
+ root = new Root(conversation);
+ if (memento == null) {
+ viewer.setInput(root);
+ return;
+ }
+ int mementoWork = 0;
+ Set<TreePath> treePaths = new HashSet<TreePath>();
+ IMemento[] treePathMementos = null;
+
+ IMemento treePathsMemento = memento.getChild(TREE_PATHS);
+
+ if (treePathsMemento != null) {
+ treePathMementos = treePathsMemento.getChildren(TREE_PATH);
+ mementoWork = treePathMementos.length;
+ }
+ // begin the monitor with steps for all tree paths and steps for
+ // creating
+ // conversation s.o., refreshing the tree and setting the paths
+ IProgressMonitor subProgressMonitor = AbstractUtility
+ .getSubProgressMonitor(monitor, 1);
+
+ subProgressMonitor.beginTask(RESTORING_TAXON_NAVIGATOR,
+ 1 + mementoWork + 5);
+ subProgressMonitor.subTask(RESTORING_TAXON_NAVIGATOR);
+ subProgressMonitor.worked(1);
+
+ conversation = CdmStore.createConversation();
+ subProgressMonitor.worked(1);
+ conversation.registerForDataStoreChanges(TaxonNavigatorE4.this);
+ subProgressMonitor.worked(1);
+ viewer.setInput(root);
+ subProgressMonitor.worked(1);
+ viewer.refresh();
+ subProgressMonitor.worked(1);
+
+ if (treePathMementos != null && treePathMementos.length > 0) {
+ for (IMemento treePathMemento : treePathMementos) {
+ TreePath treePath = createTreePathFromString(treePathMemento
+ .getID());
+ if (!subProgressMonitor.isCanceled() && treePath != null) {
+ treePaths.add(treePath);
+ subProgressMonitor.worked(1);
+ }
+ }
+ }
+ if (treePaths.size() > 0) {
+ TaxonNavigatorE4.this.viewer.setExpandedTreePaths(
+ treePaths.toArray(new TreePath[0]));
+ subProgressMonitor.worked(1);
+ }
+ subProgressMonitor.done();
+ }
+
+ private TreePath createTreePathFromString(String string) {
+
+ List<CdmBase> pathList = new ArrayList<CdmBase>();
+
+ if (string.length() == 0) {
+ return null;
+ }
+
+ for (String uuid : string.split(" ")) { //$NON-NLS-1$
+ CdmBase cdmBaseObject = CdmStore.getService(
+ IClassificationService.class).getTaxonNodeByUuid(
+ UUID.fromString(uuid));
+ if (cdmBaseObject == null) {
+ // is this a tree uuid?
+ cdmBaseObject = CdmStore.getService(
+ IClassificationService.class).load(
+ UUID.fromString(uuid));
+
+ if (cdmBaseObject == null) {
+ return null;
+ }
+ }
+ pathList.add(cdmBaseObject);
+ }
+ return new TreePath(pathList.toArray());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void collapse() {
+ viewer.collapseAll();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void expand() {
+ viewer.expandAll();
+ }
+
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @PreDestroy
+ public void dispose() {
+ dataChangeBehavior = null;
+ if (conversation != null) {
+ conversation.unregisterForDataStoreChanges(this);
+ }
+ if(cdmEntitySession != null) {
+ cdmEntitySession.dispose();
+ }
+ if(CdmApplicationState.getCurrentDataChangeService() != null) {
+ CdmApplicationState.getCurrentDataChangeService().unregister(this);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Focus
+ public void setFocus() {
+ if (getConversationHolder() != null) {
+ getConversationHolder().bind();
+ }
+ if(cdmEntitySession != null) {
+ cdmEntitySession.bind();
+ }
+ }
+
+ public UISynchronize getSync() {
+ return sync;
+ }
+
+ public TreeViewer getViewer() {
+ return viewer;
+ }
+
+ public UndoContext getUndoContext() {
+ return undoContext;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ viewer.refresh();
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return true;
+ }
+
+ @Override
+ public void update(Observable o, Object arg) {
+ if(o instanceof LoginManager){
+ refresh();
+ }
+ }
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ if (dataChangeBehavior == null) {
+ dataChangeBehavior = new TaxonNavigatorDataChangeBehaviorE4(this);
+ }
+
+ DataChangeBridge.handleDataChange(changeEvents, dataChangeBehavior);
+ }
+
+ @Override
+ public ICdmEntitySession getCdmEntitySession() {
+ return cdmEntitySession;
+ }
+
+ @Override
+ public List<ITreeNode> getRootEntities() {
+ if(root != null) {
+ return root.getParentBeans();
+ }
+ return null;
+ }
+
+ @Override
+ public void onChange(CdmChangeEvent event) {
+ refresh();
+ for(CdmBase cb : event.getChangedObjects()) {
+ if(cb instanceof TaxonNode) {
+ TaxonNode tn = (TaxonNode)cb;
+ if(tn.getTaxon() == null) {
+ viewer.refresh(tn.getClassification());
+ } else {
+ viewer.refresh(cb);
+ }
+ } else if (cb instanceof Classification) {
+ viewer.refresh();
+ }
+ }
+ }
+
+ @Override
+ public Map<Object, List<String>> getPropertyPathsMap() {
+ Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
+ List<String> taxonNodePropertyPaths = Arrays.asList(new String[] {
+ "taxon.name" //$NON-NLS-1$
+ });
+ propertyPathsMap.put("childNodes", taxonNodePropertyPaths); //$NON-NLS-1$
+ return propertyPathsMap;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextStart(IMemento memento, IProgressMonitor monitor) {
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
+ init();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void contextRefresh(IProgressMonitor monitor) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
+ }
+}
--- /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.navigation.navigator.e4;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.swt.graphics.TextStyle;
+import org.eclipse.ui.navigator.IDescriptionProvider;
+import org.hibernate.LazyInitializationException;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.security.RequiredPermissions;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class TaxonNavigatorLabelProviderE4 extends ColumnLabelProvider
+implements IDescriptionProvider, IStyledLabelProvider {
+
+ private Styler notGrantedStyler = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText(Object element) {
+ //classification
+ if(element instanceof Classification){
+ String text = ((Classification) element).getName().getText();
+ return text != null ? text : Messages.ClassificationLabelProvider_UNNAMED_TREE;
+ }
+ //FIXME E4 show synonym in navigator?
+ //synonym
+// else if (element instanceof Synonym && ((Synonym) element).getName()!=null) {
+// return "= " + ((Synonym) element).getName().getTitleCache(); //$NON-NLS-1$
+// }
+ //taxon node
+ else if (element instanceof TaxonNode){
+ TaxonNode taxonNode = (TaxonNode) HibernateProxyHelper.deproxy(element);
+
+ try{
+ Taxon taxon = HibernateProxyHelper.deproxy(taxonNode.getTaxon());
+ if(taxon == null){
+ String text = taxonNode.getClassification().getName().getText();
+ if(text==null){
+ text = taxonNode.getClassification().getTitleCache();
+ }
+ return text;
+ }else{
+ try{
+ return taxon.getName() != null ? ((IIdentifiableEntity) HibernateProxyHelper.deproxy(taxon.getName())).getTitleCache() : new String();
+ }catch(Exception e){
+ MessagingUtils.error(getClass(), e);
+ }
+ }
+ }catch (LazyInitializationException e){
+ MessagingUtils.error(getClass(), e);
+ }
+ }
+ return new String();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDescription(Object anElement) {
+ //classification
+ if (anElement instanceof Classification) {
+ return "Taxonomic Tree: " + ((Classification) anElement).getTitleCache(); //$NON-NLS-1$
+ }
+ //FIXME E4 show synonym in navigator?
+ //synonym
+// else if (anElement instanceof Synonym) {
+// Synonym data = (Synonym) anElement;
+// return "Synonym: " + data.getTitleCache(); //$NON-NLS-1$
+// }
+ //taxon node
+ else if (anElement instanceof TaxonNode) {
+ Taxon data = ((TaxonNode) anElement).getTaxon();
+ String text = (data != null ? Messages.TaxonNodeLabelProvider_TAXON + data.getTitleCache() : Messages.TaxonNodeLabelProvider_CLASSIFICATION + ((TaxonNode)anElement).getClassification().getTitleCache());
+ return text;
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public StyledString getStyledText(Object element) {
+ //classification
+ if(element instanceof Classification){
+ return new StyledString(getText(element), StyledString.DECORATIONS_STYLER);
+ }
+ //FIXME E4 show synonym in navigator?
+ //synonym
+// else if(element instanceof Synonym){
+// return new StyledString(getText(element), StyledString.QUALIFIER_STYLER);
+// }
+ //taxon node
+ else if(element instanceof TaxonNode){
+ // determine style base on user grants
+ Styler styler = null;
+ if(!CdmStore.currentAuthentiationHasPermission((CdmBase) element, RequiredPermissions.TAXONNODE_EDIT)){
+ styler = getNotGrantedStyler();
+ }
+ return new StyledString(getText(element), styler);
+ }
+ return new StyledString(getText(element));
+ }
+
+ private Styler getNotGrantedStyler() {
+ if (notGrantedStyler == null) {
+ notGrantedStyler = new Styler() {
+ @Override
+ public void applyStyles(TextStyle textStyle) {
+ textStyle.underline = false;
+ textStyle.foreground = StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED);
+ }
+ };
+ }
+ return notGrantedStyler;
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2015 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+package eu.etaxonomy.taxeditor.navigation.navigator.e4;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+
+/**
+ * @author k.luther
+ * @date 02.06.2015
+ *
+ */
+public class TreeNodeDragListenerE4 extends DragSourceAdapter {
+ private Viewer viewer;
+
+ public TreeNodeDragListenerE4(Viewer viewer) {
+ this.viewer = viewer;
+ }
+
+ public void setViewer(Viewer viewer){
+ this.viewer = viewer;
+ }
+
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ event.doit = true;// set to false if needed - default is true
+ dragSetData(event);
+ }
+
+ @Override
+ public void dragSetData(DragSourceEvent event) {
+ ISelection selection = viewer.getSelection();
+ LocalSelectionTransfer.getTransfer().setSelection(selection);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.navigation.navigator.e4;
+
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TransferData;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 02.06.2015
+ */
+public class TreeNodeDropAdapterE4 extends ViewerDropAdapter {
+
+ protected static final String TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE = Messages.TreeNodeDropAdapter_UNSAVED_PARENT_MESSAGE;
+ protected static final String TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT = Messages.TreeNodeDropAdapter_UNSAVED_PARENT;
+ protected static final String TREE_NODE_DROP_ADAPTER_MOVE_TAXON = Messages.TreeNodeDropAdapter_MOVE_TAXON;
+ protected static final String TREE_NODE_DROP_ADAPTER_CANCEL = Messages.TreeNodeDropAdapter_CANCEL;
+ protected static final String TREE_NODE_DROP_ADAPTER_BEHIND = Messages.TreeNodeDropAdapter_BEHIND;
+ protected static final String TREE_NODE_DROP_ADAPTER_CHILD = Messages.TreeNodeDropAdapter_CHILD;
+ protected static final String DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE = Messages.TreeNodeDropAdapter_MOVE_BEHIND;
+ protected static final String TARGET_NODE = Messages.TreeNodeDropAdapter_TARGET_NODE;
+
+ private static final Logger logger = Logger.getLogger(TreeNodeDropAdapterE4.class);
+
+ private TaxonNavigatorE4 taxonNavigator;
+
+ public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator.dropassistant"; //$NON-NLS-1$
+
+ private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
+
+ public enum MovingType{
+ CHILD, PREVIOUS, BEHIND
+ }
+
+ protected TreeNodeDropAdapterE4(TaxonNavigatorE4 navigator) {
+ super(navigator.getViewer());
+ this.taxonNavigator = navigator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performDrop(Object data) {
+ Object target = getCurrentTarget();
+ if (getCurrentTarget() instanceof ITaxonTreeNode) {
+ Set<TaxonNode> taxonNodes = getSelectedTaxa();
+ ITaxonTreeNode targetTreeNode = (ITaxonTreeNode) target;
+ if (targetTreeNode instanceof Classification){
+ targetTreeNode = ((Classification)targetTreeNode).getRootNode();
+ targetTreeNode = HibernateProxyHelper.deproxy(targetTreeNode, TaxonNode.class);
+ }
+ if(taxonNodes != null) {
+ if (taxonNodes.size() == 1){
+ return moveTaxon(taxonNodes, targetTreeNode);
+ } else{
+ if( MessageDialog.openConfirm(null, Messages.TreeNodeDropAdapter_MOVING, Messages.TreeNodeDropAdapter_MOVING_MESSAGE)){
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ private Set<TaxonNode> getSelectedTaxa(){
+ HashSet<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
+
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (selection instanceof TreeSelection) {
+
+ Iterator<?> selectionIterator = ((TreeSelection) selection).iterator();
+
+ while (selectionIterator.hasNext()){
+ Object object = selectionIterator.next();
+ if(object instanceof TaxonNode){
+ TaxonNode taxonNode = (TaxonNode) object;
+ taxonNodes.add(taxonNode);
+ }
+ }
+ }
+ return taxonNodes;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean validateDrop(Object target, int operation,
+ TransferData transferType) {
+
+ if (target instanceof ITaxonTreeNode) {
+
+ // check users permissions with target taxonnode and taxon
+ if (target instanceof TaxonNode) {
+ TaxonNode targetNode = (TaxonNode)target;
+ boolean hasTargetNodePermission = CdmStore.currentAuthentiationHasPermission(targetNode, UPDATE);
+ boolean hasTargetTaxonPermission = targetNode.getTaxon() == null ?
+ true :
+ CdmStore.currentAuthentiationHasPermission(targetNode.getTaxon(), UPDATE);
+
+ if(logger.isDebugEnabled()){
+ logger.debug("target: " + targetNode.getTaxon() == null? "-" : targetNode.getTaxon().getTitleCache()); //$NON-NLS-1$
+ }
+
+ if(!hasTargetNodePermission || ! hasTargetNodePermission){
+ if(logger.isDebugEnabled()){
+ logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission + " " + hasTargetTaxonPermission + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return false;
+ }
+ }
+
+ // do not allow to drop onto itself and
+ // check users permissions with all selected taxon nodes and taxa
+ for(TaxonNode taxonNode : getSelectedTaxa()){
+ if (logger.isDebugEnabled()){
+ logger.debug("selectedTaxa: " + taxonNode.getTaxon() == null? "-" : taxonNode.getTaxon().getTitleCache()); //$NON-NLS-1$
+ }
+ boolean isClassification = !taxonNode.hasTaxon();
+ if (isClassification) {
+ if(logger.isDebugEnabled()){
+ logger.debug("CANCEL_STATUS for selected classification " + taxonNode.getClassification().getTitleCache()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return false;
+ }
+ boolean isSameTaxonNode = taxonNode.equals(target);
+ boolean hasTaxonNodePermission = CdmStore.currentAuthentiationHasPermission(taxonNode, UPDATE);
+
+ boolean hasTaxonPermission =
+ CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE);CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE);
+ if (
+ isSameTaxonNode
+ || !hasTaxonNodePermission
+ || !hasTaxonPermission
+ ) {
+ if(logger.isDebugEnabled()){
+ logger.debug("CANCEL_STATUS for selected " + isSameTaxonNode + Messages.TreeNodeDropAdapter_10 + hasTaxonNodePermission + " " + hasTaxonPermission + " "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return false;
+ }
+ }
+ logger.debug("OK_STATUS"); //$NON-NLS-1$
+ return true;
+ }
+ logger.debug("CANCEL_STATUS"); //$NON-NLS-1$
+ return false;
+ }
+
+
+ private boolean moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) {
+
+
+ if(targetITaxonTreeNode instanceof TaxonNode){
+
+ // Make sure parent taxon does not have unsaved changes
+// if (NavigationUtil.isDirty(targetTaxonNode)){
+// MessageDialog.openWarning(NavigationUtil.getShell(), TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT, TREE_NODE_DROP_ADAPTER_UNSAVED_PARENT_MESSAGE);
+// return false;
+// }
+
+ }
+ Iterator<TaxonNode> taxIterator = taxonNodes.iterator();
+ Set<UUID> uuids = new HashSet<UUID>();
+ TaxonNode node = null;
+ while(taxIterator.hasNext()){
+ node = taxIterator.next();
+ uuids.add(node.getUuid());
+ }
+ IUndoContext workspaceUndoContext = taxonNavigator.getUndoContext();
+ if (!PreferencesUtil.getSortNodesNaturally()){
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+ return false;
+ }
+
+ AbstractPostOperation<?> operation = new MoveTaxonOperation
+ (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, taxonNavigator, taxonNavigator, MovingType.CHILD);
+ AbstractUtility.executeOperation(operation, taxonNavigator.getSync());
+
+ logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+ return true;
+ }else{
+ String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL};
+ MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+ dialog.open();
+ int returnCode = dialog.getReturnCode();
+ if (returnCode == 0){
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+ return false;
+ }
+
+ AbstractPostOperation<?> operation = new MoveTaxonOperation
+ (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetITaxonTreeNode, taxonNavigator, taxonNavigator, MovingType.CHILD);
+ AbstractUtility.executeOperation(operation, taxonNavigator.getSync());
+
+ logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+ return true;
+ }else if (returnCode == 1){
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
+ return false;
+ }
+ TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+
+ AbstractPostOperation<?> operation = new MoveTaxonOperation
+ (TREE_NODE_DROP_ADAPTER_MOVE_TAXON, workspaceUndoContext, uuids, targetNode, taxonNavigator, taxonNavigator, MovingType.PREVIOUS);
+ AbstractUtility.executeOperation(operation, taxonNavigator.getSync());
+
+ logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
+ return true;
+ }
+// } else if (returnCode == 2){
+// IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+// if (workspaceUndoContext == null) {
+// logger.error("Workspace undo context is null. DND operation cancelled");
+// return false;
+// }
+// TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
+//
+// AbstractPostOperation operation = new MoveTaxonOperation
+// ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
+// NavigationUtil.executeOperation(operation);
+//
+// logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+// return true;
+// }
+ else{
+ return false;
+ }
+
+
+ }
+ }
+
+ @Override
+ public void dragOver(DropTargetEvent event) {
+ super.dragOver(event);
+ event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_INSERT_AFTER;
+ }
+
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+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;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.ChangeAcceptedTaxonToSynonymOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class ChangeAcceptedTaxonToSynonymHandlerE4 extends DeleteHandlerE4 implements IPostOperationEnabled {
+
+ @Override
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem, UISynchronize sync) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ Iterator selectionIterator = selection.iterator();
+ Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
+
+ while (selectionIterator.hasNext()){
+ Object object = selectionIterator.next();
+ if(object instanceof ITaxonTreeNode) {
+ treeNodes.add((ITaxonTreeNode) object);
+ }
+ }
+ boolean allEditorsClosed = true;
+ for (ITaxonTreeNode treeNode : treeNodes){
+ if(treeNode instanceof TaxonNode) {
+ allEditorsClosed &= closeObsoleteEditor((TaxonNode) treeNode);
+ }
+ }
+ AbstractPostOperation operation = null;
+ if (treeNodes.size() == 1 ){
+ ITaxonTreeNode treeNode = treeNodes.iterator().next();
+ ITaxonTreeNode oldAcceptedTaxonNode =treeNode;
+
+ // check if taxon has no children
+ if(((TaxonNode)oldAcceptedTaxonNode).getCountChildren() > 0) {
+ MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE, this,
+ Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE);
+ return;
+ }
+ /*if(((TaxonNode)oldAcceptedTaxonNode).getTaxon().hasSynonyms()) {
+ EditorUtil.warningDialog("Prerequisite not met", this,
+ "The accepted taxon must not have any synonyms. You need to move all synonyms to " +
+ "another taxon before attempting to turn the accepted " +
+ "taxon into a synonym.");
+ return null;
+ }*/
+
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(((TaxonNode)oldAcceptedTaxonNode).getTaxon().getUuid());
+ TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
+ taxonNavigator.getConversationHolder(),
+ Messages.ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON,
+ excludeTaxa,
+ null,
+ ((TaxonNode)oldAcceptedTaxonNode).getClassification());
+
+ if (newAcceptedTaxonNode == null) {
+ return;
+ }
+
+ if (allEditorsClosed){
+
+ operation = new ChangeAcceptedTaxonToSynonymOperation(menuItem.getLocalizedLabel(),
+ NavigationUtil.getUndoContext(),
+ oldAcceptedTaxonNode,
+ newAcceptedTaxonNode,
+ taxonNavigator,
+ taxonNavigator,
+ taxonNavigator);
+
+ AbstractUtility.executeOperation(operation, sync);
+ }
+ } else{
+ if( MessageDialog.openConfirm(shell, Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY, Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE)){
+ return;
+ }
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ //FIXME E4 migrate
+// Display.getDefault().asyncExec(new Runnable(){
+//
+// @Override
+// public void run() {
+// EditorUtil.close(editor.getMultiPageTaxonEditor());
+//
+// try {
+// MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
+// if(possibleOpenEditor != null){
+// EditorUtil.close(possibleOpenEditor);
+// }
+// EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid);
+// } catch (PartInitException e) {
+// MessagingUtils.error(this.getClass(), e);
+// throw new RuntimeException(e);
+// } catch (Exception e) {
+// MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED, this, e.getMessage());
+// }
+// }
+//
+// });
+ return true;
+ }
+
+ @Override
+ public boolean onComplete() {
+ return false;
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.navigation.operation.CloneClassificationOperation;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.section.classification.CloneClassificationWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class CloneClassificationHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ IEclipseContext context,
+ UISynchronize sync) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
+ Classification classification = ((TaxonNode)selectedElement).getClassification();
+ CloneClassificationWizard wizard = new CloneClassificationWizard();
+ ContextInjectionFactory.inject(wizard, context);
+// CloneClassificationWizard wizard = ContextInjectionFactory.make(CloneClassificationWizard.class, context);
+ wizard.init(classification);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.open();
+
+ String classificationName = wizard.getClassificationName();
+ TaxonRelationshipType relationType = wizard.getRelationType();
+ Reference reference = wizard.getReference();
+
+ CloneClassificationOperation operation = new CloneClassificationOperation(Messages.CloneClassificationHandler_CLONE_CLASSIFICATION,
+ StoreUtil.getUndoContext(), classification, classificationName, reference, relationType,
+ taxonNavigator, taxonNavigator);
+
+ AbstractUtility.executeOperation(operation, sync);
+ taxonNavigator.refresh();
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()==null
+ && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2009 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.navigation.navigator.e4.handler;
+
+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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.TreeSelection;
+
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.CopyOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class CopyHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem,
+ UISynchronize sync) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ if(selection.size() == 1) {
+ Object selectedObject = selection.getFirstElement();
+ if (selectedObject instanceof TaxonNode) {
+ AbstractPostOperation operation = new CopyOperation(menuItem.getLocalizedLabel(), StoreUtil.getUndoContext(),
+ (TaxonNode)selectedObject, taxonNavigator);
+ IStatus status = AbstractUtility.executeOperation(operation, sync);
+ }
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.navigator.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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.TreeSelection;
+
+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.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.navigation.operation.CreateNewTaxonHierarchyOperation;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class CreateClassificationHierarchyHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ UISynchronize sync) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
+ Classification classification = ((TaxonNode) selectedElement).getClassification();
+ try {
+ CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification, taxonNavigator, taxonNavigator);
+ AbstractUtility.executeOperation(operation, sync);
+ taxonNavigator.refresh();
+ } catch (Exception e) {
+ MessagingUtils.messageDialog(Messages.CreateClassificationHierarchyHandler_FAILED, CreateClassificationHierarchyHandlerE4.class,
+ Messages.CreateClassificationHierarchyHandler_FAILED_MESSAGE, e);
+ }
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()==null
+ && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
+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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
-import eu.etaxonomy.cdm.model.common.ITreeNode;
-import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.DeleteOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
/**
- * <p>DeleteTreeNodeHandler class.</p>
*
- * @author n.hoffmann
- * @created 06.04.2009
- * @version 1.0
+ * @author pplitzner
+ * @date 05.09.2017
+ *
*/
-public class DeleteHandler extends AbstractHandler{
+public class DeleteHandlerE4 {
protected static final String SKIP = Messages.DeleteHandler_SKIP;
protected static final String MOVE_CHILDREN_TO_PARENT_NODE = Messages.DeleteHandler_MOVE_TO_PARENT;
protected static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION = Messages.DeleteHandler_DELETE_CLASSIFICATION;
protected static final String CONFIRM_DELETION = Messages.DeleteHandler_CONFIRM_DELETE;
- protected IWorkbenchPage activePage;
- protected TaxonNavigator taxonNavigator;
-
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
-
- taxonNavigator = NavigationUtil.showNavigator();
-
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
-
-
- // Prompt user for confirmation
-
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem, UISynchronize sync) {
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
Iterator selectionIterator = selection.iterator();
Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
//configNodes.setDeleteTaxon(false);
- if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon() && taxonNode.hasChildNodes()){
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO)){
- return null;
+ if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon() && taxonNode.hasChildNodes()){
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO)){
+ return;
}
} else if (taxonNode instanceof TaxonNode && !((TaxonNode)taxonNode).hasTaxon() && !taxonNode.hasChildNodes()){
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION)){
- return null;
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION)){
+ return;
}
} else {
if (taxonNode.hasChildNodes()){
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
config,
- HandlerUtil.getActiveShell(event),
+ shell,
CONFIRM_DELETION,
null,
DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO,
config.setTaxonNodeConfig(configNodes);
} else if (dialog_result == 2){
//skip
- return null;
+ return;
}
}else{
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
- return null;
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
+ return;
}
config.setTaxonNodeConfig(configNodes);
}
return null;
}*/
- operation = new DeleteOperation(event.getCommand().getName(),
+ operation = new DeleteOperation(menuItem.getLocalizedLabel(),
NavigationUtil.getUndoContext(),
taxonNode,
config,
taxonNavigator,
taxonNavigator);
- NavigationUtil.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
//}
}
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
} catch (Exception e){
MessagingUtils.error(getClass(), e);
}
} else{
try{
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
- return null;
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, shell, CONFIRM_DELETION, DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
+ return;
}
if (allEditorsClosed){
- operation = new DeleteOperation(event.getCommand().getName(),
+ operation = new DeleteOperation(menuItem.getLocalizedLabel(),
NavigationUtil.getUndoContext(),
treeNodes,
new TaxonDeletionConfigurator(),
taxonNavigator,
taxonNavigator);
- NavigationUtil.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
- }catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), Messages.DeleteHandler_9);
- } catch (Exception e){
+ }catch (Exception e){
MessagingUtils.error(getClass(), e);
}
}
- return null;
+ return;
}
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = !selection.isEmpty() && !(selection.getFirstElement() instanceof Synonym);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
protected boolean closeObsoleteEditor(TaxonNode taxonNode){
+ //FIXME E4 migrate
boolean result = true;
- for (IEditorReference ref : activePage.getEditorReferences()) {
- try {
- String treeIndex = ((ITreeNode)taxonNode).treeIndex();
-
-
- IEditorInput input = ref.getEditorInput();
- if (input instanceof TaxonEditorInput) {
- TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
- //if node is a child of taxonNode then close the editor
- if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
- //if (taxonNode.equals(node)) {
- result &= activePage.closeEditor(ref.getEditor(false), true);
-
- }
- }
- } catch (PartInitException e) {
- continue;
- }
- }
+// for (IEditorReference ref : activePage.getEditorReferences()) {
+// try {
+// String treeIndex = ((ITreeNode)taxonNode).treeIndex();
+//
+//
+// IEditorInput input = ref.getEditorInput();
+// if (input instanceof TaxonEditorInput) {
+// TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
+// //if node is a child of taxonNode then close the editor
+// if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
+// //if (taxonNode.equals(node)) {
+// result &= activePage.closeEditor(ref.getEditor(false), true);
+//
+// }
+// }
+// } catch (PartInitException e) {
+// continue;
+// }
+// }
return result;
}
}
--- /dev/null
+/**
+* Copyright (C) 2009 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.navigation.navigator.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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class LinkWithTaxonHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+ taxonNavigator.setLinkWithTaxon(!taxonNavigator.isLinkWithTaxon());
+ if(taxonNavigator.isLinkWithTaxon()){
+ taxonNavigator.updateCurrentTaxon(EventUtility.getTaxonEditor());
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = activePart.getObject() instanceof TaxonNavigatorE4;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
+
+public class MoveFactualDataHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ if(taxonNavigator!=null){
+ Object object = selection.getFirstElement();
+ if(object instanceof TaxonNode){
+ TaxonNode taxonNode = HibernateProxyHelper.deproxy(object, TaxonNode.class);
+ final TaxonNode sourceTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid());
+ if(NavigationUtil.isDirty(sourceTaxonNode, partService)){
+ MessageDialog.openWarning(shell, Messages.MoveFactualDataHandler_UNSAVED_SOURCE, Messages.MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE);
+ return;
+ }
+ //reload to avoid session conflicts
+ Taxon taxon = HibernateProxyHelper.deproxy(CdmStore.getService(ITaxonService.class).load(sourceTaxonNode.getTaxon().getUuid()), Taxon.class);
+ if(taxon!=null){
+ // Choose the target taxon
+ List<UUID> excludeTaxa = new ArrayList<UUID>();
+ excludeTaxa.add(taxon.getUuid());
+ TaxonNode dialogTaxonNode = TaxonNodeSelectionDialog.select(shell,
+ taxonNavigator.getConversationHolder(),
+ Messages.MoveFactualDataHandler_CHOOSE_TAXON,
+ excludeTaxa,
+ sourceTaxonNode,
+ sourceTaxonNode.getClassification());
+ if (dialogTaxonNode == null) {
+ return;
+ }
+ //reload to avoid session conflicts
+ final TaxonNode targetTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(dialogTaxonNode.getUuid());
+ if(NavigationUtil.isDirty(targetTaxonNode, partService)){
+ MessageDialog.openWarning(shell, Messages.MoveFactualDataHandler_UNSAVED_TARGET, Messages.MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE);
+ return;
+ }
+ CdmStore.getService(IDescriptionService.class).moveTaxonDescriptions(taxon.getUuid(),targetTaxonNode.getTaxon().getUuid());
+
+ taxonNavigator.getConversationHolder().bind();
+ taxonNavigator.getConversationHolder().commit();
+
+ Display.getDefault().asyncExec(new Runnable(){
+
+ @Override
+ public void run() {
+ //FIXME E4 refresh factual view via events or similar
+// try {
+// //close and re-open to refresh factual data view
+// MultiPageTaxonEditor sourceEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(sourceTaxonNode.getUuid());
+// MultiPageTaxonEditor targetEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(targetTaxonNode.getUuid());
+// if(targetEditor != null){
+// AbstractUtility.close(sourceEditor);
+// AbstractUtility.close(targetEditor);
+// }
+// EditorUtil.openTaxonNodeE4(sourceTaxonNode.getUuid());
+// EditorUtil.openTaxonNodeE4(targetTaxonNode.getUuid());
+// } catch (PartInitException e) {
+// MessagingUtils.error(this.getClass(), e);
+// throw new RuntimeException(e);
+// } catch (Exception e) {
+// MessagingUtils.warningDialog(Messages.MoveFactualDataHandler_CREATE_FAILED, this, e.getMessage());
+// }
+ }
+
+ });
+ }
+ }
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
+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.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TreeNodeDropAdapterE4.MovingType;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
/**
- * <p>MoveTaxonHandler class.</p>
*
- * @author n.hoffmann
- * @created 01.04.2009
- * @version 1.0
+ * @author pplitzner
+ * @date 05.09.2017
+ *
*/
-public class MoveTaxonHandler extends AbstractHandler implements IPostOperationEnabled {
+public class MoveTaxonHandlerE4 implements IPostOperationEnabled {
private TaxonNode parentTaxonNode;
- protected IWorkbenchPage activePage;
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- TaxonNavigator taxonNavigator = (TaxonNavigator)NavigationUtil.showView(TaxonNavigator.ID);
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart, EPartService partService,
+ UISynchronize sync) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
Iterator<?> selectionIterator = selection.iterator();
Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
// do not show the current selection
List<UUID> excludeTaxa = new ArrayList<UUID>();
- //if (selection.size() == 1){
-
while (selectionIterator.hasNext()){
Object object = selectionIterator.next();
if(object instanceof TaxonNode){
excludeTaxa.add(taxonNode.getTaxon().getUuid());
}
}
- /*} else{
- if( MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), "Moving taxon", "The operation move accepted taxon to other parent is available only for a single taxon.")){
- return null;
- }
- }*/
-// TaxonNode taxonNode = (TaxonNode) selection.getFirstElement();
if (taxonNodes.size() >= 1){
Classification classification = taxonNodes.iterator().next().getClassification();
MovingType moveToNewParent = MovingType.CHILD;
if(!MessageDialog.openQuestion(null, Messages.MoveTaxonHandler_TARGET_NODE, Messages.MoveTaxonHandler_TARGET_NODE_MESSAGE)){
moveToNewParent = MovingType.BEHIND;
}
- parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_ABOVE, excludeTaxa, null, classification);
+ parentTaxonNode = TaxonNodeSelectionDialog.select(shell, taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_ABOVE, excludeTaxa, null, classification);
}else{
- parentTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event), taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_PARENT, excludeTaxa, null, classification);
+ parentTaxonNode = TaxonNodeSelectionDialog.select(shell, taxonNavigator.getConversationHolder(), Messages.MoveTaxonHandler_CHOOSE_PARENT, excludeTaxa, null, classification);
}
if(parentTaxonNode != null){
- if(NavigationUtil.isDirty(parentTaxonNode)){
- MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveTaxonHandler_UNSAVED_PARENT, Messages.MoveTaxonHandler_UNSAVED_PARENT_MESSAGE);
- return null;
+ if(NavigationUtil.isDirty(parentTaxonNode, partService)){
+ MessageDialog.openWarning(shell, Messages.MoveTaxonHandler_UNSAVED_PARENT, Messages.MoveTaxonHandler_UNSAVED_PARENT_MESSAGE);
+ return;
}
-
AbstractPostOperation<?> operation = new MoveTaxonOperation
- (Messages.MoveTaxonHandler_MOVE_TO_PARENT, NavigationUtil.getUndoContext(),
- taxonNodeUUIDs, parentTaxonNode, taxonNavigator, taxonNavigator, moveToNewParent); //$NON-NLS-1$
- NavigationUtil.executeOperation(operation);
+ (Messages.MoveTaxonHandler_MOVE_TO_PARENT, NavigationUtil.getUndoContext(), taxonNodeUUIDs, parentTaxonNode, taxonNavigator, taxonNavigator, moveToNewParent); //$NON-NLS-1$
+ AbstractUtility.executeOperation(operation, sync);
taxonNavigator.refresh();
}
}
- return null;
}
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
/** {@inheritDoc} */
@Override
public boolean postOperation(CdmBase objectAffectedByOperation) {
return true;
}
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
@Override
public boolean onComplete() {
return false;
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class NewClassificationHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_SELECTION)ITreeSelection selection) {
+ NewClassificationWizard wizard = new NewClassificationWizard();
+ wizard.init(null, selection);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.open();
+ }
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.navigation.navigator.e4.handler;
+
+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.MApplication;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
+import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class NewTaxonNodeHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
+ @Named(IServiceConstants.ACTIVE_SELECTION) ITreeSelection selection, EModelService modelService,
+ EPartService partService, MApplication application) throws Exception {
+
+ final NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
+ wizard.init(null, selection);
+ final WizardDialog dialog = new WizardDialog(shell, wizard);
+ wizard.addWizardPageListener(new IWizardPageListener() {
+ @Override
+ public void close() {
+ wizard.performFinish();
+ dialog.close();
+ }
+ });
+ int status = dialog.open();
+
+ if(status == IStatus.OK && wizard.openInEditor()){
+ if(wizard.openEmpty()){
+ EditorUtil.openEmptyE4(wizard.getParentTreeNode().getUuid());
+ }else if(wizard.getTaxonNode() != null){
+ EditorUtil.openTaxonNodeE4(wizard.getTaxonNode().getUuid(), modelService, partService, application);
+ }
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection){
+ return selection!=null && !selection.isEmpty();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.navigator.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.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.TreeSelection;
+
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TaxonNavigatorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 05.09.2017
+ *
+ */
+public class RefreshTreeHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+
+ TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
+
+ taxonNavigator.refresh();
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+}
/**
*
*/
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
+import javax.inject.Named;
+
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingChangeAcceptedTaxonToSynonymOperation;
-import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
/**
- * <p>ChangeAcceptedTaxonToSynonymHandler class.</p>
*
- * @author n.hoffmann
- * @created Jan 4, 2010
- * @version 1.0
+ * @author pplitzner
+ * @since Sep 6, 2017
+ *
*/
-public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHandler {
-
- private static final Logger logger = Logger
- .getLogger(RemotingChangeAcceptedTaxonToSynonymHandler.class);
+public class RemotingChangeAcceptedTaxonToSynonymHandlerE4 extends RemotingCdmHandlerE4 {
private TaxonNode oldTaxonNode;
- /**
- * @param label
- */
- public RemotingChangeAcceptedTaxonToSynonymHandler() {
+ public RemotingChangeAcceptedTaxonToSynonymHandlerE4() {
super(TaxonNavigatorLabels.CHANGE_ACCEPTED_TAXON_TO_SYNONYM_LABEL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
- */
+
@Override
- public IStatus allowOperations(ExecutionEvent event) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
// check that only a single taxon tree node has been selected
if(selection.size() > 1) {
return new Status(IStatus.ERROR,
}
// check if corresponding name editor is closed
- boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, oldTaxonNode);
- if(editorClosed != true) {
- return new Status(IStatus.ERROR,
- "unknown", //$NON-NLS-1$
- TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
- }
+ EditorUtil.closeObsoleteEditor(oldTaxonNode, partService);
return Status.OK_STATUS;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent)
- */
+
@Override
- public AbstractOperation prepareOperation(ExecutionEvent event) {
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
List<UUID> excludeTaxa = new ArrayList<UUID>();
excludeTaxa.add(oldTaxonNode.getTaxon().getUuid());
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+ TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(shell,
new ConversationHolderMock(),
Messages.RemotingChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON,
excludeTaxa,
}
RemotingChangeAcceptedTaxonToSynonymOperation rcattso =
- new RemotingChangeAcceptedTaxonToSynonymOperation(event.getTrigger(),
+ new RemotingChangeAcceptedTaxonToSynonymOperation(getTrigger(),
false,
oldTaxonNode.getUuid(),
newAcceptedTaxonNode.getUuid());
return rcattso;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent)
- */
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public void onComplete() {
- // TODO Auto-generated method stub
-
}
-
-
-
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
}
* 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.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.eclipse.core.commands.ExecutionEvent;
+import javax.inject.Named;
+
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingDeleteTaxonNodeOperation;
-import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteConfiguratorDialog;
/**
* @date 22 Jun 2015
*
*/
-public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
+public class RemotingDeleteTaxonNodeHandlerE4 extends RemotingCdmHandlerE4 {
private TaxonDeletionConfigurator config;
private Set<ITaxonTreeNode> treeNodes;
- public RemotingDeleteTaxonNodeHandler() {
+ public RemotingDeleteTaxonNodeHandlerE4() {
super(TaxonNavigatorLabels.DELETE_TAXON_NODE_LABEL);
}
@Override
- public IStatus allowOperations(ExecutionEvent event) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
Iterator<?> selectionIterator = selection.iterator();
treeNodes = new HashSet<ITaxonTreeNode>();
treeNodes.add((ITaxonTreeNode) object);
}
}
- boolean allEditorsClosed = true;
- IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
for (ITaxonTreeNode treeNode : treeNodes) {
if(treeNode instanceof TaxonNode) {
- allEditorsClosed &= EditorUtil.closeObsoleteEditor((TaxonNode) treeNode, activePage);
+ EditorUtil.closeObsoleteEditor((TaxonNode) treeNode, partService);
}
}
- if(!allEditorsClosed) {
- return new Status(IStatus.WARNING,
- "unknown", //$NON-NLS-1$
- TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
- }
config = new TaxonDeletionConfigurator();
TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
if (taxonNode instanceof Classification) {
String message;
- if (((Classification)taxonNode).getRootNode() != null && taxonNode.hasChildNodes()) {
- message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+DeleteHandler.THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO;
+ if (((Classification)taxonNode).getRootNode() != null &&taxonNode.hasChildNodes()) {
+ message = DeleteHandlerE4.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+DeleteHandlerE4.THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO;
} else {
- message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION;
+ message = DeleteHandlerE4.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION;
}
- if (!DeleteConfiguratorDialog.openConfirm(
- HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION,
+ if (!MessageDialog.openConfirm(
+ shell, DeleteHandlerE4.CONFIRM_DELETION,
message)) {
return Status.CANCEL_STATUS;
}
if (taxonNode.hasChildNodes()){
DeleteConfiguratorDialog dialog = new DeleteConfiguratorDialog(
config,
- HandlerUtil.getActiveShell(event),
- DeleteHandler.CONFIRM_DELETION,
+ shell,
+ DeleteHandlerE4.CONFIRM_DELETION,
null,
- DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+DeleteHandler.THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO,
- MessageDialog.WARNING, new String[] { DeleteHandler.DELETE_ALL_CHILDREN,
- DeleteHandler.MOVE_CHILDREN_TO_PARENT_NODE, DeleteHandler.SKIP }, 0);
+ DeleteHandlerE4.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S+DeleteHandlerE4.THERE_ARE_CHILDNODES_WHICH_WILL_BE_DELETED_TOO,
+ MessageDialog.WARNING, new String[] { DeleteHandlerE4.DELETE_ALL_CHILDREN,
+ DeleteHandlerE4.MOVE_CHILDREN_TO_PARENT_NODE, DeleteHandlerE4.SKIP }, 0);
int result = dialog.open();
if (result == 0){
return Status.CANCEL_STATUS;
}
} else{
- if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), DeleteHandler.CONFIRM_DELETION, DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
+ if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, shell, DeleteHandlerE4.CONFIRM_DELETION, DeleteHandlerE4.DO_YOU_REALLY_WANT_TO_DELETE_THE_SELECTED_NODE_S)){
return Status.CANCEL_STATUS;
}
config.setTaxonNodeConfig(configNodes);
}
@Override
- public AbstractOperation prepareOperation(ExecutionEvent event) {
- return new RemotingDeleteTaxonNodeOperation(event.getTrigger(),
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ return new RemotingDeleteTaxonNodeOperation(getTrigger(),
false,
treeNodes,
config);
}
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = !selection.isEmpty() && !(selection.getFirstElement() instanceof Synonym);
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public void onComplete() {
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
}
* 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.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
+import javax.inject.Named;
+
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveFactualDataOperation;
-import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
/**
* @date 19 Jun 2015
*
*/
-public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
-
+public class RemotingMoveFactualDataHandlerE4 extends RemotingCdmHandlerE4 {
private TaxonNode sourceTaxonNode;
private TaxonNode targetTaxonNode;
- /**
- * @param label
- */
- public RemotingMoveFactualDataHandler() {
+
+ public RemotingMoveFactualDataHandlerE4() {
super(TaxonNavigatorLabels.MOVE_FACTUAL_DATA_LABEL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
- public IStatus allowOperations(ExecutionEvent event) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
// check that only a single taxon tree node has been selected
if(selection.size() > 1) {
return new Status(IStatus.ERROR,
TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
}
- if(NavigationUtil.isDirty(sourceTaxonNode)) {
+ if(NavigationUtil.isDirty(sourceTaxonNode, partService)) {
return new Status(IStatus.ERROR,
"unknown", //$NON-NLS-1$
TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE);
List<UUID> excludeTaxa = new ArrayList<UUID>();
excludeTaxa.add(sourceTaxonNode.getTaxon().getUuid());
- targetTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+ targetTaxonNode = TaxonNodeSelectionDialog.select(shell,
new ConversationHolderMock(),
Messages.RemotingMoveFactualDataHandler_CHOOSE_TAXA,
excludeTaxa,
- null,
+ sourceTaxonNode,
sourceTaxonNode.getClassification());
if(targetTaxonNode == null) {
"unknown", //$NON-NLS-1$
""); //$NON-NLS-1$
}
- if(NavigationUtil.isDirty(targetTaxonNode)){
+ if(NavigationUtil.isDirty(targetTaxonNode, partService)){
return new Status(IStatus.ERROR,
"unknown", //$NON-NLS-1$
TaxonNavigatorLabels.UNSAVED_CHANGES_MESSAGE);
return Status.OK_STATUS;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
- public AbstractOperation prepareOperation(ExecutionEvent event) {
- return new RemotingMoveFactualDataOperation(event.getTrigger(),
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ return new RemotingMoveFactualDataOperation(getTrigger(),
false,
sourceTaxonNode.getTaxon().getUuid(),
targetTaxonNode.getTaxon().getUuid());
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
- */
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public void onComplete() {
Display.getDefault().asyncExec(new Runnable(){
@Override
public void run() {
- try {
- //close and re-open to refresh factual data view
- MultiPageTaxonEditor sourceEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(sourceTaxonNode.getUuid());
- MultiPageTaxonEditor targetEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(targetTaxonNode.getUuid());
- if(targetEditor != null){
- AbstractUtility.close(sourceEditor);
- AbstractUtility.close(targetEditor);
- }
- EditorUtil.openTaxonNode(sourceTaxonNode.getUuid());
- EditorUtil.openTaxonNode(targetTaxonNode.getUuid());
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.RemotingMoveFactualDataHandler_CREATE_FAILED, this, e.getMessage());
- }
+ //FIXME E4 refresh factual view via events or similar
+// try {
+// //close and re-open to refresh factual data view
+// MultiPageTaxonEditor sourceEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(sourceTaxonNode.getUuid());
+// MultiPageTaxonEditor targetEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(targetTaxonNode.getUuid());
+// if(targetEditor != null){
+// AbstractUtility.close(sourceEditor);
+// AbstractUtility.close(targetEditor);
+// }
+// EditorUtil.openTaxonNodeE4(sourceTaxonNode.getUuid());
+// EditorUtil.openTaxonNodeE4(targetTaxonNode.getUuid());
+// } catch (PartInitException e) {
+// MessagingUtils.error(this.getClass(), e);
+// throw new RuntimeException(e);
+// } catch (Exception e) {
+// MessagingUtils.warningDialog(Messages.RemotingMoveFactualDataHandler_CREATE_FAILED, this, e.getMessage());
+// }
}
});
-
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
}
* 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.navigation.navigator.handler;
+package eu.etaxonomy.taxeditor.navigation.navigator.e4.handler;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
+import javax.inject.Named;
+
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.cdm.api.conversation.ConversationHolderMock;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
import eu.etaxonomy.taxeditor.navigation.navigator.operation.RemotingMoveTaxonOperation;
-import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
* @date 19 Jun 2015
*
*/
-public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
+public class RemotingMoveTaxonNodeHandlerE4 extends RemotingCdmHandlerE4 {
private TaxonNode oldTaxonNode;
- public RemotingMoveTaxonNodeHandler() {
+ public RemotingMoveTaxonNodeHandlerE4() {
super(TaxonNavigatorLabels.MOVE_TAXON_LABEL);
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
- public IStatus allowOperations(ExecutionEvent event) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
// check that only a single taxon tree node has been selected
if(selection.size() > 1) {
return new Status(IStatus.ERROR,
return Status.OK_STATUS;
}
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#prepareOperation(org.eclipse.core.commands.ExecutionEvent)
- */
@Override
- public AbstractOperation prepareOperation(ExecutionEvent event) {
- Shell activeShell = HandlerUtil.getActiveShell(event);
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
TaxonNode parentTaxonNode;
List<UUID> excludeTaxa = new ArrayList<UUID>();
if (PreferencesUtil.getSortNodesNaturally()){
- parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+ parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
new ConversationHolderMock(),
Messages.RemotingMoveTaxonNodeHandler_CHOOSE_TAXON,
excludeTaxa,
moveToNewParent = MovingType.BEHIND;
}
} else {
- parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+ parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
new ConversationHolderMock(),
Messages.RemotingMoveTaxonNodeHandler_CHOOSE_PARENT,
excludeTaxa,
if(parentTaxonNode != null){
- if(NavigationUtil.isDirty(parentTaxonNode)){
- MessageDialog.openWarning(activeShell,
+ if(NavigationUtil.isDirty(parentTaxonNode, partService)){
+ MessageDialog.openWarning(shell,
Messages.RemotingMoveTaxonNodeHandler_UNSAVED_PARENT,
Messages.RemotingMoveTaxonNodeHandler_UNSAVED_PARENT_MESSAGE);
return null;
}
- return new RemotingMoveTaxonOperation(event.getTrigger(),
+ return new RemotingMoveTaxonOperation(getTrigger(),
false,
oldTaxonNode.getUuid(),
parentTaxonNode.getUuid(),
return null;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete()
- */
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof TaxonNode
+ && ((TaxonNode) selection.getFirstElement()).getTaxon()!=null;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
@Override
public void onComplete() {
-
-
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
}
--- /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.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetPublishForSubtreeOperation;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetPublishForSubtreeWizard;
+
+/**
+ * @author k.luther
+ * @date 11.10.2017
+ *
+ */
+public class SetPublishFlagForSubtreeHandlerE4 extends RemotingCdmHandlerE4 {
+
+ /**
+ * @param label
+ */
+ public SetPublishFlagForSubtreeHandlerE4() {
+ //FIXME add missing l10n property
+// super(TaxonNavigatorLabels.CHANGE_PUBLISH_FOR_SUBTREE);
+ super("");
+ }
+
+
+ private ITaxonTreeNode taxonNode;
+ private PublishForSubtreeConfigurator configurator;
+
+
+ @Override
+ public IStatus allowOperations(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+ // check that only a single taxon tree node has been selected
+ if(selection.size() > 1) { }
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check that selected object is a taxon node
+ Object obj = selection.iterator().next();
+ if(obj instanceof ITaxonTreeNode) {
+ if (obj instanceof Classification){
+ taxonNode = ((Classification)obj).getRootNode();
+ }else{
+ taxonNode = (ITaxonTreeNode)obj;
+ }
+ } else{
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+
+
+ // check if corresponding name editor is closed
+ //FIXME E4 migrate
+ // boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode);
+ // if(editorClosed != true) {
+ // return new Status(IStatus.ERROR,
+ // "unknown", //$NON-NLS-1$
+ // TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
+ // }
+
+ configurator = new PublishForSubtreeConfigurator(taxonNode.getUuid());
+ SetPublishForSubtreeWizard wizard = new SetPublishForSubtreeWizard(configurator);
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ if (dialog.open() == Window.OK) {
+ return Status.OK_STATUS;
+ }else{
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection, Shell shell, MPart activePart,
+ MHandledMenuItem menuItem) {
+ SetPublishForSubtreeOperation operation =
+ new SetPublishForSubtreeOperation(getTrigger(),
+ false,
+ taxonNode.getUuid(),
+ configurator);
+
+ return operation;
+ }
+
+
+ @Override
+ public void onComplete() {
+
+ }
+
+
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
+}
--- /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.navigation.navigator.e4.handler;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetSecundumForSubtreeOperation;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
+import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetSecundumForSubtreeConfigurationWizard;
+
+/**
+ * @author k.luther
+ * @author pplitzner
+ * @date 10.02.2017
+ *
+ */
+public class SetSecReferenceForSubtreeHandlerE4 extends RemotingCdmHandlerE4 {
+
+ private ITaxonTreeNode taxonNode;
+ private SecundumForSubtreeConfigurator configurator;
+
+ public SetSecReferenceForSubtreeHandlerE4() {
+ super(TaxonNavigatorLabels.CHANGE_SECUNDUM_FOR_SUBTREE);
+ }
+
+ @Override
+ public IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ // check that only a single taxon tree node has been selected
+ if(selection.size() > 1) { }
+
+ // check for no taxon tree node selected
+ if(selection.size() == 0) {
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
+ }
+
+ // check that selected object is a taxon node
+ Object obj = selection.iterator().next();
+ if(obj instanceof ITaxonTreeNode) {
+ if (obj instanceof Classification){
+ taxonNode = ((Classification)obj).getRootNode();
+ }else{
+ taxonNode = (ITaxonTreeNode)obj;
+ }
+ } else{
+ return new Status(IStatus.ERROR,
+ "unknown", //$NON-NLS-1$
+ TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
+ }
+
+
+ // check if corresponding name editor is closed
+ //FIXME E4 migrate
+ // boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode);
+ // if(editorClosed != true) {
+ // return new Status(IStatus.ERROR,
+ // "unknown", //$NON-NLS-1$
+ // TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
+ // }
+
+ configurator = new SecundumForSubtreeConfigurator(taxonNode.getUuid());
+ SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator);
+
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ if (dialog.open() == Window.OK) {
+ return Status.OK_STATUS;
+ }else{
+ return Status.CANCEL_STATUS;
+ }
+ }
+
+ @CanExecute
+ private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+ boolean canExecute = false;
+ canExecute = selection.getFirstElement() instanceof ITaxonTreeNode;
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ @Override
+ public AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem) {
+ SetSecundumForSubtreeOperation operation =
+ new SetSecundumForSubtreeOperation(getTrigger(),
+ true,
+ taxonNode.getUuid(),
+ configurator);
+
+ return operation;
+ }
+
+ @Override
+ public void onComplete() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTrigger() {
+ return this;
+ }
+
+}
+++ /dev/null
-/**
- *
- */
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.ChangeAcceptedTaxonToSynonymOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-/**
- * <p>ChangeAcceptedTaxonToSynonymHandler class.</p>
- *
- * @author n.hoffmann
- * @created Jan 4, 2010
- * @version 1.0
- */
-public class ChangeAcceptedTaxonToSynonymHandler extends DeleteHandler
- implements IHandler, IPostOperationEnabled {
- private static final Logger logger = Logger
- .getLogger(ChangeAcceptedTaxonToSynonymHandler.class);
- private ChangeAcceptedTaxonToSynonymOperation operation;
-
- private UUID newAcceptedTaxonNodeUuid;
- private TaxonNameEditor editor;
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
-
- activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
-
- taxonNavigator = NavigationUtil.showNavigator();
-
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
-
- // Prompt user for confirmation
-
-
-
- Iterator selectionIterator = selection.iterator();
- Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
-
- while (selectionIterator.hasNext()){
- Object object = selectionIterator.next();
- if(object instanceof ITaxonTreeNode) {
- treeNodes.add((ITaxonTreeNode) object);
- }
- }
- boolean allEditorsClosed = true;
- for (ITaxonTreeNode treeNode : treeNodes){
- if(treeNode instanceof TaxonNode) {
- allEditorsClosed &= closeObsoleteEditor((TaxonNode) treeNode);
- }
- }
- AbstractPostOperation operation = null;
- if (treeNodes.size() == 1 ){
- try {
-
- ITaxonTreeNode treeNode = treeNodes.iterator().next();
- ITaxonTreeNode oldAcceptedTaxonNode =treeNode;
-
- // check if taxon has no children
- if(((TaxonNode)oldAcceptedTaxonNode).getCountChildren() > 0) {
- MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE, this,
- Messages.ChangeAcceptedTaxonToSynonymHandler_PREREQUISITE_MESSAGE);
- return null;
- }
- /*if(((TaxonNode)oldAcceptedTaxonNode).getTaxon().hasSynonyms()) {
- EditorUtil.warningDialog("Prerequisite not met", this,
- "The accepted taxon must not have any synonyms. You need to move all synonyms to " +
- "another taxon before attempting to turn the accepted " +
- "taxon into a synonym.");
- return null;
- }*/
-
- List<UUID> excludeTaxa = new ArrayList<UUID>();
- excludeTaxa.add(((TaxonNode)oldAcceptedTaxonNode).getTaxon().getUuid());
- TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
- taxonNavigator.getConversationHolder(),
- Messages.ChangeAcceptedTaxonToSynonymHandler_CHOOSE_TAXON,
- excludeTaxa,
- null,
- ((TaxonNode)oldAcceptedTaxonNode).getClassification());
-
- if (newAcceptedTaxonNode == null) {
- return null;
- }
-
- if (allEditorsClosed){
-
- operation = new ChangeAcceptedTaxonToSynonymOperation(event.getCommand().getName(),
- NavigationUtil.getUndoContext(),
- oldAcceptedTaxonNode,
- newAcceptedTaxonNode,
- taxonNavigator,
- taxonNavigator,
- taxonNavigator);
-
- NavigationUtil.executeOperation(operation);
- //}
- }
-
-
-
- } catch (NotDefinedException e) {
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$
- }
- } else{
- if( MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY, Messages.ChangeAcceptedTaxonToSynonymHandler_MOVE_SYNONYMY_MESSAGE)){
- return null;
- }
- }
-
-
- return null;
-
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
- */
- /** {@inheritDoc} */
- @Override
- public boolean postOperation(CdmBase objectAffectedByOperation) {
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- EditorUtil.close(editor.getMultiPageTaxonEditor());
-
- try {
- MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
- if(possibleOpenEditor != null){
- EditorUtil.close(possibleOpenEditor);
- }
- EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.ChangeAcceptedTaxonToSynonymHandler_CREATE_FAILED, this, e.getMessage());
- }
- }
-
- });
-
-
- return true;
- }
-
- /**
- * <p>onComplete</p>
- *
- * @return a boolean.
- */
- @Override
- public boolean onComplete() {
- // TODO Auto-generated method stub
- return false;
- }
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.navigation.operation.CloneClassificationOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.section.classification.CloneClassificationWizard;
-
-public class CloneClassificationHandler extends AbstractHandler {
-
- @SuppressWarnings("unused")
- private static final Logger logger = Logger.getLogger(CloneClassificationHandler.class);
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (currentSelection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
- if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
- Classification classification = ((TaxonNode)selectedElement).getClassification();
- TaxonNavigator taxonNavigator = (TaxonNavigator)AbstractUtility.showView(TaxonNavigator.ID);
- CloneClassificationWizard wizard = new CloneClassificationWizard(classification);
- WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
- dialog.open();
-
- String classificationName = wizard.getClassificationName();
- TaxonRelationshipType relationType = wizard.getRelationType();
- Reference reference = wizard.getReference();
-
- CloneClassificationOperation operation = new CloneClassificationOperation(Messages.CloneClassificationHandler_CLONE_CLASSIFICATION,
- StoreUtil.getUndoContext(), classification, classificationName, reference, relationType,
- NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
-
- AbstractUtility.executeOperation(operation);
- taxonNavigator.refresh();
- }
- }
- return null;
- }
-
-}
+++ /dev/null
-/**\r
-* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\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
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.IHandler;\r
-import org.eclipse.core.commands.common.NotDefinedException;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-\r
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;\r
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;\r
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.CopyOperation;\r
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
-import eu.etaxonomy.taxeditor.store.StoreUtil;\r
-\r
-/**\r
- * @author l.morris\r
- * @date 23 Jan 2012\r
- *\r
- */\r
-public class CopyHandler extends AbstractHandler implements IHandler {\r
- \r
- private TaxonNavigator taxonNavigator;\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
- */\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- \r
- taxonNavigator = NavigationUtil.showNavigator();\r
- \r
- IStructuredSelection selection = (IStructuredSelection) HandlerUtil\r
- .getCurrentSelection(event);\r
-\r
- if(selection.size() == 1) {\r
- \r
- Object selectedObject = selection.getFirstElement();\r
- \r
- if (selectedObject instanceof TaxonNode) {\r
- \r
- try {\r
- \r
- AbstractPostOperation operation = new CopyOperation(event.getCommand().getName(), StoreUtil.getUndoContext(),\r
- (TaxonNode)selectedObject, taxonNavigator);\r
- \r
- IStatus status = NavigationUtil.executeOperation(operation);\r
- \r
- } catch (NotDefinedException e) {\r
- MessagingUtils.warn(getClass(), "Command name not set"); //$NON-NLS-1$\r
- }\r
- }\r
- }\r
- \r
- \r
- return null;\r
- }\r
-\r
-}\r
+++ /dev/null
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.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;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.navigation.operation.CreateNewTaxonHierarchyOperation;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-
-public class CreateClassificationHierarchyHandler extends AbstractHandler {
-
- private static final Logger logger = Logger.getLogger(CreateClassificationHierarchyHandler.class);
-
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
- * ExecutionEvent)
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- if (currentSelection instanceof IStructuredSelection) {
- Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
- if (selectedElement instanceof TaxonNode && !((TaxonNode)selectedElement).hasTaxon()) {
-
- Classification classification = ((TaxonNode) selectedElement).getClassification();
- try {
- TaxonNavigator taxonNavigator = (TaxonNavigator)AbstractUtility.showView(TaxonNavigator.ID);
-// IClassificationService service = CdmStore.getService(IClassificationService.class);
-
- // Map<String, List<TaxonNode>> sortedGenusList =
- // service.getSortedGenusList(classification.getAllNodes());
-
-
- CreateNewTaxonHierarchyOperation operation = new CreateNewTaxonHierarchyOperation(Messages.CreateClassificationHierarchyHandler_CREATE_HIERARCHY, StoreUtil.getUndoContext(),classification,NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false) );
-
- AbstractUtility.executeOperation(operation);
-// UpdateResult result = service.createHierarchyInClassification(classification, null);
-//
-// Classification classification2 = CdmBase.deproxy(result.getCdmEntity(), Classification.class);
-//
-// Set<CdmBase> updatedObjects = result.getUpdatedObjects();
-//
-// Shell activeShell = HandlerUtil.getActiveShell(event);
-
-// MessagingUtils.messageDialog("Add Hierarchy successful",
-// FixClassificationHierarchyHandler.class, "Operation 'Fix Hierarchy' was successful. New classification is "
-// + classification2.getTitleCache() + "\nUpdated Objects: " + updatedObjects.size());
- //Success
- taxonNavigator.refresh();
- } catch (Exception e) {
- MessagingUtils.messageDialog(Messages.CreateClassificationHierarchyHandler_FAILED, CreateClassificationHierarchyHandler.class,
- Messages.CreateClassificationHierarchyHandler_FAILED_MESSAGE, e);
- }
- }
- }
- return null;
- }
-
-}
+++ /dev/null
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.IDescriptionService;
-import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
-
-public class MoveFactualDataHandler extends AbstractHandler {
-
- @SuppressWarnings("unused")
- private static final Logger logger = Logger.getLogger(MoveFactualDataHandler.class);
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
- Object activePart = AbstractUtility.getActiveE4Part();
- TaxonNavigator navigator = null;
- if(activePart instanceof TaxonNavigator){
- navigator = (TaxonNavigator)activePart;
- }
- if(navigator!=null && currentSelection instanceof TreeSelection){
- Object object = ((TreeSelection) currentSelection).getFirstElement();
- if(object instanceof TaxonNode){
- TaxonNode taxonNode = HibernateProxyHelper.deproxy(object, TaxonNode.class);
- final TaxonNode sourceTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNode.getUuid());
- if(NavigationUtil.isDirty(sourceTaxonNode)){
- MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveFactualDataHandler_UNSAVED_SOURCE, Messages.MoveFactualDataHandler_UNSAVED_SOURCE_MESSAGE);
- return null;
- }
- //reload to avoid session conflicts
- Taxon taxon = HibernateProxyHelper.deproxy(CdmStore.getService(ITaxonService.class).load(sourceTaxonNode.getTaxon().getUuid()), Taxon.class);
- if(taxon!=null){
- // Choose the target taxon
- List<UUID> excludeTaxa = new ArrayList<UUID>();
- excludeTaxa.add(taxon.getUuid());
- TaxonNode dialogTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
- navigator.getConversationHolder(),
- Messages.MoveFactualDataHandler_CHOOSE_TAXON,
- excludeTaxa,
- sourceTaxonNode,
- sourceTaxonNode.getClassification());
- if (dialogTaxonNode == null) {
- return null;
- }
- //reload to avoid session conflicts
- final TaxonNode targetTaxonNode = CdmStore.getService(ITaxonNodeService.class).load(dialogTaxonNode.getUuid());
- if(NavigationUtil.isDirty(targetTaxonNode)){
- MessageDialog.openWarning(HandlerUtil.getActiveShell(event), Messages.MoveFactualDataHandler_UNSAVED_TARGET, Messages.MoveFactualDataHandler_UNSAVED_TARGET_MESSAGE);
- return null;
- }
- CdmStore.getService(IDescriptionService.class).moveTaxonDescriptions(taxon.getUuid(),targetTaxonNode.getTaxon().getUuid());
-
- navigator.getConversationHolder().bind();
- navigator.getConversationHolder().commit();
-
- Display.getDefault().asyncExec(new Runnable(){
-
- @Override
- public void run() {
- try {
- //close and re-open to refresh factual data view
- MultiPageTaxonEditor sourceEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(sourceTaxonNode.getUuid());
- MultiPageTaxonEditor targetEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(targetTaxonNode.getUuid());
- if(targetEditor != null){
- AbstractUtility.close(sourceEditor);
- AbstractUtility.close(targetEditor);
- }
- EditorUtil.openTaxonNode(sourceTaxonNode.getUuid());
- EditorUtil.openTaxonNode(targetTaxonNode.getUuid());
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), e);
- throw new RuntimeException(e);
- } catch (Exception e) {
- MessagingUtils.warningDialog(Messages.MoveFactualDataHandler_CREATE_FAILED, this, e.getMessage());
- }
- }
-
- });
- }
- }
- }
- return null;
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2015 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.common.ITreeNode;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
-
-/**
- * @author cmathew
- * @date 16 Jun 2015
- *
- */
-public class NavigatorHandlerUtils {
-
- protected static boolean closeObsoleteEditor(ExecutionEvent event, TaxonNode taxonNode){
- IWorkbenchPage activePage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
- boolean result = true;
- for (IEditorReference ref : activePage.getEditorReferences()) {
- try {
- String treeIndex = ((ITreeNode)taxonNode).treeIndex();
-
-
- IEditorInput input = ref.getEditorInput();
- if (input instanceof TaxonEditorInput) {
- TaxonNode node = ((TaxonEditorInput) input).getTaxonNode();
- //if node is a child of taxonNode then close the editor
- if( ((ITreeNode) node).treeIndex().startsWith(treeIndex)){
- //if (taxonNode.equals(node)) {
- result &= activePage.closeEditor(ref.getEditor(false), true);
-
- }
- }
- } catch (PartInitException e) {
- continue;
- }
- }
- return result;
- }
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.navigation.navigator.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-
-/**
- * <p>NewClassificationHandler class.</p>
- *
- * @author n.hoffmann
- * @created Sep 15, 2009
- * @version 1.0
- */
-public class NewClassificationHandler extends AbstractHandler implements
- IHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- NewClassificationWizard wizard = new NewClassificationWizard();
- wizard.init(null, null);
- WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
- dialog.open();
-
- return null;
- }
-}
+++ /dev/null
-/**
- * Copyright (C) 2007 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.navigation.navigator.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.newWizard.IWizardPageListener;
-import eu.etaxonomy.taxeditor.newWizard.NewTaxonNodeWizard;
-
-/**
- * <p>NewTaxonNodeHandler class.</p>
- *
- * @author n.hoffmann
- * @created Sep 15, 2009
- * @version 1.0
- */
-public class NewTaxonNodeHandler extends AbstractHandler {
-
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- final NewTaxonNodeWizard wizard = new NewTaxonNodeWizard();
- wizard.init(null, null);
- final WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
- wizard.addWizardPageListener(new IWizardPageListener() {
-
- @Override
- public void close() {
- wizard.performFinish();
- dialog.close();
- }
- });
- int status = dialog.open();
-
- if(status == IStatus.OK && wizard.openInEditor()){
- if(wizard.openEmpty()){
- NavigationUtil.openEmpty(wizard.getParentTreeNode().getUuid());
- }else if(wizard.getTaxonNode() != null){
- NavigationUtil.openEditor(wizard.getTaxonNode());
- }
- }
- return null;
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.navigation.navigator.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
-
-/**
- * <p>RefreshTreeHandler class.</p>
- *
- * @author p.ciardelli
- * @created 04.09.2009
- * @version 1.0
- */
-public class RefreshTreeHandler extends AbstractHandler {
- private static final Logger logger = Logger
- .getLogger(RefreshTreeHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- IWorkbenchPart part = HandlerUtil.getActivePart(event);
- if (part instanceof TaxonNavigator) {
- ((TaxonNavigator) part).refresh();
- }
- return null;
- }
-}
+++ /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.navigation.navigator.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.operations.AbstractOperation;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
-import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigatorLabels;
-import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetSecundumForSubtreeOperation;
-import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.dialog.configurator.SetSecundumForSubtreeConfigurationWizard;
-
-/**
- * @author k.luther
- * @date 10.02.2017
- *
- */
-public class SetSecReferenceForSubtreeHandler extends RemotingCdmHandler {
-
- private static final Logger logger = Logger
- .getLogger(SetSecReferenceForSubtreeHandler.class);
-
-
- private ITaxonTreeNode taxonNode;
- private SetSecundumForSubtreeConfigurator configurator;
-
- /**
- * @param label
- */
- public SetSecReferenceForSubtreeHandler() {
- super(TaxonNavigatorLabels.CHANGE_SECUNDUM_FOR_SUBTREE);
- }
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#allowOperations(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public IStatus allowOperations(ExecutionEvent event) {
- TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
- // check that only a single taxon tree node has been selected
- if(selection.size() > 1) { }
-
- // check for no taxon tree node selected
- if(selection.size() == 0) {
- return new Status(IStatus.ERROR,
- "unknown", //$NON-NLS-1$
- TaxonNavigatorLabels.NO_TAXON_SELECTION_MESSAGE);
- }
-
- // check that selected object is a taxon node
- Object obj = selection.iterator().next();
- if(obj instanceof ITaxonTreeNode) {
- if (obj instanceof Classification){
- taxonNode = ((Classification)obj).getRootNode();
- }else{
- taxonNode = (ITaxonTreeNode)obj;
- }
- } else{
- return new Status(IStatus.ERROR,
- "unknown", //$NON-NLS-1$
- TaxonNavigatorLabels.SELECTED_OBJECT_NOT_TREE_NODE_MESSAGE);
- }
-
-
- // check if corresponding name editor is closed
- boolean editorClosed = NavigatorHandlerUtils.closeObsoleteEditor(event, (TaxonNode) taxonNode);
- if(editorClosed != true) {
- return new Status(IStatus.ERROR,
- "unknown", //$NON-NLS-1$
- TaxonNavigatorLabels.RELATED_EDITOR_NOT_CLOSED_MESSAGE);
- }
-
- configurator = new SetSecundumForSubtreeConfigurator(taxonNode.getUuid());
- SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator);
- wizard.setWindowTitle(Messages.SetSecundumForSubtreeHandler_CONFIG_DIALOG_TITLE);
-
- WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
-
- if (dialog.open() == Window.OK) {
- return Status.OK_STATUS;
- }else{
- return Status.CANCEL_STATUS;
- }
-
-// if(!SetSecundumForSubtreeConfigurationWizard.openConfirmWithConfigurator(configurator)){
-//
-// return Status.CANCEL_STATUS;
-// }
-//
-//
-// return Status.OK_STATUS;
- }
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#doOperations(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public AbstractOperation prepareOperation(ExecutionEvent event) {
- SetSecundumForSubtreeOperation operation =
- new SetSecundumForSubtreeOperation(event.getTrigger(),
- false,
- taxonNode.getUuid(),
- configurator);
-
- return operation;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.taxeditor.operation.RemotingCdmHandler#onComplete(org.eclipse.core.commands.ExecutionEvent)
- */
- @Override
- public void onComplete() {
- // TODO Auto-generated method stub
-
- }
-
-
-
-
-
-
-}
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TreeNodeDropAdapterE4.MovingType;
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
private final Set<UUID> taxonNodesUuid;
private final MovingType moveToParentNode;
- /**
- * <p>Constructor for MoveTaxonOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxonNodes a {@link java.util.Set} object.
- * @param newParentTreeNode a {@link eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
- */
public MoveTaxonOperation(String label, IUndoContext undoContext,
- Set<UUID> taxonNodesUUIDToMove, ITaxonTreeNode newParentTreeNode,
- IPostOperationEnabled postOperationEnabled,
+ Set<UUID> taxonNodesUUIDToMove, ITaxonTreeNode newParentTreeNode,
+ IPostOperationEnabled postOperationEnabled,
IConversationEnabled conversationEnabled, MovingType moveToParentNode) {
super(label, undoContext, postOperationEnabled, conversationEnabled);
throws ExecutionException {
bind();
monitor.worked(20);
- UpdateResult result;
switch(this.moveToParentNode){
case CHILD:
- result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 0);
+ CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 0);
+ break;
case PREVIOUS:
- result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 1);
+ CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 1);
+ break;
case BEHIND:
- result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 2);
+ CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(this.taxonNodesUuid,newParentTreeNode.getUuid(), 2);
+ break;
}
// try {
--- /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.navigation.navigator.operation;
+
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.api.application.CdmApplicationException;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
+import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
+
+/**
+ * @author k.luther
+ * @date 11.10.2017
+ *
+ */
+public class SetPublishForSubtreeOperation extends RemotingCdmUpdateOperation {
+
+ private final static String LABEL = Messages.SetPublishForSubtreeOperation_CHANGE_PUBLISH_OP;
+ private static final Logger logger = Logger
+ .getLogger(SetPublishForSubtreeOperation.class);
+ UUID parentUuid;
+ PublishForSubtreeConfigurator config;
+
+ /**
+ * @param label
+ * @param action
+ * @param source
+ * @param async
+ */
+ public SetPublishForSubtreeOperation(Object source,
+ boolean async,
+ UUID taxonNodeUuid,
+ PublishForSubtreeConfigurator config) {
+ super(LABEL, Action.Update, source, async);
+ parentUuid = taxonNodeUuid;
+ this.config = config;
+ this.updateResult = new UpdateResult();
+ }
+
+
+// /* (non-Javadoc)
+// * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+// */
+// @Override
+// protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+// ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class);
+//// taxonService.setSecundumForSubtree(config.getSubtreeUuid(), config.getNewSecundum(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isOverwriteExistingAccepted(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail(), null);
+// eu.etaxonomy.cdm.common.monitor.IProgressMonitor cdmMonitor = CdmProgressMonitorAdapter.CreateMonitor(monitor);
+// updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), config.isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), null);
+// return updateResult;
+// }
+
+ @Override
+ protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+// runMoniteredOperation();
+
+ Job job = createJob(monitor);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ return updateResult;
+
+
+ }
+
+
+ private Job createJob(IProgressMonitor monitor){
+ Assert.isNotNull(config, "Configuration may not be null");
+
+ final Display display = Display.getDefault();
+
+ Job job = new Job(Messages.SetSecundumForSubtreeOperation_SET_SEC_TASK) {
+
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+
+ try {
+ ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class);
+ updateResult = taxonService.setPublishForSubtree(config.getSubtreeUuid(), config.isPublish(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isIncludeSharedTaxa(), null);
+
+ } catch (CdmApplicationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+//
+ return Status.OK_STATUS;
+
+ }
+ };
+ return job;
+ }
+
+}
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
-import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
-import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator;
-import eu.etaxonomy.cdm.io.service.IIOService;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation;
private static final Logger logger = Logger
.getLogger(SetSecundumForSubtreeOperation.class);
UUID parentUuid;
- SetSecundumForSubtreeConfigurator config;
- UpdateResult updateResult = new UpdateResult();
+ SecundumForSubtreeConfigurator config;
+
/**
* @param label
public SetSecundumForSubtreeOperation(Object source,
boolean async,
UUID taxonNodeUuid,
- SetSecundumForSubtreeConfigurator config) {
+ SecundumForSubtreeConfigurator config) {
super(LABEL, Action.Update, source, async);
parentUuid = taxonNodeUuid;
this.config = config;
+ this.updateResult = new UpdateResult();
}
/**
*/
@Override
protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+// runMoniteredOperation();
+
Job job = createJob(monitor);
// configure the job
job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
@Override
protected IStatus run(IProgressMonitor monitor) {
-
+
try {
- eu.etaxonomy.cdm.common.monitor.IProgressMonitor cdmMonitor = CdmProgressMonitorAdapter.CreateMonitor(monitor);
+// eu.etaxonomy.cdm.common.monitor.IProgressMonitor cdmMonitor = CdmProgressMonitorAdapter.CreateMonitor(monitor);
+// config.setMonitor(cdmMonitor);
ITaxonNodeService taxonService = CdmApplicationState.getService(ITaxonNodeService.class);
// taxonService.setSecundumForSubtree(config.getSubtreeUuid(), config.getNewSecundum(), config.isIncludeAcceptedTaxa(), config.isIncludeSynonyms(), config.isOverwriteExistingAccepted(), config.isOverwriteExistingSynonyms(), config.isIncludeSharedTaxa(), config.isEmptySecundumDetail(), null);
- final UUID uuid = taxonService.monitSetSecundum(config);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- AbstractUtility.executeMoniteredOperation("Update: " + config.getClass().getSimpleName(),
- uuid,
- 1000,
- false,
- SetSecundumForSubtreeOperation.this,
- null);
- }
- });
+ updateResult = taxonService.setSecundumForSubtree(config);
+
+// Display.getDefault().asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// AbstractUtility.executeMoniteredOperation("Update: " + config.getClass().getSimpleName(),
+// uuid,
+// 1000,
+// false,
+// SetSecundumForSubtreeOperation.this,
+// null);
+// }
+// });
+
} catch (CdmApplicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-//
+//
return Status.OK_STATUS;
}
}
+ public void runMoniteredOperation() {
+ ITaxonNodeService nodeService;
+ try {
+ nodeService = CdmApplicationState.getService(ITaxonNodeService.class);
+
+ final UUID uuid = nodeService.monitSetSecundum(config);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ AbstractUtility.executeMoniteredOperation("Set Secundum Reference for Subtree: ",
+ uuid,
+ 1000,
+ false,
+ SetSecundumForSubtreeOperation.this,
+ null);
+ }
+ });
+ } catch (CdmApplicationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
package eu.etaxonomy.taxeditor.navigation.search;
+import java.util.List;
+
import javax.annotation.PostConstruct;
+import javax.inject.Inject;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.swt.IFocusService;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
+import eu.etaxonomy.taxeditor.navigation.AppModelId;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.search.e4.SearchResultViewE4;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* @author n.hoffmann
* @version 1.0
*/
public class SearchBar implements IContextListener{
- private Text text_search;
- private String secondaryId;
+
+ public static final String NAVIGATION_STACK_ID = "navigation";
+
+ private Text text_search;
private ToolBar toolBar;
private final String defaultText = Messages.SearchBar_0;
+ @Inject
+ private EPartService partService;
+
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
final private ConfigurationSelectionListener configurationListener = new ConfigurationSelectionListener();
/** {@inheritDoc} */
text_search.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND));
text_search.setText(defaultText);
text_search.setEnabled(false);
+ RowData layoutData = new RowData();
+ layoutData.width = 150;
+ text_search.setLayoutData(layoutData);
addTextListeners();
}
private void createLayout(Composite composite) {
final RowLayout layout = new RowLayout();
layout.wrap = false;
- layout.pack = true;
- layout.justify = true;
+ layout.pack = false;
+ layout.justify = false;
layout.type = SWT.HORIZONTAL;
- layout.marginLeft = 0;
+ layout.marginLeft = 5;
layout.marginTop = 0;
- layout.marginRight = 0;
+ layout.marginRight = 5;
layout.marginBottom = 0;
layout.spacing = 0;
composite.setLayout(layout);
*/
private void openSearchResultsView(IFindTaxaAndNamesConfigurator configurator) {
boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
- if(openResultInSeparateWindows){
- //increment change secondary id so it is unique
- secondaryId += "1";
+ String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_SEARCH_E4_SEARCHRESULTVIEWE4;
+
+ MPart part = null;
+ List<MPart> resultViews = modelService.findElements(application, partId, MPart.class, null);
+ for (MPart mPart : resultViews) {
+ if(mPart.getObject()!=null && mPart.isToBeRendered()){
+ part = mPart;
+ break;
+ }
+ }
+ if(part==null){
+ part = partService.findPart(partId);
}
-
- try {
- IViewPart resultsView = TaxeditorNavigationPlugin.getDefault()
- .getWorkbench().getActiveWorkbenchWindow()
- .getActivePage().showView(SearchResultView.ID, secondaryId,
- IWorkbenchPage.VIEW_ACTIVATE);
- ((SearchResultView) resultsView).performSearch(configurator);
- } catch (PartInitException e) {
- MessagingUtils.error(this.getClass(), Messages.SearchBar_4, e);
+ if(openResultInSeparateWindows && part.getObject()!=null){
+ MPartStack resultViewPartStack = getSearchResulPartStack(partId);
+ part = partService.createPart(partId);
+ //FIXME E4 this part stack id has to re-used or a adapted after migration
+ if(resultViewPartStack==null){
+ resultViewPartStack = WorkbenchUtility.getPartStack(NAVIGATION_STACK_ID, application, modelService);
+ }
+ if(resultViewPartStack!=null){
+ resultViewPartStack.getChildren().add(part);
+ }
}
+ part = partService.showPart(part, PartState.ACTIVATE);
+ SearchResultViewE4 resultView = (SearchResultViewE4)part.getObject();
+ resultView.performSearch(configurator);
+ }
+
+ private MPartStack getSearchResulPartStack(String partId){
+ List<MPartStack> elements = modelService.findElements(application, null, MPartStack.class, null);
+ for (MPartStack partStack : elements) {
+ List<MStackElement> children = partStack.getChildren();
+ for (MStackElement mStackElement : children) {
+ if(mStackElement.getElementId().equals(partId)){
+ return partStack;
+ }
+ }
+ }
+ return null;
}
/**
}
}
- /**
- * Available search options.
- *
- * @author n.hoffmann
- * @created Feb 2, 2010
- * @version 1.0
- */
- enum SearchOption {
- TAXON(Messages.SearchBar_6),
- SYNONYM(Messages.SearchBar_7),
- NAME(Messages.SearchBar_8),
- COMMON_NAME(Messages.SearchBar_9);
-
- private final String label;
-
- private SearchOption(String label) {
- this.label = label;
- }
-
- public String getLabel() {
- return label;
- }
-
- public boolean getPreference() {
- if (!PreferencesUtil.getPreferenceStore().contains(
- IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
- // initializes the search configurator
- PreferencesUtil.initializeSearchConfigurator();
- }
-
- switch (this) {
- case TAXON:
- boolean result = PreferencesUtil.getPreferenceStore().getBoolean(
- IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA);
- return result;
- case SYNONYM:
- return PreferencesUtil.getPreferenceStore().getBoolean(
- IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
- case NAME:
- return PreferencesUtil.getPreferenceStore().getBoolean(
- IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_NAMES);
- case COMMON_NAME:
- return PreferencesUtil.getPreferenceStore().getBoolean(
- IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
- }
-
- return true;
- }
-
- }
-
@Override
public void contextAboutToStop(IMemento memento, IProgressMonitor monitor) {
}
--- /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.navigation.search;
+
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author pplitzner
+ * @since Sep 27, 2017
+ *
+ */
+public enum SearchOption {
+ TAXON(Messages.SearchBar_6),
+ SYNONYM(Messages.SearchBar_7),
+ NAME(Messages.SearchBar_8),
+ COMMON_NAME(Messages.SearchBar_9);
+
+ private final String label;
+
+ private SearchOption(String label) {
+ this.label = label;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public boolean getPreference() {
+ if (!PreferencesUtil.getPreferenceStore().contains(
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA)) {
+ // initializes the search configurator
+ PreferencesUtil.initializeSearchConfigurator();
+ }
+
+ switch (this) {
+ case TAXON:
+ boolean result = PreferencesUtil.getPreferenceStore().getBoolean(
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_TAXA);
+ return result;
+ case SYNONYM:
+ return PreferencesUtil.getPreferenceStore().getBoolean(
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_SYNONYMS);
+ case NAME:
+ return PreferencesUtil.getPreferenceStore().getBoolean(
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_NAMES);
+ case COMMON_NAME:
+ return PreferencesUtil.getPreferenceStore().getBoolean(
+ IPreferenceKeys.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES);
+ }
+
+ return true;
+ }
+
+}
// $$Id$$
/**
* 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.
*/
package eu.etaxonomy.taxeditor.navigation.search;
import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.Resources;
/**
- * <p>SearchResultLabelProvider class.</p>
*
* @author n.hoffmann
* @created 04.05.2009
* @version 1.0
*/
-public class SearchResultLabelProvider extends ColumnLabelProvider implements ILabelProvider {
-
+public class SearchResultLabelProvider extends ColumnLabelProvider {
+
/** {@inheritDoc} */
- public String getText(Object element) {
+ @Override
+ public String getText(Object element) {
if(element instanceof UuidAndTitleCache){
return ((UuidAndTitleCache) element).getTitleCache();
}
return element.toString();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getBackground(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public Color getBackground(Object element) {
return super.getBackground(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getFont(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public Font getFont(Object element) {
- if(element instanceof Taxon){
- return NavigationUtil.getFont(Resources.FONT_SEARCH_VIEW_ACCEPTED);
- }else if(element instanceof Synonym){
- return NavigationUtil.getFont(Resources.FONT_SEARCH_VIEW_SYNONYM);
- }else{
- return NavigationUtil.getFont(Resources.FONT_SEARCH_VIEW_OTHER);
- }
+ if(element instanceof UuidAndTitleCache){
+ Class type = ((UuidAndTitleCache) element).getType();
+ if(type == Taxon.class){
+ return AbstractUtility.getFont(Resources.FONT_SEARCH_VIEW_ACCEPTED);
+ }else if(type == Synonym.class){
+ return AbstractUtility.getFont(Resources.FONT_SEARCH_VIEW_SYNONYM);
+ }
+ }
+ return AbstractUtility.getFont(Resources.FONT_SEARCH_VIEW_OTHER);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getForeground(java.lang.Object)
- */
- /** {@inheritDoc} */
- @Override
- public Color getForeground(Object element) {
- if(element instanceof UuidAndTitleCache){
- Class type = ((UuidAndTitleCache) element).getType();
- if(type == Taxon.class){
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorAccepted"); //$NON-NLS-1$
- }else if(type == Synonym.class){
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorSynonym"); //$NON-NLS-1$
- }
- }
- return NavigationUtil.getColorRegistry().get("eu.etaxonomy.taxeditor.preferences.searchResult.fontColorDefault"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object)
- */
/** {@inheritDoc} */
@Override
public Image getImage(Object element) {
return super.getImage(element);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellLabelProvider#getToolTipText(java.lang.Object)
- *
- * does not seem t work right now
- */
+
/** {@inheritDoc} */
@Override
public String getToolTipText(Object element) {
- if(element instanceof TaxonBase){
- if(element instanceof Synonym){
- return Messages.SearchResultLabelProvider_SYNONYM + ((TaxonBase<?>) element).getName().getTitleCache();
- }else{
- return Messages.SearchResultLabelProvider_TAXON + ((TaxonBase<?>) element).getName().getTitleCache();
- }
- }
- return Messages.SearchResultLabelProvider_NAME + element.toString();
+ if(element instanceof UuidAndTitleCache){
+ Class type = ((UuidAndTitleCache) element).getType();
+ if(TaxonBase.class.isAssignableFrom(type)){
+ if(type.equals(Synonym.class)){
+ return Messages.SearchResultLabelProvider_SYNONYM + ((TaxonBase<?>) element).getName().getTitleCache();
+ }else{
+ return Messages.SearchResultLabelProvider_TAXON + ((TaxonBase<?>) element).getName().getTitleCache();
+ }
+ }
+ }
+ return Messages.SearchResultLabelProvider_NAME + element.toString();
}
-
-
-
+
}
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.cdm.persistence.query.MatchMode;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
import eu.etaxonomy.taxeditor.model.IContextListener;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
-import eu.etaxonomy.taxeditor.navigation.search.SearchBar.SearchOption;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
@Override
public void contextStop(IMemento memento, IProgressMonitor monitor) {
monitor.subTask(Messages.SearchResultView_REMOVE_SEARCH_RESULTS);
- AbstractUtility.hideView(SearchResultView.this);
+// AbstractUtility.hideView(SearchResultView.this);
}
}
if(selection instanceof IStructuredSelection){
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if(firstElement instanceof UuidAndTitleCache){
- NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
+// NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
}
}
}
--- /dev/null
+/**
+* Copyright (C) 2007 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.navigation.search.e4;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.cdm.persistence.query.MatchMode;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
+import eu.etaxonomy.taxeditor.model.IContextListener;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
+import eu.etaxonomy.taxeditor.navigation.search.SearchOption;
+import eu.etaxonomy.taxeditor.navigation.search.SearchResultLabelProvider;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 27, 2017
+ *
+ */
+public class SearchResultViewE4 implements IConversationEnabled{
+
+ private static Object[] EMPTY = new Object[0];
+
+ @Inject
+ private MPart thisPart;
+
+ private class ContextListener extends ContextListenerAdapter{
+ @Override
+ public void contextStop(IMemento memento, IProgressMonitor monitor) {
+ //close view when workbench closes
+ try{
+ thisPart.getContext().get(EPartService.class).hidePart(thisPart);
+ }
+ catch(Exception e){
+ //nothing
+ }
+ }
+ }
+
+ /** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.searc"{trunked}</code> */
+ public static final String ID =
+ "eu.etaxonomy.taxeditor.navigation.search.searchResultView"; //$NON-NLS-1$
+
+ private TableViewer resultViewer;
+
+ private ConversationHolder conversation;
+
+ private Text searchString;
+
+ private Text configurationLabel;
+
+ private Text status;
+
+ private SearchJob searchJob;
+
+ private IContextListener contextListener;
+
+ @Inject
+ private ESelectionService selService;
+
+ @Inject
+ private MApplication application;
+
+ @Inject
+ private EModelService modelService;
+
+ @Inject
+ private EPartService partService;
+
+ private ISelectionChangedListener selectionChangedListener;
+
+ /** {@inheritDoc} */
+ @PostConstruct
+ public void createPartControl(Composite parent, EMenuService menuService) {
+ if (CdmStore.isActive()){
+ if(conversation == null){
+ conversation = getConversation_internal();
+ }
+ }
+ else{
+ return;
+ }
+ contextListener = new ContextListener();
+ CdmStore.getContextManager().addContextListener(contextListener);
+
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+
+ parent.setLayout(layout);
+
+ Composite infoComposite = createInfoComposite(parent);
+ infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ resultViewer = new TableViewer(parent, SWT.NONE);
+ resultViewer.setContentProvider(new ArrayContentProvider());
+ resultViewer.setLabelProvider(new SearchResultLabelProvider());
+ resultViewer.addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection instanceof IStructuredSelection){
+ Object firstElement = ((IStructuredSelection) selection).getFirstElement();
+ if(firstElement instanceof UuidAndTitleCache){
+ NavigationUtil.openEditor((UuidAndTitleCache) firstElement, resultViewer.getControl().getShell(), modelService, partService, application);
+ }
+ }
+ }
+ });
+
+ resultViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ //propagate selection
+ selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+ resultViewer.addSelectionChangedListener(selectionChangedListener);
+
+ //create context menu
+ menuService.registerContextMenu(resultViewer.getControl(), "eu.etaxonomy.taxeditor.navigation.popupmenu.searchresults");
+
+ }
+
+ private Composite createInfoComposite(Composite parent){
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ composite.setLayout(new GridLayout(2, false));
+
+ Label searchStringLabel = new Label(composite, SWT.NULL);
+ searchStringLabel.setText(Messages.SearchResultView_SEARCH_STRING);
+
+ searchString = new Text(composite, SWT.NULL);
+ searchString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ searchString.setEditable(false);
+// searchString.setText(" ");
+
+ Label configurationDescriptionLabel = new Label(composite, SWT.NULL);
+ configurationDescriptionLabel.setText(Messages.SearchResultView_SEARCH_FOR);
+
+ configurationLabel = new Text(composite, SWT.WRAP);
+ configurationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ configurationLabel.setEditable(false);
+
+ Label statusLabel = new Label(composite, SWT.NULL);
+ statusLabel.setText(Messages.SearchResultView_STATUS);
+
+ status = new Text(composite, SWT.NULL);
+ status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ status.setEditable(false);
+
+ return composite;
+ }
+
+ /**
+ * <p>performSearch</p>
+ *
+ * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
+ */
+ public void performSearch(IFindTaxaAndNamesConfigurator configurator){
+ thisPart.setLabel(String.format(Messages.SearchResultView_SEARCH, configurator.getTitleSearchString()));
+
+ searchString.setText(configurator.getTitleSearchString());
+
+ List<String> includedEntities = new ArrayList<String>();
+ if(configurator.isDoTaxa()) {
+ includedEntities.add(SearchOption.TAXON.getLabel());
+ }
+ if(configurator.isDoSynonyms()) {
+ includedEntities.add(SearchOption.SYNONYM.getLabel());
+ }
+ if(configurator.isDoNamesWithoutTaxa()) {
+ includedEntities.add(SearchOption.NAME.getLabel());
+ }
+ if(configurator.isDoTaxaByCommonNames()){
+ includedEntities.add(SearchOption.COMMON_NAME.getLabel());
+ }
+ configurator.setMatchMode(MatchMode.LIKE);
+
+ String includedEntitiesString = ""; //$NON-NLS-1$
+ for (int i = 0; i < includedEntities.size(); i++){
+ includedEntitiesString += includedEntities.get(i);
+ if(i < includedEntities.size() -1){
+ includedEntitiesString += ", "; //$NON-NLS-1$
+ }
+ }
+
+ configurationLabel.setText(includedEntitiesString);
+
+ status.setText(Messages.SearchResultView_SEARCHING);
+
+ searchJob = new SearchJob(Display.getCurrent(), configurator);
+ searchJob.schedule();
+
+ }
+
+ /**
+ * <p>displaySearchResult</p>
+ *
+ * @param result a {@link java.util.List} object.
+ */
+ protected void displaySearchResult(List<UuidAndTitleCache<IdentifiableEntity>> result) {
+ if(result.size() > 0){
+ resultViewer.setInput(result);
+ status.setText(String.format(Messages.SearchResultView_CNT_ENTITIES_FOUND, result.size()));
+ }else{
+ resultViewer.setInput(EMPTY);
+ status.setText(Messages.SearchResultView_NO_RESULTS);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Focus
+ public void setFocus() {
+ //logger.warn("Setting focus to search result viewer");
+ ConversationHolder conversation_internal = getConversation_internal();
+ if(conversation_internal!=null){
+ conversation_internal.bind();
+ }
+ // pass focus to resultViewer
+ if(resultViewer!=null && resultViewer.getControl()!=null){
+ resultViewer.getControl().setFocus();
+ }
+ }
+
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return this.conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /** {@inheritDoc} */
+ @PreDestroy
+ public void dispose() {
+ if(conversation!=null){
+ conversation.close();
+ }
+ if(searchJob != null) {
+ searchJob.cancel();
+ }
+ }
+
+ private ConversationHolder getConversation_internal(){
+ if(conversation==null && CdmStore.isActive()){
+ try {
+ conversation = CdmStore.createConversation();
+ } catch (Exception e) {
+ //nothing
+ }
+ }
+ return conversation;
+ }
+
+ /**
+ *
+ * @author n.hoffmann
+ * @created Feb 2, 2010
+ * @version 1.0
+ */
+ class SearchJob extends Job{
+
+ private final IFindTaxaAndNamesConfigurator configurator;
+
+ private final Display display;
+
+ /**
+ * @param name
+ */
+ public SearchJob(Display display, IFindTaxaAndNamesConfigurator configurator) {
+ super(Messages.SearchResultView_PERFORMING_SEARCH);
+ this.display = display;
+ this.configurator = configurator;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("", 100); //$NON-NLS-1$
+ monitor.worked(20);
+
+ final List<UuidAndTitleCache<IdentifiableEntity>> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator);
+ monitor.worked(40);
+
+ if(! monitor.isCanceled()){
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ displaySearchResult(searchResult);
+ }
+ });
+ }else{
+ display.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ status.setText(Messages.SearchResultView_CANCELLED);
+ }
+ });
+ }
+ monitor.done();
+ return Status.OK_STATUS;
+ }
+
+ }
+}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.model.taxon.Classification;
import eu.etaxonomy.cdm.model.taxon.Taxon;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.taxeditor.navigation.navigator.TreeNodeDropAdapter.MovingType;
+import eu.etaxonomy.taxeditor.navigation.navigator.e4.TreeNodeDropAdapterE4.MovingType;
import eu.etaxonomy.taxeditor.store.operations.AbstractTaxeditorOperationTestBase;
/**
private static TaxonNode oldParentTaxonNode;
private static TaxonNode newParentTaxonNode;
private static TaxonNode taxonNode;
-
+
/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
-
+
taxon = Taxon.NewInstance(null, null);
oldParentTaxon = Taxon.NewInstance(null, null);
newParentTaxon = Taxon.NewInstance(null, null);
-
+
tree = Classification.NewInstance(null);
oldParentTaxonNode = tree.addChildTaxon(oldParentTaxon, null, null);
newParentTaxonNode = tree.addChildTaxon(newParentTaxon, null, null);
-
+
taxonNode = oldParentTaxonNode.addChildTaxon(taxon, null, null);
-
+
Set<UUID> taxonNodeUuidSet = new HashSet<UUID>();
//TODO ??
IConversationEnabled conversationEnabled = null;
taxonNodeUuidSet.add(taxonNode.getUuid());
- operation = new MoveTaxonOperation("Move Taxon To Different Parent",
- undoContext, taxonNodeUuidSet, newParentTaxonNode, postOperation,
+ operation = new MoveTaxonOperation("Move Taxon To Different Parent",
+ undoContext, taxonNodeUuidSet, newParentTaxonNode, postOperation,
conversationEnabled, MovingType.CHILD);
}
/**
* Test method for {@link eu.etaxonomy.taxeditor.navigation.operation.MoveTaxonOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testExecuteIProgressMonitorIAdaptable() throws ExecutionException {
operation.execute(monitor, info);
-
+
Assert.assertEquals(newParentTaxon ,taxon.getTaxonNodes().iterator().next().getParent().getTaxon());
Assert.assertEquals(taxon, newParentTaxon.getTaxonNodes().iterator().next().getChildNodes().iterator().next());
Assert.assertEquals(0, oldParentTaxon.getTaxonNodes().iterator().next().getChildNodes().size());
/**
* Test method for {@link eu.etaxonomy.taxeditor.navigation.operation.MoveTaxonOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testUndoIProgressMonitorIAdaptable() throws ExecutionException {
operation.undo(monitor, info);
-
+
Assert.assertEquals(oldParentTaxon ,taxon.getTaxonNodes().iterator().next().getParent().getTaxon());
Assert.assertEquals(0, newParentTaxon.getTaxonNodes().iterator().next().getChildNodes().size());
Assert.assertEquals(taxon, oldParentTaxon.getTaxonNodes().iterator().next().getChildNodes().iterator().next());
}
-
+
/**
* Test method for {@link eu.etaxonomy.taxeditor.navigation.operation.MoveTaxonOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)}.
- * @throws ExecutionException
+ * @throws ExecutionException
*/
@Test
public void testRedoIProgressMonitorIAdaptable() throws ExecutionException {
operation.redo(monitor, info);
-
+
Assert.assertEquals(newParentTaxon ,taxon.getTaxonNodes().iterator().next().getParent().getTaxon());
Assert.assertEquals(taxon, newParentTaxon.getTaxonNodes().iterator().next().getChildNodes().iterator().next());
Assert.assertEquals(0, oldParentTaxon.getTaxonNodes().iterator().next().getChildNodes().size());
Bundle-ManifestVersion: 2
Bundle-Name: Printpublisher Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Require-Bundle: org.eclipse.osgi,
org.eclipse.ui,
eu.etaxonomy.taxeditor.cdmlib,
<parent>
<artifactId>taxeditor-parent</artifactId>
<groupId>eu.etaxonomy</groupId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.ui.handlers.HandlerUtil;
import org.jdom.Element;
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.print.IXMLEntityFactory;
import eu.etaxonomy.cdm.print.PublishConfigurator;
import eu.etaxonomy.cdm.print.out.pdf.PdfOutputModule;
import eu.etaxonomy.cdm.print.out.xml.XMLOutputModule;
-import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.printpublisher.PrintUtil;
import eu.etaxonomy.taxeditor.printpublisher.wizard.DirectPublishingWizard;
import eu.etaxonomy.taxeditor.store.CdmStore;
* @version 1.0
*/
public class GeneratePdfHandler extends AbstractHandler {
-
+
private PublishConfigurator configurator;
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
// make the editors taxon the selected taxon to export
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
IEditorInput input = editor.getEditorInput();
-
- if(!(input instanceof TaxonEditorInput)){
+
+ if(!(input instanceof TaxonEditorInputE4)){
MessagingUtils.warningDialog("PDF generation not supported for selected input", this, "Generating PDF output is not supported for the current active editor");
-
+
return null;
}
-
- configurator = PublishConfigurator.NewLocalInstance((ICdmRepository) CdmStore.getCurrentApplicationConfiguration());
-
- Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInput) input);
+
+ configurator = PublishConfigurator.NewLocalInstance(CdmStore.getCurrentApplicationConfiguration());
+
+ Element taxonNodeElement = getTaxonNodeElement((TaxonEditorInputE4) input);
configurator.addSelectedTaxonNodeElements(taxonNodeElement);
-
+
configurator.setDoPublishEntireBranches(false);
-
+
configurator.addOutputModule(new PdfOutputModule());
configurator.addOutputModule(new XMLOutputModule());
-
+
DirectPublishingWizard wizard = new DirectPublishingWizard(configurator);
WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
-
+
dialog.open();
-
+
return null;
}
-
- private Element getTaxonNodeElement(TaxonEditorInput input){
-
+
+ private Element getTaxonNodeElement(TaxonEditorInputE4 input){
+
UUID taxonNodeUuid = input.getTaxonNode().getUuid();
-
+
IXMLEntityFactory factory = configurator.getFactory();
-
+
Element taxonNodeElement = factory.getTaxonNode(taxonNodeUuid);
-
+
return taxonNodeElement;
}
}
Bundle-ManifestVersion: 2
Bundle-Name: DataStore Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Bundle-Localization: OSGI-INF/l10n/bundle
eu.etaxonomy.taxeditor.editor,
eu.etaxonomy.taxeditor.editor.definedterm,
eu.etaxonomy.taxeditor.editor.definedterm.input,
+ eu.etaxonomy.taxeditor.event,
eu.etaxonomy.taxeditor.featuretree,
eu.etaxonomy.taxeditor.featuretree.e4,
eu.etaxonomy.taxeditor.handler,
eu.etaxonomy.taxeditor.handler.defaultHandler,
+ eu.etaxonomy.taxeditor.handler.defaultHandler.e4,
eu.etaxonomy.taxeditor.io,
eu.etaxonomy.taxeditor.io.wizard,
eu.etaxonomy.taxeditor.labels,
eu.etaxonomy.taxeditor.model;uses:="eu.etaxonomy.cdm.model.common,eu.etaxonomy.cdm.model.name,eu.etaxonomy.cdm.model.taxon",
eu.etaxonomy.taxeditor.newWizard,
eu.etaxonomy.taxeditor.operation,
+ eu.etaxonomy.taxeditor.operation.e4,
eu.etaxonomy.taxeditor.parser,
eu.etaxonomy.taxeditor.preference,
eu.etaxonomy.taxeditor.preference.matching,
eu.etaxonomy.taxeditor.store,
eu.etaxonomy.taxeditor.store.internal,
eu.etaxonomy.taxeditor.store.operations,
+ eu.etaxonomy.taxeditor.ui,
eu.etaxonomy.taxeditor.ui.bar,
eu.etaxonomy.taxeditor.ui.combo,
eu.etaxonomy.taxeditor.ui.dialog,
org.eclipse.e4.core.commands;bundle-version="0.11.100",
org.eclipse.e4.ui.services;bundle-version="1.2.100",
org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0",
- org.eclipse.e4.core.contexts;bundle-version="1.5.1"
+ org.eclipse.e4.core.contexts;bundle-version="1.5.1",
+ org.eclipse.osgi.services,
+ org.eclipse.e4.core.services
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: eu.etaxonomy.taxeditor.webapp,
view.name.5 = Use Records\r
view.name.6 = Derivative Search\r
view.name.7 = Specimen Search\r
+view.name.8 = GBIF Specimen Import\r
\r
editor.name = Defined Term Editor\r
command.label = Derivative Search\r
wizard.name.23 = Excel Distribution Data Update\r
wizard.name.24 = RIS Reference\r
command.label.25 = Import Preferences
-partdescriptor.label.featureTreeEditor = Feature Tree Editor
+partdescriptor.label.featureTreeEditor = Feature Tree Editor\r
+command.name.OPEN_REFERENCING_OBJECTS_VIEW = Open Referencing Objects View
\ No newline at end of file
view.name.5 = Benutze Datensatz
view.name.6 = Derivatsuche
view.name.7 = Specimensuche
-view.name.8 = GBif Specimen Import
+view.name.8 = GBIF Specimen Import
editor.name = Editor f\u00fcr definierte Begriffe
command.label = Derivatsuche
command.label.0 = Details
wizard.name.23 = Excel Verbreitungsdaten Update
wizard.name.24 = RIS Referenzen
command.label.25 = Import Präferenzen
-partdescriptor.label.featureTreeEditor = Merkmalsbaum-Editor
\ No newline at end of file
+partdescriptor.label.featureTreeEditor = Merkmalsbaum-Editor
+command.name.OPEN_REFERENCING_OBJECTS_VIEW = Öffne Referenzierende Objekte
\ No newline at end of file
<?xml version="1.0" encoding="ASCII"?>
-<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
+<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/descriptor/basic" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
<imports xsi:type="commands:Command" xmi:id="_bnVKsCZxEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.command.openPart"/>
<imports xsi:type="commands:Command" xmi:id="_LlbAMEq2EeeN-dEYnw7m3g" elementId="org.eclipse.ui.file.save"/>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_xVa1wCXXEeex9MwMOgUeWw" featurename="descriptors" parentElementId="xpath:/">
<elements xsi:type="basic:PartDescriptor" xmi:id="_2xmxoCXXEeex9MwMOgUeWw" elementId="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" label="%view.name.SESSIONS" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/applications-office.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart">
<tags>nonRestore</tags>
+ <handlers xmi:id="_gbMXAL-rEeegz7IDD8MJaw" elementId="eu.etaxonomy.taxeditor.view.sessions.InspectSessionHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.sessions.InspectSessionHandler" command="_dQ0swL-rEeegz7IDD8MJaw"/>
</elements>
<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>
</elements>
<elements xsi:type="basic:PartDescriptor" xmi:id="_zTXhUGvBEeeNmdqhxF1CnA" elementId="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4" label="%view.name.4" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
<elements xsi:type="basic:PartDescriptor" xmi:id="_coTYkH3eEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4" label="%view.name.3" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4"/>
- <elements xsi:type="basic:PartDescriptor" xmi:id="_eKzREIcpEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4">
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_eKzREIcpEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource" label="%view.name" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4">
<handlers xmi:id="_DINQoIctEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource.e4.handler.ChangeConnectionHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.handler.ChangeConnectionHandlerE4" command="_efb88IcsEee-HITNnU9cVw"/>
<handlers xmi:id="_hAnq0IctEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource.e4.handler.EditDataSourceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.handler.EditDataSourceHandlerE4" command="_cs5L0IctEee-HITNnU9cVw"/>
<handlers xmi:id="_rsmsYIctEee-HITNnU9cVw" elementId="eu.etaxonomy.taxeditor.view.datasource.e4.handler.CloneDataSourceHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.datasource.e4.handler.CloneDataSourceHandlerE4" command="_o0HcUIctEee-HITNnU9cVw"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_W94ssIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel14" label="%command.label.14" command="_Z_XgsIdQEeecZ4F2Y9Z0Og"/>
</menus>
</elements>
- </fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:bulkeditor.menus.openmenu">
- <elements xsi:type="menu:MenuSeparator" xmi:id="_QtkIkJ7SEee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.store.menuseparator.beforeDetails"/>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_K6sowCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.details" label="%command.label.0" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" command="_bnVKsCZxEeeQLpuomSmVoQ">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_Qi6uICaJEeeTEd_pKXBflg" coreExpressionId="isCdmStoreConnected"/>
- <parameters xmi:id="_8E7MkGx8EeeDvI7PFhSZWg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_HBpj0KkNEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenImportViewE4" label="%view.name.7" allowMultiple="true" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenImportViewE4">
+ <tags>nonRestore</tags>
+ </elements>
+ <elements xsi:type="basic:PartDescriptor" xmi:id="_N9AMYKkNEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportViewE4" label="%view.name.8" allowMultiple="true" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportViewE4">
+ <tags>nonRestore</tags>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_TlufMCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.supplemental" label="%command.label.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/applications-office.png" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_3rW8wCXaEeex9MwMOgUeWw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.afterConcept">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_TlufMCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.supplemental" label="%command.label.1" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/applications-office.png" tooltip="%command.label.1" command="_bnVKsCZxEeeQLpuomSmVoQ">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_SwGXYCaJEeeTEd_pKXBflg" coreExpressionId="isCdmStoreConnected"/>
<parameters xmi:id="_pebl8CaIEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4"/>
</elements>
- <elements xsi:type="menu:MenuSeparator" xmi:id="_sI4r8CaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.menuseparator.afterSupplemental"/>
- <elements xsi:type="menu:MenuSeparator" xmi:id="_4s7aEJ7REee0IagNh8pHpQ" elementId="eu.etaxonomy.taxeditor.store.menuseparator.0"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_K6sowCaGEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.details" label="%command.label.0" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/accessories-text-editor.png" tooltip="%command.label.0" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_Qi6uICaJEeeTEd_pKXBflg" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_8E7MkGx8EeeDvI7PFhSZWg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4"/>
+ </elements>
<elements xsi:type="menu:HandledMenuItem" xmi:id="_1riRcCaHEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.logView" toBeRendered="false" visible="false" label="%command.label.3" command="_bnVKsCZxEeeQLpuomSmVoQ">
<parameters xmi:id="_9VpA8CaIEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="org.eclipse.pde.runtime.LogView"/>
</elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_0Dn4cCaHEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.datasource" label="%command.label.2" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" command="_bnVKsCZxEeeQLpuomSmVoQ">
- <parameters xmi:id="_54in8CaIEeeTEd_pKXBflg" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.datasource"/>
- </elements>
- <elements xsi:type="menu:HandledMenuItem" xmi:id="_jFskQCZyEeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.sessions" label="%view.name.SESSIONS" command="_bnVKsCZxEeeQLpuomSmVoQ">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_W-C-gCaJEeeTEd_pKXBflg" coreExpressionId="isCdmStoreConnected"/>
- <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">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_mPdAcGceEee0qLTtA2ZpVQ" featurename="commands" parentElementId="xpath:/">
<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"/>
<elements xsi:type="commands:Command" xmi:id="_Z_XgsIdQEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.delete" commandName="%command.name.14"/>
<elements xsi:type="commands:Command" xmi:id="_GTbAcIfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm" commandName="%command.name.6"/>
<elements xsi:type="commands:Command" xmi:id="_LMwG4IfSEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm" commandName="New kind-of term"/>
+ <elements xsi:type="commands:Command" xmi:id="_cE510JMBEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard" commandName="%command.name.OPEN_TAXONNODE_WIZARD"/>
+ <elements xsi:type="commands:Command" xmi:id="_zJ4-8JMCEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.command.openClassificationWizard" commandName="%command.name.OPEN_CLASSIFICATION_WIZARD"/>
+ <elements xsi:type="commands:Command" xmi:id="_l-AGEKjzEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.openReferencingObjectsView" commandName="%command.name.OPEN_REFERENCING_OBJECTS_VIEW"/>
+ <elements xsi:type="commands:Command" xmi:id="_TwGSwKkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.workbench.command.importSpecimens" commandName="%wizard.name.14"/>
+ <elements xsi:type="commands:Command" xmi:id="_QbHeEKmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.command.importAbcd" commandName="%wizard.name.3"/>
+ <elements xsi:type="commands:Command" xmi:id="_tpPnUKmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelDistribution" commandName="%wizard.name.23"/>
+ <elements xsi:type="commands:Command" xmi:id="_qAEkYKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelTaxa" commandName="%wizard.name.2"/>
+ <elements xsi:type="commands:Command" xmi:id="_tBCr8KmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importRisReference" commandName="%wizard.name.24"/>
+ <elements xsi:type="commands:Command" xmi:id="_bLGTMKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importSdd" commandName="%wizard.name.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_2JV9IKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importExcelSpecimen" commandName="%wizard.name.5"/>
+ <elements xsi:type="commands:Command" xmi:id="_OQ9n8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.command.importTcs" commandName="%wizard.name"/>
+ <elements xsi:type="commands:Command" xmi:id="_L0xNEKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportJaxb" commandName="%wizard.name.6"/>
+ <elements xsi:type="commands:Command" xmi:id="_ybovsKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportSdd" commandName="%wizard.name.8"/>
+ <elements xsi:type="commands:Command" xmi:id="_y69I8KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportDwca" commandName="%wizard.name.9"/>
+ <elements xsi:type="commands:Command" xmi:id="_y_uUMKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsv" commandName="%wizard.name.18"/>
+ <elements xsi:type="commands:Command" xmi:id="_zDy74KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsvName" commandName="%wizard.name.19"/>
+ <elements xsi:type="commands:Command" xmi:id="_zIKegKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCsvPrint" commandName="%wizard.name.20"/>
+ <elements xsi:type="commands:Command" xmi:id="_zLKvMKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.command.exportCdmLight" commandName="%wizard.name.22"/>
+ <elements xsi:type="commands:Command" xmi:id="_R00rwK2dEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow" commandName="%command.name.CONNECT"/>
+ <elements xsi:type="commands:Command" xmi:id="_S868QK2dEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow" commandName="%command.name.4"/>
+ <elements xsi:type="commands:Command" xmi:id="_bfjZwK2fEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler" commandName="%command.name.11"/>
+ <elements xsi:type="commands:Command" xmi:id="_KQP_sK2gEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.operations.reconnect" commandName="%command.name.RE_CONNECT"/>
+ <elements xsi:type="commands:Command" xmi:id="_SXZF8K2gEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.openPasswordWizzard" commandName="%command.name.10"/>
+ <elements xsi:type="commands:Command" xmi:id="_dQ0swL-rEeegz7IDD8MJaw" elementId="eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog" commandName="Inspect Session"/>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
<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"/>
- <elements xsi:type="commands:Handler" xmi:id="_tyCPYIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" command="_qEMrsIdPEeecZ4F2Y9Z0Og"/>
+ <elements xsi:type="commands:Handler" xmi:id="_tyCPYIdPEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.OpenDefinedTermEditorHandlerE4" command="_qEMrsIdPEeecZ4F2Y9Z0Og"/>
+ <elements xsi:type="commands:Handler" xmi:id="_XF8ogJMBEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenTaxonNodeWizardHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenTaxonNodeWizardHandlerE4" command="_cE510JMBEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_8HUM8JMCEeeR4YRjNqCKeA" elementId="eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenClassificationWizardHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenClassificationWizardHandlerE4" command="_zJ4-8JMCEeeR4YRjNqCKeA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_fKcuoKjzEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsViewHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsViewHandler" command="_l-AGEKjzEeejedk4mZQIGw"/>
+ <elements xsi:type="commands:Handler" xmi:id="_WyDA0KkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.view.dataimport.e4.handler.OpenSpecimenImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.view.dataimport.e4.handler.OpenSpecimenImportWizard" command="_TwGSwKkVEeejedk4mZQIGw"/>
+ <elements xsi:type="commands:Handler" xmi:id="_2yHUgKmYEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.io.e4.abcd.OpenAbcdImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.abcd.OpenAbcdImportWizard" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
+ <elements xsi:type="commands:Handler" xmi:id="_6slh0KmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.distribution.OpenExcelDistributionImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.excel.distribution.OpenExcelDistributionImportWizard" command="_tpPnUKmfEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_wvx9oKmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.taxa.OpenExcelTaxaImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.excel.taxa.OpenExcelTaxaImportWizard" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_96ANIKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.ris.OpenRisImportWizard" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_do2IAKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.sdd.OpenSddImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.sdd.OpenSddImportWizard" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_6BmBEKnAEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.excel.specimen.OpenExcelSpecimenImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.excel.specimen.OpenExcelSpecimenImportWizard" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_Q8Z6gKnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.io.e4.in.tcs.OpenTcsImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.tcs.OpenTcsImportWizard" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_SciLQKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard" command="_y_uUMKqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_SOrDgKqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_Uilm4KqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.sdd.OpenSddExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.sdd.OpenSddExportWizard" command="_ybovsKqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_V7abAKqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenDwcaExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenDwcaExportWizard" command="_y69I8KqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_W3SNYKqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.csv.name.OpenCsvNameExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.csv.name.OpenCsvNameExportWizard" command="_zDy74KqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_YKaCIKqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.csv.print.OpenCsvPrintExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.csv.print.OpenCsvPrintExportWizard" command="_zIKegKqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_Y2UF4KqaEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.io.e4.out.cdmlight.OpenCdmLightExportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.out.cdmlight.OpenCdmLightExportWizard" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_faMDUK2fEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionEditorWizardHandlerE4" command="_bfjZwK2fEeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_4wcDcK2rEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.ShowLoginWindowHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.ShowLoginWindowHandlerE4" command="_S868QK2dEeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_8X6gcK2rEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.ReconnectHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.ReconnectHandlerE4" command="_KQP_sK2gEeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_8g19gK2sEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.ShowRemotingLoginWindowHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.ShowRemotingLoginWindowHandlerE4" command="_R00rwK2dEeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_D6BxkK2tEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenPasswordWizzardHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenPasswordWizzardHandlerE4" command="_SXZF8K2gEeeykrJkROy5EA"/>
+ <elements xsi:type="commands:Handler" xmi:id="_H98S8K2tEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.SwitchUserHandlerE4" command="_S868QK2dEeeykrJkROy5EA"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
<elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="Term Editor">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_Rk37AIfcEeecZ4F2Y9Z0Og" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_HIptYIfUEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.dynamicmenucontribution.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermMenuE4"/>
<children xsi:type="menu:MenuSeparator" xmi:id="_yRINcIfqEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menuseparator.3"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_rwfDkIftEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor" label="Feature Tree Editor" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_rwfDkIftEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor" label="Feature Tree Editor" tooltip="Feature Tree Editor" command="_bnVKsCZxEeeQLpuomSmVoQ">
<parameters xmi:id="_3acJQIftEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.featureTreeEditor" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor"/>
</children>
</elements>
</fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pVVyEJFJEeeDJpjGQES7gw" featurename="addons" parentElementId="xpath:/">
+ <elements xsi:type="application:Addon" xmi:id="_q4JBkJFJEeeDJpjGQES7gw" elementId="eu.etaxonomy.taxeditor.event.EventUtility" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.event.EventUtility"/>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_ITE10KkVEeejedk4mZQIGw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.file" positionInList="before:eu.etaxonomy.taxeditor.application.filemenu.io">
+ <elements xsi:type="menu:Menu" xmi:id="_z6EugKqXEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.menu.export" label="Export">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_3eyLYKqXEeeXcJGhyhlrKA" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_b9E38KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportJaxb" label="%wizard.name.6" command="_L0xNEKqYEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_lXe84KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportSdd" label="%wizard.name.8" command="_ybovsKqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_nf4z0KqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca" label="%wizard.name.9" command="_y69I8KqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_V3eBEKqYEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsv" label="%wizard.name.18" command="_y_uUMKqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_qR5ocKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvName" label="%wizard.name.19" command="_zDy74KqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_tBUcEKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvPrint" label="%wizard.name.20" command="_zIKegKqZEeeXcJGhyhlrKA"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_uruvcKqZEeeXcJGhyhlrKA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight" label="%wizard.name.22" command="_zLKvMKqZEeeXcJGhyhlrKA"/>
+ </elements>
+ <elements xsi:type="menu:Menu" xmi:id="_QC5O8KkaEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.store.menu.import" label="Import">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_UL4dkKkaEeejedk4mZQIGw" coreExpressionId="isCdmStoreConnected"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_RUOtQKkVEeejedk4mZQIGw" elementId="eu.etaxonomy.taxeditor.workbench.handledmenuitem.importspecimens" label="%wizard.name.14" command="_TwGSwKkVEeejedk4mZQIGw"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_NO718KmQEeeDJPU_cUTI2g" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importAbcd" label="%wizard.name.3" command="_QbHeEKmQEeeDJPU_cUTI2g"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_-h0G8KmfEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExceldistribution" label="%wizard.name.23" command="_tpPnUKmfEeeTAPHmaMLwQQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wnmZYKmgEeeTAPHmaMLwQQ" coreExpressionId="isShowExperimentalFeatures"/>
+ </children>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_BLzlAKnBEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelTaxa" label="%wizard.name.2" command="_qAEkYKmjEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_0z1o8KmjEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelSpecimen" label="%wizard.name.5" command="_2JV9IKnAEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_pQNeoKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importRisReference" label="%wizard.name.24" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_hXY2UKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importSdd" label="%wizard.name.4" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_X2Xb8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importTcs" label="%wizard.name" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
+ </elements>
+ <elements xsi:type="menu:MenuSeparator" xmi:id="_URhG8K25EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.menuseparator.4"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_oL9dIK2uEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabelconnect" label="%command.label.CONNECT" command="_R00rwK2dEeeykrJkROy5EA"/>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_qRrzgK2uEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel5" label="%command.label.5" command="_S868QK2dEeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_zRHMoK2uEeeykrJkROy5EA" coreExpressionId="isUserLoggedIn"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_rZtLgK2uEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabelre_connect" label="%command.label.RE_CONNECT" command="_KQP_sK2gEeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0b9PIK2uEeeykrJkROy5EA" coreExpressionId="isUserLoggedIn"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_tKrZ4K2uEeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabelchange_password" label="%command.label.CHANGE_PASSWORD" command="_SXZF8K2gEeeykrJkROy5EA">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_1cb0sK2uEeeykrJkROy5EA" coreExpressionId="isUserLoggedIn"/>
+ </elements>
+ </fragments>
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_mNW70LMnEeeMU61m8yqdaA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.referencing">
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_mNW727MnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.sessions" label="%view.name.SESSIONS" tooltip="%view.name.SESSIONS" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_mNW73LMnEeeMU61m8yqdaA" coreExpressionId="isCdmStoreConnected"/>
+ <parameters xmi:id="_mNW73bMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"/>
+ </elements>
+ <elements xsi:type="menu:HandledMenuItem" xmi:id="_mNW72bMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.datasource" label="%command.label.2" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/system-file-manager.png" tooltip="%command.label.2" command="_bnVKsCZxEeeQLpuomSmVoQ">
+ <parameters xmi:id="_mNW72rMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.sessionView" name="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" value="eu.etaxonomy.taxeditor.view.datasource"/>
+ </elements>
+ </fragments>
</fragment:ModelFragments>
<?eclipse version="3.2"?>
<plugin>
<extension-point id="eu.etaxonomy.taxeditor.store.cdmViewer" name="Cdm Viewer" schema="schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd"/>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- class="eu.etaxonomy.taxeditor.preference.TaxonomicEditorGeneralPreferences"
- id="eu.etaxonomy.taxeditor.preferences.general"
- name="%page.name">
- </page>
- <!-- <page
- category="eu.etaxonomy.taxeditor.preferences.admin"
- class="eu.etaxonomy.taxeditor.preference.AdminGeneralPreferences"
- id="eu.etaxonomy.taxeditor.preferences.adminGeneral"
- name="%page.name.38">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.admin"
- class="eu.etaxonomy.taxeditor.databasePreferences.AdminNomenclaturalCode"
- id="eu.etaxonomy.taxeditor.preferences.adminNomenclaturalCode"
- name="%page.name.39">
- </page>-->
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.NameDetailsViewConfiguration"
- id="eu.etaxonomy.taxeditor.preferences.nameDetails"
- name="%page.name.36">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.DescriptionPreferences"
- id="eu.etaxonomy.taxeditor.preferences.description"
- name="%page.name.0">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.description"
- class="eu.etaxonomy.taxeditor.preference.menu.FeatureMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.feature"
- name="%page.name.1">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.description"
- class="eu.etaxonomy.taxeditor.preference.menu.PresenceAbsenceMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.distributionStatus"
- name="%page.name.2">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.TaxonomicPreferences"
- id="eu.etaxonomy.taxeditor.preferences.taxonomic"
- name="%page.name.3">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.NomenclaturalCodePreferences"
- id="eu.etaxonomy.taxeditor.preferences.nomenclatural"
- name="%page.name.4">
- </page>
-
- <!--page
- class="eu.etaxonomy.taxeditor.store.preference.CdmPreferences"
- id="eu.etaxonomy.taxeditor.preferences.cdm"
- name="CDM Datastore">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.cdm"
- class="eu.etaxonomy.taxeditor.store.preference.InitializeDbPreferences"
- id="eu.etaxonomy.taxeditor.preferences.initdb"
- name="Initialize Datastore">
- </page-->
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.RankMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.ranks"
- name="%page.name.5">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.NomenclaturalStatusTypeMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.nomenclaturalStatusType"
- name="%page.name.6">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.NameRelationshipTypeMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.nameRelationshipType"
- name="%page.name.7">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.TaxonRelationshipTypeMenuPreferences"
- id="taxeditor-store.page1"
- name="%page.name.8">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.SpecimenTypeDesignationStatusMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.specimenTypeDesignationStatus"
- name="%page.name.9">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.taxonomic"
- class="eu.etaxonomy.taxeditor.preference.menu.NameTypeDesignationStatusMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.nameTypeDesignationStatus"
- name="%page.name.13">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.language"
- class="eu.etaxonomy.taxeditor.preference.menu.LanguageMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.languages"
- name="%page.name.10">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.menu.MarkerTypeMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.markerTypes"
- name="%page.name.11">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.menu.ExtensionTypeMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.extensionTypes"
- name="%page.name.12">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.description"
- class="eu.etaxonomy.taxeditor.preference.menu.NamedAreaTypeMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.namedAreaType"
- name="%page.name.14">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.MatchingPreferences"
- id="eu.etaxonomy.taxeditor.preferences.matching"
- name="%page.name.15">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.matching"
- class="eu.etaxonomy.taxeditor.preference.matching.NonViralNameMatchingPreference"
- id="eu.etaxonomy.taxeditor.preferences.matching.nonViralName"
- name="%page.name.16">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.matching"
- class="eu.etaxonomy.taxeditor.preference.matching.ReferenceMatchingPreference"
- id="eu.etaxonomy.taxeditor.preferences.matching"
- name="%page.name.17">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.matching"
- class="eu.etaxonomy.taxeditor.preference.matching.TeamOrPersonMatchingPreference"
- id="eu.etaxonomy.taxeditor.preferences.matching"
- name="%page.name.18">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.description"
- class="eu.etaxonomy.taxeditor.preference.menu.StageMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.stage"
- name="%page.name.19">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.description"
- class="eu.etaxonomy.taxeditor.preference.menu.PreservationMethodMenuPreferences"
- id="eu.etaxonomy.taxeditor.preferences.preservationMethod"
- name="%page.name.20">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.feature"
- class="eu.etaxonomy.taxeditor.preference.DefaultFeatureTreePreferenecs"
- id="eu.etaxonomy.taxeditor.preferences.defaultFeatureTreePreferenecs"
- name="%page.name.22">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
- class="eu.etaxonomy.taxeditor.preference.LanguageRepresentationPreferencePage"
- id="eu.etaxonomy.taxeditor.preferences.language"
- name="%page.name.23">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.MobotOpenUrlPreferences"
- id="eu.etaxonomy.taxeditor.preferences.mobotOpenUrl"
- name="%page.name.24">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.TypeDesignationPreferences"
- id="eu.etaxonomy.taxeditor.preferences.typeDesignation"
- name="%page.name.25">
- </page>
- <!-- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
- id="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
- name="%page.name.26">
- </page>-->
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.MediaPreferences"
- id="eu.etaxonomy.taxeditor.preference.MediaPreferences"
- name="%page.name.27">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreference"
- id="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreferencePage"
- name="%page.name.28">
- </page>
- <!-- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.TemplatePreferencePage"
- id="eu.etaxonomy.taxeditor.preference.TemplatePreferencePage"
- name="%page.name.29">
- </page>-->
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.LanguageEditorPreferencePage"
- id="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
- name="%page.name.30">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.OrderPreferences"
- id="eu.etaxonomy.taxeditor.preference.TaxonNavigator"
- name="%page.name.32">
- </page>
- <page
- category="eu.etaxonomy.taxeditor.preferences.general"
- class="eu.etaxonomy.taxeditor.preference.DebugPreferences"
- id="eu.etaxonomy.taxeditor.preferences.debug"
- name="%page.name.34">
- </page>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView"
- id="eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView"
- name="%view.name.7">
- </view>
- <view
- allowMultiple="true"
- class="eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView"
- id="eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView"
- name="%view.name.8">
- </view>
- </extension>
<extension
point="org.eclipse.ui.menus">
- <menuContribution
- locationURI="menu:eu.etaxonomy.taxeditor.workbench.menu.file?after=eu.etaxonomy.taxeditor.application.filemenu.io">
- <command
- commandId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"
- label="%command.label.CONNECT"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
- label="%command.label.5"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isUserLoggedIn">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.operations.reconnect"
- label="%command.label.RE_CONNECT"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isUserLoggedIn">
- </reference>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
- label="%command.label.CHANGE_PASSWORD"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <reference
- definitionId="isUserLoggedIn">
- </reference>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.application.filemenu.login"
- visible="true">
- </separator>
- </menuContribution>
- <menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.view.datasource">
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.change"
- label="%command.label.6"
- style="push">
- <visibleWhen>
- <not>
- <reference
- definitionId="hasDataModel">
- </reference>
- </not>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.create"
- label="%command.label.7"
- style="push">
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.edit"
- label="%command.label.8"
- style="push">
- <visibleWhen>
- <with
- variable="selection">
- <not>
- <test
- property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
- </test>
- </not>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.clone"
- label="%command.label.clone"
- style="push">
- <visibleWhen>
- <with
- variable="selection">
- <not>
- <test
- property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
- </test>
- </not>
- </with>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.store.datasource.separator"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.view.datasource.delete"
- label="%command.label.9"
- style="push">
- <visibleWhen>
- <with
- variable="selection">
- <not>
- <test
- property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
- </test>
- </not>
- </with>
- </visibleWhen>
- </command>
- <separator
- name="eu.etaxonomy.taxeditor.store.datasource.separator2"
- visible="true">
- </separator>
- <command
- commandId="eu.etaxonomy.taxeditor.store.datasource.update"
- label="%command.label.11"
- style="push">
- <visibleWhen
- checkEnabled="true">
- <not>
- <reference
- definitionId="isCompatible">
- </reference>
- </not>
- </visibleWhen>
-
- </command>
- </menuContribution>
<menuContribution
locationURI="toolbar:org.eclipse.ui.trim.status">
<toolbar
</toolbar>
</menuContribution>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="eu.etaxonomy.taxeditor.view.datasource.handler.DeleteDataSourceHandler"
- commandId="eu.etaxonomy.taxeditor.view.datasource.delete">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.view.datasource">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.editor.definedterm.handler.DeleteTermBaseHandler"
- commandId="eu.etaxonomy.taxeditor.editor.definedTerms.delete">
- <activeWhen>
- <with
- variable="activePartId">
- <equals
- value="eu.etaxonomy.taxeditor.editor.definedTerm">
- </equals>
- </with>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.ShowRemotingLoginWindowHandler"
- commandId="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow">
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.OpenPasswordWizzardHandler"
- commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard">
- <enabledWhen>
- <reference
- definitionId="isUserLoggedIn">
- </reference></enabledWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.OpenDistributionEditorWizardHandler"
- commandId="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler">
- <activeWhen>
- <reference
- definitionId="hasROLE_PROJECT_MANAGER">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.OpenImportPreferenceHandler"
- commandId="eu.etaxonomy.taxeditor.store.open.OpenImportPreferenceHandler">
- <activeWhen>
- <reference
- definitionId="hasROLE_PROJECT_MANAGER">
- </reference>
- </activeWhen>
- </handler>
- <handler
- class="eu.etaxonomy.taxeditor.handler.SwitchUserHandler"
- commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow">
- <activeWhen>
- <reference
- definitionId="isRemoting">
- </reference>
- </activeWhen>
- </handler>
- </extension>
- <extension
- name="%extension.name.0"
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
- id="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
- name="%command.name.4">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.store.operations.showRemotingLoginWindow"
- name="%command.name.CONNECT">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.ReconnectHandler"
- id="eu.etaxonomy.taxeditor.store.operations.reconnect"
- name="%command.name.RE_CONNECT">
- </command>
- <command
- id="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
- name="%command.name.10">
- </command>
- <command
- 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"
- name="%command.name.12">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.OpenInspectSessionsHandler"
- id="eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog"
- name="%command.name.INSPECT_ACTIVE_SESSIONS">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.OpenHandler"
- id="eu.etaxonomy.taxeditor.store.open"
- name="%command.name.15">
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenClassificationWizardHandler"
- id="eu.etaxonomy.taxeditor.command.openClassificationWizard"
- name="%command.name.OPEN_CLASSIFICATION_WIZARD">
- <commandParameter
- id="eu.etaxonomy.taxeditor.command.openClassificationWizard.uuid"
- name="Classification Uuid"
- optional="true"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
- <command
- defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenTaxonNodeWizardHandler"
- id="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard"
- name="%command.name.OPEN_TAXONNODE_WIZARD">
- <commandParameter
- id="eu.etaxonomy.taxeditor.command.openTaxonNodeWizard.uuid"
- name="TaxonNode Uuid"
- optional="true"
- typeId="eu.etaxonomy.taxeditor.uuidParameterType">
- </commandParameter>
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <commandParameterType
- converter="eu.etaxonomy.taxeditor.handler.UuidsParameterTypeConverter"
- id="eu.etaxonomy.taxeditor.uuidParameterType"
- type="java.util.UUID">
- </commandParameterType>
- <commandParameterType
- converter="eu.etaxonomy.taxeditor.handler.UuidsParameterTypeConverter"
- id="eu.etaxonomy.taxeditor.uuidsParameterType"
- type="java.util.List">
- </commandParameterType>
- </extension>
- <extension
- point="org.eclipse.ui.importWizards">
- <category
- id="eu.etaxonomy.taxeditor.import.category.cdm"
- name="%category.name">
- </category>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.TcsImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.tcs"
- name="%wizard.name">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.view.dataimport.SpecimenSearchWizard"
- id="eu.etaxonomy.taxeditor.view.dataimport.SpecimenSearchWizard"
- name="%wizard.name.21">
- <description>
- %wizard.description
- </description>
- </wizard>
-
- <!-- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.JaxbImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.jaxb"
- name="JAXB">
- </wizard> -->
- <!-- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.BerlinModelImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.berlinModel"
- name="%wizard.name.0">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.EndnoteImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.endnote"
- name="%wizard.name.1">
- </wizard>-->
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.ExcelNormalExplicitTaxaImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.excel.taxa"
- name="%wizard.name.2">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.AbcdImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.abcd"
- name="%wizard.name.3">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.ExcelDistributionUpdateWizard"
- id="eu.etaxonomy.taxeditor.io.import.excelDistribution"
- name="%wizard.name.23">
- <enabledWhen>
- <reference
- definitionId="isShowExperimentalFeatures">
- </reference></enabledWhen>
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.RISImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.risImport"
- name="%wizard.name.24">
-
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.SddImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.sdd"
- name="%wizard.name.4">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.import.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.SpecimenCdmExcelImportWizard"
- id="eu.etaxonomy.taxeditor.io.import.specimenCdmExcel"
- name="%wizard.name.5">
- </wizard>
- </extension>
- <extension
- point="org.eclipse.ui.exportWizards">
- <category
- id="eu.etaxonomy.taxeditor.export.category.cdm"
- name="%category.name.0">
- </category>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.JaxbExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.jaxb"
- name="%wizard.name.6">
- </wizard>
- <!--<wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.BerlinModelExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.berlinModel"
- name="%wizard.name.7">
- </wizard>-->
- <category
- id="eu.etaxonomy.taxeditor.export.category.excel"
- name="%category.name.1">
- </category>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.SddExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.sdd"
- name="%wizard.name.8">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.DarwinCoreArchiveExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.dwca"
- name="%wizard.name.9">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.CsvExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.csv"
- name="%wizard.name.18">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.CsvNameExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.csv_name"
- name="%wizard.name.19">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.CsvPrintExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.csv_print"
- name="%wizard.name.20">
- </wizard>
- <wizard
- category="eu.etaxonomy.taxeditor.export.category.cdm"
- class="eu.etaxonomy.taxeditor.io.wizard.CdmLightExportWizard"
- id="eu.etaxonomy.taxeditor.io.export.output_model"
- name="%wizard.name.22">
- </wizard>
- </extension>
<extension
point="org.eclipse.ui.newWizards">
<wizard
name="%wizard.name.17">
</wizard>
</extension>
-<extension
- point="org.eclipse.ui.themes">
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- label="%themeElementCategory.label">
- <description>
- %themeElementCategory.description
- </description>
- </themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackground"
- label="%colorDefinition.label"
- value="150,150,150">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDefault"
- label="%colorDefinition.label.0"
- value="0,0,0">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeBackground"
- label="%colorDefinition.label.1"
- value="255,255,255">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.colorCompositeIrrelevant"
- label="%colorDefinition.label.2"
- value="241,139,18">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textDisabled"
- label="%colorDefinition.label.3"
- value="150,150,150">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.textBackgroundDisabled"
- label="%colorDefinition.label.4"
- value="230,230,230">
- </colorDefinition>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- label="%themeElementCategory.label.0"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.0
- </description>
- </themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundOdd"
- label="%colorDefinition.label.5"
- value="230,230,230">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.listBackgroundEven"
- label="%colorDefinition.label.6"
- value="255,255,255">
- </colorDefinition>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- label="%themeElementCategory.label.1"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.1
- </description>
- </themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerBackground"
- label="%colorDefinition.label.7"
- value="220, 220, 220">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelectedFocus"
- label="%colorDefinition.label.8"
- value="232,242,254">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerSelected"
- label="%colorDefinition.label.9"
- value="210, 210, 210">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.nameEditor.colorContainerDragEnter"
- label="%colorDefinition.label.10"
- value="185,255,133">
- </colorDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.accepted"
- label="%fontDefinition.label"
- value="Georgia-regular-12">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.synonym"
- label="%fontDefinition.label.0"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.misapplication"
- label="%fontDefinition.label.1"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.concept"
- label="%fontDefinition.label.2"
- value="Georgia-regular-10">
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.nameEditor.default"
- label="%fontDefinition.label.3"
- value="Georgia-regular-10">
- </fontDefinition>
- <themeElementCategory
- id="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- label="%themeElementCategory.label.2"
- parentId="eu.etaxonomy.taxeditor.preferences.themeElementCategory">
- <description>
- %themeElementCategory.description.2
- </description>
- </themeElementCategory>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.foreground"
- label="%colorDefinition.label.11"
- value="192, 192, 192">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.searchView.focus"
- label="%colorDefinition.label.12"
- value="0, 0, 0">
- </colorDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.accepted"
- isEditable="true"
- label="%fontDefinition.label.4"
- value="Arial-regular-10">
- <description>
- %fontDefinition.description
- </description>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.synonym"
- isEditable="true"
- label="%fontDefinition.label.5"
- value="Arial-italic-10">
- <description>
- %fontDefinition.description.0
- </description>
- </fontDefinition>
- <fontDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.searchView"
- id="eu.etaxonomy.taxeditor.preferences.fontDefinition.searchView.other"
- isEditable="true"
- label="%fontDefinition.label.6"
- value="Lucida Grande-regular-11">
- <description>
- %fontDefinition.description.1
- </description>
- </fontDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.detailsView"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.parseError"
- label="%colorDefinition.label.13"
- value="255,0,0">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory.nameEditor"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.disabledEditor"
- label="%colorDefinition.label.14"
- value="105,114,124">
- </colorDefinition>
- <colorDefinition
- categoryId="eu.etaxonomy.taxeditor.preferences.themeElementCategory"
- id="eu.etaxonomy.taxeditor.preferences.colorDefinition.editorError"
- label="%colorDefinition.label.15"
- value="255,0,0">
- </colorDefinition>
- </extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
</propertyTester>
<propertyTester
class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
- id="eu.etaxonomy.taxeditor.preferences.propertyTester"
- namespace="eu.etaxonomy.taxeditor.preferences.propertyTester"
- properties="isShowExperimentalFeatures"
- type="org.eclipse.jface.viewers.IStructuredSelection">
+ id="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
+ namespace="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
+ properties="isShowExperimentalFeatures, isChecklistEditorEnabled"
+ type="java.lang.Object">
</propertyTester>
<propertyTester
class="eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester"
</definition>
<definition
id="isShowExperimentalFeatures">
- <with
- variable="selection">
- <test
- property="eu.etaxonomy.taxeditor.preferences.propertyTester.isShowExperimentalFeatures">
- </test>
- </with>
+ <test
+ property="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester.isShowExperimentalFeatures">
+ </test>
</definition>
<definition
id="isModifiable">
</reference>
</and>
</definition>
+ <definition
+ id="isChecklistEditorEnabled">
+ <test
+ property="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester.isChecklistEditorEnabled">
+ </test>
+ </definition>
</extension>
<extension
point="org.eclipse.ui.activities">
point="eu.etaxonomy.taxeditor.store.cdmViewer">
<viewCommandMapping
commandId="eu.etaxonomy.taxeditor.command.openClassificationWizard"
- selection="eu.etaxonomy.cdm.model.taxon.Classification"
+ selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
viewerName="%viewCommandMapping.viewerName.CLASSIFICATION_WIZARD">
</viewCommandMapping>
<viewCommandMapping
uri="fragment.e4xmi">
</fragment>
</extension>
+<extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.DebugPreferences"
+ id="eu.etaxonomy.taxeditor.preference.DebugPreferences"
+ name="%page.name.34">
+ </page>
+ <page
+ class="eu.etaxonomy.taxeditor.preference.TaxonomicEditorGeneralPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.general"
+ name="%page.name">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.NameDetailsViewConfiguration"
+ id="eu.etaxonomy.taxeditor.preferences.nameDetails"
+ name="%page.name.36">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.DescriptionPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.description"
+ name="%page.name.0">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.description"
+ class="eu.etaxonomy.taxeditor.preference.menu.FeatureMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.feature"
+ name="%page.name.1">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.description"
+ class="eu.etaxonomy.taxeditor.preference.menu.PresenceAbsenceMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.distributionStatus"
+ name="%page.name.2">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.TaxonomicPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ name="%page.name.3">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.NomenclaturalCodePreferences"
+ id="eu.etaxonomy.taxeditor.preferences.nomenclatural"
+ name="%page.name.4">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.RankMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.ranks"
+ name="%page.name.5">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.NomenclaturalStatusTypeMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.nomenclaturalStatusType"
+ name="%page.name.6">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.NameRelationshipTypeMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.nameRelationshipType"
+ name="%page.name.7">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.TaxonRelationshipTypeMenuPreferences"
+ id="taxeditor-store.page1"
+ name="%page.name.8">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.SpecimenTypeDesignationStatusMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.specimenTypeDesignationStatus"
+ name="%page.name.9">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.taxonomic"
+ class="eu.etaxonomy.taxeditor.preference.menu.NameTypeDesignationStatusMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.nameTypeDesignationStatus"
+ name="%page.name.13">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.language"
+ class="eu.etaxonomy.taxeditor.preference.menu.LanguageMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.languages"
+ name="%page.name.10">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.menu.MarkerTypeMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.markerTypes"
+ name="%page.name.11">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.menu.ExtensionTypeMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.extensionTypes"
+ name="%page.name.12">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.description"
+ class="eu.etaxonomy.taxeditor.preference.menu.NamedAreaTypeMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.namedAreaType"
+ name="%page.name.14">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.MatchingPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.matching"
+ name="%page.name.15">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.matching"
+ class="eu.etaxonomy.taxeditor.preference.matching.NonViralNameMatchingPreference"
+ id="eu.etaxonomy.taxeditor.preferences.matching.nonViralName"
+ name="%page.name.16">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.matching"
+ class="eu.etaxonomy.taxeditor.preference.matching.ReferenceMatchingPreference"
+ id="eu.etaxonomy.taxeditor.preferences.matching"
+ name="%page.name.17">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.matching"
+ class="eu.etaxonomy.taxeditor.preference.matching.TeamOrPersonMatchingPreference"
+ id="eu.etaxonomy.taxeditor.preferences.matching"
+ name="%page.name.18">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.description"
+ class="eu.etaxonomy.taxeditor.preference.menu.StageMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.stage"
+ name="%page.name.19">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.description"
+ class="eu.etaxonomy.taxeditor.preference.menu.PreservationMethodMenuPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.preservationMethod"
+ name="%page.name.20">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.feature"
+ class="eu.etaxonomy.taxeditor.preference.DefaultFeatureTreePreferenecs"
+ id="eu.etaxonomy.taxeditor.preferences.defaultFeatureTreePreferenecs"
+ name="%page.name.22">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
+ class="eu.etaxonomy.taxeditor.preference.LanguageRepresentationPreferencePage"
+ id="eu.etaxonomy.taxeditor.preferences.language"
+ name="%page.name.23">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.MobotOpenUrlPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.mobotOpenUrl"
+ name="%page.name.24">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.TypeDesignationPreferences"
+ id="eu.etaxonomy.taxeditor.preferences.typeDesignation"
+ name="%page.name.25">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
+ id="eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences"
+ name="%page.name.26">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.MediaPreferences"
+ id="eu.etaxonomy.taxeditor.preference.MediaPreferences"
+ name="%page.name.27">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreference"
+ id="eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreferencePage"
+ name="%page.name.28">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.LanguageEditorPreferencePage"
+ id="eu.etaxonomy.taxeditor.preference.defaultlanguagepditorpreferencePage"
+ name="%page.name.30">
+ </page>
+ <page
+ category="eu.etaxonomy.taxeditor.preferences.general"
+ class="eu.etaxonomy.taxeditor.preference.OrderPreferences"
+ id="eu.etaxonomy.taxeditor.preference.TaxonNavigator"
+ name="%page.name.32">
+ </page>
+</extension>
</plugin>
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
.getDescription(code));
}
- nomenclaturalCodeCombo.select(0);
+ nomenclaturalCodeCombo.select(0);
getLabelAndValues();
//get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
//radio buttons for set publish as default, set not publish as default and inherit from parent
}
-
+
public void createBiocaseProviderTab(Composite parent){
composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
composite = parent;
composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
+ gridLayout.numColumns = 1;
+
composite.setLayout(gridLayout);
nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
+
+
}
public void createSpecimenOrObservationTab(Composite parent){
- composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
+ composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
- boolean isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
+ CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
+ if (isShowCollectingAreaInGeneralSection == null){
+ isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
+ }
showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
- showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
+
+ showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
});
final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
- boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
+// boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
+ CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
+ if (isDeterminationOnlyForFieldUnits == null){
+ isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
+ }
determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
- determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
+
+ determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
});
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
- boolean isShowTaxonAssociation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
+ CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
+ if (isShowTaxonAssociation == null){
+ isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
+ }
showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
- showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
+
+ showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
}
});
-
+
final Button showLifeFormButton = new Button(composite, SWT.CHECK);
- boolean isShowLifeForm = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
+ CdmPreference isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
+ if (isShowLifeForm == null){
+ isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
+ }
+
showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
- showLifeFormButton.setSelection(isShowLifeForm);
+ showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
showLifeFormButton.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
}
});
+// Composite useLocalComp = new Composite(composite, SWT.NONE);
+
+
+ final Button useLocalPreference = new Button(composite, SWT.CHECK);
+ boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
+ useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
+ GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
+ gridData.verticalIndent = 10;
+ useLocalPreference.setLayoutData(gridData);
+
+ useLocalPreference.setSelection(isUseLocalPreference);
+ useLocalPreference.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isUseLocalPreference = useLocalPreference.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, isUseLocalPreference);
+ }
+ });
+
}
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
/**
public boolean performFinish() {
// getPreferencePage().performOk();
+
String value =getPreferencePage().doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
boolean allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
}
IPreferenceService service = controller.getPreferenceService();
service.set(pref);
+ NameDetailsConfigurator config = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig();
+ value = config.toString();
+ allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
- value = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig().toString();
- allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS);
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
pref.setAllowOverride(allowOverride);
service.set(pref);
+ if (!allowOverride || (allowOverride && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS))){
+ PreferencesUtil.saveConfigToPrefernceStore(config);
+ }
boolean isDeterminationOnlyForFieldUnit= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS );
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DeterminationOnlyForFieldUnits, String.valueOf(isDeterminationOnlyForFieldUnit));
- pref.setAllowOverride(false);
+ allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF);
+ pref.setAllowOverride(allowOverride);
service.set(pref);
boolean isShowCollectingAreasInGeneralsecion= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION );
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowCollectingAreasInGeneralSection, String.valueOf(isShowCollectingAreasInGeneralsecion));
- pref.setAllowOverride(false);
+ pref.setAllowOverride(allowOverride);
service.set(pref);
boolean isShowTaxonAssociations= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowTaxonAssociations, String.valueOf(isShowTaxonAssociations));
- pref.setAllowOverride(false);
+ pref.setAllowOverride(allowOverride);
+ service.set(pref);
+
+ boolean isShowLifeForm= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
+ pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowLifeForm, String.valueOf(isShowLifeForm));
+ pref.setAllowOverride(allowOverride);
service.set(pref);
String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
import javax.swing.event.DocumentEvent;
+import org.apache.commons.lang.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
private Text providerURI;
public ListComponent(Composite parent, int style) {
- list = new List(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+ list = new List(parent, SWT.BORDER | SWT.V_SCROLL);
java.util.List<String> providerList = new ArrayList<String>();
String allProviderString = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST);
String[] providerArray = allProviderString.split(";");
for (String providerString : providerArray){
- list.add(providerString);
+ if (!StringUtils.isBlank(providerString)){
+ list.add(providerString);
+ }
}
+ list.add("");
- list.setSelection(0);
+// list.setSelection(0);
GridData dataList = new GridData();
dataList.horizontalAlignment = GridData.FILL;
dataList.horizontalSpan = 2;
dataList.verticalSpan= 4;
+// dataList.grabExcessVerticalSpace = true;
list.setLayoutData(dataList);
//Select the new item
list.setSelection(index);
- list.redraw();
+ list.update();
+ providerURI.setText("");
}
}
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
// Composite composite = new Composite(parent, SWT.NULL);
this.setLayout(new GridLayout());
- isSimpleDetailsViewActivated= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ this.setData(data);
+// CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
+// NameDetailsConfigurator config = PreferencesUtil.setPreferredNameDetailsConfiguration(local)
+
+ final Button allowLocalPreference = new Button(this, SWT.CHECK);
+ boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
+ allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
+ allowLocalPreference.setSelection(isUseLocalPreference);
+ allowLocalPreference.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isUseLocalPreference = allowLocalPreference.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
+ }
+ });
+
+
+ isSimpleDetailsViewActivated= config.isSimpleDetailsViewActivated();
final Button activateCheckButton = new Button(this, SWT.CHECK);
activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
- activateCheckButton.setText("Show only a simple name details view");
+ activateCheckButton.setText(Messages.NameDetailsViewConfiguration_activateSimpleDetailsView);
activateCheckButton.setSelection(isSimpleDetailsViewActivated);
activateCheckButton.addSelectionListener(new SelectionAdapter(){
@Override
child.setVisible(isSimpleDetailsViewActivated);
final Button showTaxon = new Button(child, SWT.CHECK);
- isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
- showTaxon.setText("Show taxon of the name");
+ isShowTaxon = config.isTaxonSectionActivated();
+ showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
showTaxon.setSelection(isShowTaxon);
showTaxon.addSelectionListener(new SelectionAdapter(){
@Override
});
final Button showLsid = new Button(child, SWT.CHECK);
- isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
- showLsid.setText("Show Lsid of the name");
+ isShowLSID = config.isLSIDActivated();
+ showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
showLsid.setSelection(isShowLSID);
showLsid.addSelectionListener(new SelectionAdapter(){
@Override
});
final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
- isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
- showNomenclaturalCode.setText("Show the nomenclatural code");
+ isShowNomenclaturalCode = config.isNomenclaturalCodeActived();
+ showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
@Override
});
final Button showNameCache = new Button(child, SWT.CHECK);
- isShowNameCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
- showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
+ isShowNameCache= config.isNameCacheActivated();
+
+ showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
showNameCache.setSelection(isShowNomenclaturalCode);
showNameCache.addSelectionListener(new SelectionAdapter(){
@Override
}
});
final Button showAppendedPhrase = new Button(child, SWT.CHECK);
- isShowAppendedPhrase= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
- showAppendedPhrase.setText("Show appended phrase");
+ isShowAppendedPhrase= config.isAppendedPhraseActivated();
+ showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
showAppendedPhrase.setSelection(isShowAppendedPhrase);
showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
@Override
});
final Button showRank = new Button(child, SWT.CHECK);
- isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
- showRank.setText("Show rank of the name");
+ isShowRank = config.isRankActivated();
+ showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
showRank.setSelection(isShowRank);
showRank.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowRank = showRank.getSelection();
-
}
});
final Button showEpithets = new Button(child, SWT.CHECK);
- isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
- showEpithets.setText("Show atomised epithets");
+ isShowEpithets = config.isAtomisedEpithetsActivated();
+ showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
showEpithets.setSelection(isShowEpithets);
showEpithets.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowEpithets = showEpithets.getSelection();
-
}
});
final Button showAuthorshipCache = new Button(child, SWT.CHECK);
- isShowAuthorshipCache= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
- showAuthorshipCache.setText("Show authorship cache");
+ isShowAuthorshipCache= config.isAuthorCacheActivated();
+ showAuthorshipCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
showAuthorshipCache.setSelection(isShowAuthorshipCache);
showAuthorshipCache.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowAuthorshipCache = showAuthorshipCache.getSelection();
-
}
});
final Button showAuthorship = new Button(child, SWT.CHECK);
- isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
- showAuthorship.setText("Show authorship section");
+ isShowAuthorship =config.isAuthorshipSectionActivated();
+ showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
showAuthorship.setSelection(isShowAuthorship);
showAuthorship.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowAuthorship = showAuthorship.getSelection();
-
}
});
final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
- isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
- showNomenclaturalRef.setText("Show nomenclatural reference section");
+ isShowNomenclaturalRef = config.isNomenclaturalReferenceSectionActivated();
+ showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
-
}
});
final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
- isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
- showNomenclaturalStatus.setText("Show nomenclatural status section");
+ isShowNomenclaturalStatus = config.isNomenclaturalStatusSectionActivated();
+ showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
-
}
});
final Button showProtologue = new Button(child, SWT.CHECK);
- isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
- showProtologue.setText("Show protologue section");
+ isShowProtologue = config.isProtologueActivated();
+ showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
showProtologue.setSelection(isShowProtologue);
showProtologue.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowProtologue = showProtologue.getSelection();
-
}
});
final Button showTypeDesignation = new Button(child, SWT.CHECK);
- isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
- showTypeDesignation.setText("Show name type designation section");
+ isShowTypeDesignation = config.isTypeDesignationSectionActivated();
+ showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
showTypeDesignation.setSelection(isShowTypeDesignation);
showTypeDesignation.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowTypeDesignation = showTypeDesignation.getSelection();
-
}
});
final Button showNameRelationship = new Button(child, SWT.CHECK);
- isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
- showNameRelationship.setText("Show name relationship section");
+ isShowNameRelationship = config.isNameRelationsSectionActivated();
+ showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
showNameRelationship.setSelection(isShowNameRelationship);
showNameRelationship.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowNameRelationship = showNameRelationship.getSelection();
-
}
});
final Button showHybrid = new Button(child, SWT.CHECK);
- isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
- showHybrid.setText("Show hybrid section");
+ isShowHybrid = config.isHybridActivated();
+ showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
showHybrid.setSelection(isShowHybrid);
showHybrid.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowHybrid = showHybrid.getSelection();
-
}
});
final Button showNameApprobiation = new Button(child, SWT.CHECK);
- isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
- showNameApprobiation.setText("Show name approbiation (for bacterial names)");
+ isShowNameApprobiation = config.isNameApprobiationActivated();
+ showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
showNameApprobiation.setSelection(isShowNameApprobiation);
showNameApprobiation.addSelectionListener(new SelectionAdapter(){
@Override
public void widgetSelected(SelectionEvent e) {
isShowNameApprobiation = showNameApprobiation.getSelection();
-
}
});
-
+
this.redraw();
if(isSimpleDetailsViewActivated){
*
*/
protected NameDetailsConfigurator createNameDetailsViewConfig() {
- saveConfigToPrefernceStore();
-
- config.setSimpleDetailsViewActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
- config.setAppendedPhraseActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
- config.setAtomisedEpithetsActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
- config.setAuthorshipSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
- config.setLSIDActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
- config.setNameApprobiationActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION));
- config.setNameCacheActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
- config.setNameRelationsSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
- config.setNomenclaturalCodeActived(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
- config.setNomenclaturalStatusSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
- config.setNomenclaturalReferenceSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
- config.setProtologueActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
- config.setRankActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
- config.setTaxonSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
- config.setTypeDesignationSectionActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
- config.setHybridActivated(doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID));
+
+
+ config.setSimpleDetailsViewActivated(isSimpleDetailsViewActivated);
+ config.setAppendedPhraseActivated(isShowAppendedPhrase);
+ config.setAtomisedEpithetsActivated(isShowEpithets);
+ config.setAuthorshipSectionActivated(isShowAuthorship);
+ config.setAuthorCacheActivated(isShowAuthorshipCache);
+ config.setLSIDActivated(isShowLSID);
+ config.setNameApprobiationActivated(isShowNameApprobiation);
+ config.setNameCacheActivated(isShowNameCache);
+ config.setNameRelationsSectionActivated(isShowNameRelationship);
+ config.setNomenclaturalCodeActived(isShowNomenclaturalCode);
+ config.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus);
+ config.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef);
+ config.setProtologueActivated(isShowProtologue);
+ config.setRankActivated(isShowRank);
+ config.setTaxonSectionActivated(isShowTaxon);
+ config.setTypeDesignationSectionActivated(isShowTypeDesignation);
+ config.setHybridActivated(isShowHybrid);
+
+
return config;
}
- /**
- *
- */
- private void saveConfigToPrefernceStore() {
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
- isSimpleDetailsViewActivated);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
- isShowNomenclaturalCode);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE,
- isShowNameCache);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
- isShowAppendedPhrase);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
- isShowEpithets);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE,
- isShowAuthorshipCache);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
- isShowAuthorship);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
- isShowNomenclaturalRef);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
- isShowNomenclaturalStatus);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
- isShowProtologue);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
- isShowTypeDesignation);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
- isShowNameRelationship);
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID,
- isShowHybrid);
-
- }
protected IPreferenceStore doGetPreferenceStore() {
return PreferencesUtil.getPreferenceStore();
/**
* 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.
*/
package eu.etaxonomy.taxeditor.dnd;
+import java.util.Iterator;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer;
import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityComposite;
import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeViewer;
/**
* Drop listener for the {@link CdmAuthorityComposite}.
- *
+ *
* @author cmathew
* @created Mar 28, 2013
*
public class CdmAuthorityTableDropTargetListener implements DropTargetListener {
private CdmAuthorityCompositeViewer viewer;
-
-
+
+
public CdmAuthorityTableDropTargetListener(CdmAuthorityCompositeViewer viewer) {
this.viewer = viewer;
}
@Override
- public void dragEnter(DropTargetEvent event) {
+ public void dragEnter(DropTargetEvent event) {
}
@Override
@Override
public void drop(DropTargetEvent dtevent) {
- if(TaxonNodeTransfer.getInstance().isSupportedType(dtevent.currentDataType)) {
- Object[] selectedCdmBases = (Object[])dtevent.data;
-
- for (Object cdmBase : selectedCdmBases){
- if(CdmBase.class.isAssignableFrom(cdmBase.getClass()) ) {
- viewer.addCdmAuthority((CdmBase)cdmBase);
- }
- }
- }
+ ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+ if (selection instanceof TreeSelection) {
+
+ Iterator<?> selectionIterator = ((TreeSelection) selection).iterator();
+
+ while (selectionIterator.hasNext()){
+ Object next = selectionIterator.next();
+ if(CdmBase.class.isAssignableFrom(next.getClass()) ) {
+ viewer.addCdmAuthority((CdmBase)next);
+ }
+ }
+ }
}
@Override
* @author c.mathew
* @created Mar 25, 2013
*/
-public class TaxonNodeTransfer extends CdmObjectTransfer<ITaxonTreeNode> {
+public class TaxonNodeTransfer extends CdmObjectTransfer<TaxonNode> {
private static TaxonNodeTransfer instance = new TaxonNodeTransfer();
private static final String TYPE_NAME = "taxonNode-transfer-format";
* @see eu.etaxonomy.taxeditor.model.CdmObjectTransfer#loadElement(java.util.UUID)
*/
@Override
- public ITaxonTreeNode loadElement(UUID uuid) {
- ITaxonTreeNode result = CdmStore.getService(ITaxonNodeService.class).load(uuid, null);
+ public TaxonNode loadElement(UUID uuid) {
+ TaxonNode result = CdmStore.getService(ITaxonNodeService.class).load(uuid, null);
if ( result != null){
return result;
}
- result = CdmStore.getService(IClassificationService.class).load(uuid, null);
- return result;
+ return null;
}
}
+++ /dev/null
-package eu.etaxonomy.taxeditor.editor;
-
-public class AppModelId {
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_OPENBULKEDITORFORIDENTIFIABLEENTITY = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENPART = "eu.etaxonomy.taxeditor.command.openPart";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_CONSENSUS_SEQUENCE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_consensus_sequence";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_DNA_SAMPLE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_dna_sample";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_EXISTING_MEDIA_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_existing_media_specimen";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_MEDIA_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_media_specimen";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_SINGLE_READ = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_single_read";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_SPECIMEN = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_specimen";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_ADD_DERIVATE_ADD_TISSUE_SAMPLE = "eu.etaxonomy.taxeditor.editor.command.add_derivate.add_tissue_sample";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_COMMAND_SPECIMENEDITOR_CREATE_FIELD_UNIT = "eu.etaxonomy.taxeditor.editor.command.specimeneditor.create_field_unit";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATE_DEEPDELETE = "eu.etaxonomy.taxeditor.editor.derivate.deepDelete";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATE_DELETE = "eu.etaxonomy.taxeditor.editor.derivate.delete";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_COPYSINGLEREADTOCLIPBOARD = "eu.etaxonomy.taxeditor.editor.derivative.copySingleReadToClipBoard";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_REMOVESINGLEREADFROMSEQUENCE = "eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_REUSESINGLEREAD = "eu.etaxonomy.taxeditor.editor.derivative.reuseSingleRead";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DERIVATIVE_TOGGLELINKWITHTAXONSELECTION = "eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.media.command.delete";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_MOVEIMGDOWN = "eu.etaxonomy.taxeditor.editor.media.command.moveimgdown";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_MOVEIMGUP = "eu.etaxonomy.taxeditor.editor.media.command.moveimgup";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_NEWIMAGE = "eu.etaxonomy.taxeditor.editor.media.command.newimage";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_NEWIMAGEGALLERY = "eu.etaxonomy.taxeditor.editor.media.command.newimagegallery";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_MEDIA_COMMAND_USEEXISTINGIMAGE = "eu.etaxonomy.taxeditor.editor.media.command.useExistingImage";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_ADDDESCRIPTION = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.adddescription";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_DELETE = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.delete";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_MOVEDESCRIPTIONELEMENTS = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_COMMAND_MOVEDESCRIPTIONTOTAXON = "eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon";
- public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_FEATURETREE_REMOVEFEATURE = "eu.etaxonomy.taxeditor.store.command.featureTree.removeFeature";
- public static final String COMMAND_ORG_ECLIPSE_UI_FILE_SAVE = "org.eclipse.ui.file.save";
- public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_DYNAMICMENUCONTRIBUTION_0 = "eu.etaxonomy.taxeditor.editor.dynamicmenucontribution.0";
- public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_DYNAMICMENUCONTRIBUTION_1 = "eu.etaxonomy.taxeditor.editor.dynamicmenucontribution.1";
- public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_EDITOR_SPECIMENEDITOR_DYNAMICMENUCONTRIBUTION_CDMVIEWER = "eu.etaxonomy.taxeditor.editor.specimeneditor.dynamicmenucontribution.cdmViewer";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_DELETE = "eu.etaxonomy.taxeditor.editor.factualData.delete";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_MOVEDESCRIPTIONELEMENT = "eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionElement";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_FACTUALDATA_MOVEDESCRIPTIONTOTAXON = "eu.etaxonomy.taxeditor.editor.factualData.moveDescriptionToTaxon";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_ADDEXISTINGIMAGE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.addExistingImage";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABEL52 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel52";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABEL54 = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabel54";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELLINK_WITH_TAXON_SELECTION = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabellink_with_taxon_selection";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELREMOVE_SINGLE_READ_FROM_THIS_SEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabelremove_single_read_from_this_sequence";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDLABELREUSE_SINGLE_READ_FOR_OTHER_SEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandlabelreuse_single_read_for_other_sequence";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_COMMANDNAMEREUSE_SINGLE_READ = "eu.etaxonomy.taxeditor.editor.handledmenuitem.commandnamereuse_single_read";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CONSENSUSSEQUENCE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.consensussequence";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CREATEFIELDUNIT = "eu.etaxonomy.taxeditor.editor.handledmenuitem.createfieldunit";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_CREATE_FIELD_UNIT_FOR_TAXON = "eu.etaxonomy.taxeditor.editor.handledmenuitem.create_field_unit_for_taxon";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_DELETEMEDIA = "eu.etaxonomy.taxeditor.editor.handledmenuitem.deleteMedia";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_DNASAMPLE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.dnasample";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_EXISTINGMEDIA = "eu.etaxonomy.taxeditor.editor.handledmenuitem.existingmedia";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_FACTUALDATA_ADDDESCRIPTION = "eu.etaxonomy.taxeditor.editor.handledmenuitem.factualData.addDescription";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MEDIASPECIMEN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.mediaspecimen";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MOVEIMAGEDOWN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.moveImageDown";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_MOVEIMAGEUP = "eu.etaxonomy.taxeditor.editor.handledmenuitem.moveImageUp";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_NEWIMAGE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.newImage";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_NEWIMAGEGALLERY = "eu.etaxonomy.taxeditor.editor.handledmenuitem.newImageGallery";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_REMOVECHARACTER = "eu.etaxonomy.taxeditor.editor.handledmenuitem.removecharacter";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_SINGLEREAD = "eu.etaxonomy.taxeditor.editor.handledmenuitem.singleread";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_SPECIMEN = "eu.etaxonomy.taxeditor.editor.handledmenuitem.specimen";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_HANDLEDMENUITEM_TISSUESAMPLE = "eu.etaxonomy.taxeditor.editor.handledmenuitem.tissuesample";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_FACTUALDATA = "eu.etaxonomy.taxeditor.editor.showViewMenu.factualData";
- public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEWMENU_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.showViewMenu.mediaView";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_HANDLER_DEFAULTHANDLER_OPENBULKEDITORFORIDENTIFIABLEENTITYE4 = "eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntityE4";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDSPECIMENHANDLER = "eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSpecimenHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDCONSENSUSSEQUENCEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddConsensusSequenceHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDDNASAMPLEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddDnaSampleHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDEXISTINGMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddExistingMediaHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDMEDIASPECIMENHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddMediaSpecimenHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDSINGLEREADHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddSingleReadHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_ADDTISSUESAMPLEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.AddTissueSampleHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_CREATEFIELDUNITHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.CreateFieldUnitHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_DELETEDERIVATEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SAVEHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SaveHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_COPYSINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.copySingleRead";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_REMOVESINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.removeSingleRead";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_SINGLEREADHANDLER_REUSESINGLEREAD = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.SingleReadHandler.reuseSingleRead";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_HANDLER_TOGGLELINKWITHTAXONSELECTIONHANDLER = "eu.etaxonomy.taxeditor.editor.view.derivate.handler.ToggleLinkWithTaxonSelectionHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_CREATEDESCRIPTIONHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.CreateDescriptionHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_DELETEHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.DeleteHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_MOVEDESCRIPTIONELEMENTSHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionElementsHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_HANDLER_MOVEDESCRIPTIONTOOTHERTAXONHANDLER = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionToOtherTaxonHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_ADDEXISTINGMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.AddExistingMediaHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_ADDIMAGEGALLERYHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.AddImageGalleryHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_CREATEMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.CreateMediaHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_DELETEMEDIAHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.DeleteMediaHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_MOVEIMAGEDOWNINLISTHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.MoveImageDownInListHandler";
- public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_HANDLER_MOVEIMAGEUPINLISTHANDLER = "eu.etaxonomy.taxeditor.editor.view.media.handler.MoveImageUpInListHandler";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_0 = "eu.etaxonomy.taxeditor.editor.menuseparator.0";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_1 = "eu.etaxonomy.taxeditor.editor.menuseparator.1";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_10 = "eu.etaxonomy.taxeditor.editor.menuseparator.10";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_2 = "eu.etaxonomy.taxeditor.editor.menuseparator.2";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_3 = "eu.etaxonomy.taxeditor.editor.menuseparator.3";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_4 = "eu.etaxonomy.taxeditor.editor.menuseparator.4";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_5 = "eu.etaxonomy.taxeditor.editor.menuseparator.5";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_6 = "eu.etaxonomy.taxeditor.editor.menuseparator.6";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_7 = "eu.etaxonomy.taxeditor.editor.menuseparator.7";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_8 = "eu.etaxonomy.taxeditor.editor.menuseparator.8";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_9 = "eu.etaxonomy.taxeditor.editor.menuseparator.9";
- public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENUSEPARATOR_BEFOREDELETE = "eu.etaxonomy.taxeditor.editor.menuseparator.beforeDelete";
- public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_ADD = "eu.etaxonomy.taxeditor.editor.menu.add";
- public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_MENULABEL1 = "eu.etaxonomy.taxeditor.editor.menu.menulabel1";
- public static final String MENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_MENU_SPECIMEN_EDITOR_MEDIA = "eu.etaxonomy.taxeditor.editor.menu.specimen_editor.media";
- public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.showView.parameter.charactereditor";
- public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_EDITOR_SHOWVIEW_PARAMETER_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.showView.parameter.mediaview";
- public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DERIVATE_DERIVATEVIEW = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
- public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_DESCRIPTIVE_E4_FACTUALDATAPARTE4 = "eu.etaxonomy.taxeditor.editor.view.descriptive.e4.FactualDataPartE4";
- public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_VIEW_MEDIA_E4_MEDIAVIEWPARTE4 = "eu.etaxonomy.taxeditor.editor.view.media.e4.MediaViewPartE4";
- public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_WORKINGSET_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.workingSet.CharacterEditor";
- public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_CHARACTEREDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.characterEditor";
- public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_FACTUALDATAVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.factualDataView";
- public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_MEDIAVIEW = "eu.etaxonomy.taxeditor.editor.popupmenu.mediaview";
- public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_EDITOR_POPUPMENU_SPECIMENEDITOR = "eu.etaxonomy.taxeditor.editor.popupmenu.specimeneditor";
-}
\ No newline at end of file
--- /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.editor;
+
+/**
+ * @author k.luther
+ * @date 29.09.2017
+ *
+ */
+public interface IDistributionEditor {
+
+}
editor,\r
currentLocation);\r
//TODO: implement execute\r
- StoreUtil.executeOperation(operation);\r
+// StoreUtil.executeOperation(operation);\r
// select the newly moved objects\r
editor.getViewer().setSelection(new StructuredSelection(sourceTerms.toArray(new TermBase[sourceTerms.size()])));\r
\r
new MenuManager(Messages.DefinedTermMenu_OTHERS,"eu.etaxonomy.taxeditor.store.term.other.menu"); //$NON-NLS-2$
otherMenuManager.setVisible(true);
dtMenuManager.add(otherMenuManager);
- //FIXME E4: This should be removed during e4 migration. dynamic menu should be declared in model fragment
dtMenuManager.add(new Separator());
dtMenuManager.add(createFeatureTreeMenuItem());
import java.util.ArrayList;
import java.util.Collection;
+import javax.inject.Inject;
+
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
import eu.etaxonomy.taxeditor.editor.definedterm.operation.MoveDefinedTermOperation;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.EditViewerDropAdapter;
/**
*
* @since Aug 22, 2017
*
*/
-public class DefinedTermDropAdapterE4 extends ViewerDropAdapter {
+public class DefinedTermDropAdapterE4 extends EditViewerDropAdapter {
private final DefinedTermEditorE4 editor;
+ @Inject
+ private UISynchronize sync;
+
+ @Inject
protected DefinedTermDropAdapterE4(DefinedTermEditorE4 editor) {
super(editor.getViewer());
this.editor = editor;
editor,
currentLocation);
//TODO: implement execute
- StoreUtil.executeOperation(operation);
+ StoreUtil.executeOperation(operation, sync);
// select the newly moved objects
editor.getViewer().setSelection(new StructuredSelection(sourceTerms.toArray(new TermBase[sourceTerms.size()])));
import javax.inject.Inject;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
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.swt.dnd.Transfer;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IMemento;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
}
@PostConstruct
- public void createPartControl(Composite parent, EMenuService menuService) {
+ public void createPartControl(Composite parent, EMenuService menuService,
+ IEclipseContext context) {
if (CdmStore.isActive()){
if(conversation == null){
conversation = CdmStore.createConversation();
layout.type = SWT.VERTICAL;
parent.setLayout(layout);
- viewer = new TreeViewer(parent);
+ viewer = new TreeViewer(new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
viewer.getControl().setLayoutData(LayoutConstants.FILL());
viewer.setContentProvider(new TermContentProvider());
viewer.setLabelProvider(new TermLabelProvider());
Transfer[] transfers = new Transfer[] { TermTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListenerE4(viewer));
- viewer.addDropSupport(dndOperations, transfers, new DefinedTermDropAdapterE4(this));
+ DefinedTermDropAdapterE4 dropListener = new DefinedTermDropAdapterE4(this);
+ ContextInjectionFactory.inject(dropListener, context);
+ viewer.addDropSupport(dndOperations, transfers, dropListener);
//propagate selection
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
otherMenu.setLabel(Messages.DefinedTermMenu_OTHERS);
items.add(otherMenu);
- //FIXME E4: This should be removed during e4 migration. dynamic menu should be declared in model fragment
items.add(MMenuFactory.INSTANCE.createMenuSeparator());
// createFeatureTreeMenuItem(menu);
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MHandledMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MHandledMenuItem menuItem,
+ UISynchronize sync) {
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
termBase,
termEditor.getDefinedTermEditorInput(),
termEditor, addTermAsKindOf);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
import javax.inject.Named;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
-import eu.etaxonomy.cdm.model.common.TermBase;
import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateTermVocabularyOperation;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MMenuItem menuItem) throws NotDefinedException {
+ MMenuItem menuItem,
+ UISynchronize sync) {
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
undoContext,
termEditor.getDefinedTermEditorInput(),
termEditor);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
}
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem;
import org.eclipse.e4.ui.services.IServiceConstants;
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
- @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MMenuItem menuItem) {
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TermBase termBase, MMenuItem menuItem,
+ UISynchronize sync) {
DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) activePart.getObject();
termBase,
termEditor.getDefinedTermEditorInput(),
termEditor);
- AbstractUtility.executeOperation(operation);
+ AbstractUtility.executeOperation(operation, sync);
}
@CanExecute
import java.util.UUID;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
public class OpenDefinedTermEditorHandlerE4 {
@Execute
- public void execute(EPartService partService, MHandledMenuItem menuItem) {
+ public void execute(EPartService partService, MHandledMenuItem menuItem, MApplication application, EModelService modelService) {
String commandId = menuItem.getCommand().getElementId();
UUID termTypeUuid = (UUID) menuItem.getTransientData().get(commandId+".termTypeUuid");
TermEditorInput termEditorInput = new TermEditorInput(TermType.getByUuid(termTypeUuid));
- MPart mPart = partService.createPart("eu.etaxonomy.taxeditor.editor.definedTerm");
- partService.showPart(mPart, PartState.ACTIVATE);
- DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) mPart.getObject();
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.definedTerm");
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.ACTIVATE);
+ DefinedTermEditorE4 termEditor = (DefinedTermEditorE4) part.getObject();
termEditor.init(termEditorInput);
}
termBase,\r
dfe.getDefinedTermEditorInput(),\r
editor, addTermAsKindOf);\r
- StoreUtil.executeOperation(operation);\r
\r
} catch (NotDefinedException e) {\r
MessagingUtils.error(getClass(), e);\r
/**\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
String label = event.getCommand().getName();\r
IUndoContext undoContext = StoreUtil.getUndoContext();\r
\r
- AbstractPostOperation operation = \r
- new CreateTermVocabularyOperation(label, \r
- undoContext, \r
- dfe.getDefinedTermEditorInput(), \r
- (DefinedTermEditor) editor);\r
- StoreUtil.executeOperation(operation);\r
+ AbstractPostOperation operation =\r
+ new CreateTermVocabularyOperation(label,\r
+ undoContext,\r
+ dfe.getDefinedTermEditorInput(),\r
+ editor);\r
\r
} catch (NotDefinedException e) {\r
MessagingUtils.error(getClass(), e);\r
- } \r
+ }\r
}\r
return null;\r
}\r
import eu.etaxonomy.cdm.model.common.TermBase;\r
import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
import eu.etaxonomy.taxeditor.editor.definedterm.operation.DeleteTermBaseOperation;\r
-import eu.etaxonomy.taxeditor.model.AbstractUtility;\r
import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
import eu.etaxonomy.taxeditor.store.StoreUtil;\r
term,\r
dfe.getDefinedTermEditorInput(),\r
dfe);\r
- AbstractUtility.executeOperation(operation);\r
}\r
}\r
} catch (NotDefinedException e) {\r
*/\r
\r
package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
-import java.util.UUID;\r
-\r
import org.eclipse.core.commands.AbstractHandler;\r
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.commands.IHandler;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.MultiStatus;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.ui.IWorkbenchPage;\r
-import org.eclipse.ui.PartInitException;\r
-\r
-import eu.etaxonomy.cdm.model.common.TermType;\r
-import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
-import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
-import eu.etaxonomy.taxeditor.store.StoreUtil;\r
\r
\r
/**\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
\r
- String termTypeUuid = event.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid");\r
- IWorkbenchPage activePage = StoreUtil.getActivePage();\r
- try {\r
- activePage.openEditor(new TermEditorInput(TermType.getByUuid(UUID.fromString(termTypeUuid))), DefinedTermEditor.ID);\r
- } catch (PartInitException e) {\r
-\r
- String PID = "eu.etaxonomy.taxeditor.application";\r
- MultiStatus info = new MultiStatus(PID, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);\r
- info.add(new Status(IStatus.WARNING, PID, 1, e.getMessage(), null));\r
- MessagingUtils.warningDialog("Cannot open Defined Term Editor", getClass(), info);\r
- }\r
+// String termTypeUuid = event.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.termTypeUuid");\r
+// IWorkbenchPage activePage = StoreUtil.getActivePage();\r
+// try {\r
+// activePage.openEditor(new TermEditorInput(TermType.getByUuid(UUID.fromString(termTypeUuid))), DefinedTermEditor.ID);\r
+// } catch (PartInitException e) {\r
+//\r
+// String PID = "eu.etaxonomy.taxeditor.application";\r
+// MultiStatus info = new MultiStatus(PID, 1, "You might be missing sufficient permissions to open the Defined Term Editor", null);\r
+// info.add(new Status(IStatus.WARNING, PID, 1, e.getMessage(), null));\r
+// MessagingUtils.warningDialog("Cannot open Defined Term Editor", getClass(), info);\r
+// }\r
\r
return null;\r
}\r
\r
import java.util.List;\r
\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.ui.IEditorInput;\r
-import org.eclipse.ui.IPersistableElement;\r
-\r
import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;\r
\r
* @date 3 Jan 2012\r
*\r
*/\r
-public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase> extends CdmEntitySessionInput implements IEditorInput {\r
+public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase> extends CdmEntitySessionInput {\r
\r
/**\r
*\r
super(true);\r
}\r
\r
- @Override\r
- public Object getAdapter(Class adapter) {\r
- return null;\r
- }\r
-\r
- @Override\r
- public boolean exists() {\r
- return false;\r
- }\r
-\r
- @Override\r
- public ImageDescriptor getImageDescriptor() {\r
- return null;\r
- }\r
-\r
- @Override\r
- public IPersistableElement getPersistable() {\r
- return null;\r
- }\r
-\r
- @Override\r
- public String getToolTipText() {\r
- return getName();\r
- }\r
-\r
/**\r
* @return\r
*/\r
vocabularies = new HashSet<TermVocabulary<DefinedTermBase>>();
initialiseVocabularies();
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
public String getName() {
return termType.getMessage();
}
--- /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.event;
+
+import java.util.Collection;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
+/**
+ * @author pplitzner
+ * @since Sep 4, 2017
+ *
+ */
+public class EventUtility {
+
+ private static ITaxonEditor editor;
+
+ private static MPart activePart;
+
+ private static Shell shell;
+
+ @PostConstruct
+ public void create(){
+ //nothing
+ }
+
+ @Inject
+ @Optional
+ private void updateCurrentActiveShell(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell){
+ EventUtility.shell = shell;
+ }
+
+ @Inject
+ @Optional
+ private void updateCurrentActivePart(@Named(IServiceConstants.ACTIVE_PART)MPart activePart){
+ if(activePart!=null){
+ EventUtility.activePart = activePart;
+ }
+ }
+
+ @Inject
+ @Optional
+ private void updateCurrentTaxon(@UIEventTopic(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR)ITaxonEditor editor){
+ EventUtility.editor = editor;
+ }
+
+ public static Taxon getCurrentTaxon() {
+ if(editor!=null){
+ return editor.getTaxon();
+ }
+ return null;
+ }
+
+ public static ITaxonEditor getTaxonEditor() {
+ return editor;
+ }
+
+ public static MPart getActivePart() {
+ return activePart;
+ }
+
+ public static Shell getShell() {
+ return shell;
+ }
+
+ public static MPart getActiveEditorPart(EPartService partService){
+ Collection<MPart> parts = partService.getParts();
+ for (MPart part : parts) {
+ if(part.getObject()!=null && part.getObject() instanceof IE4SavablePart
+ && part.isVisible()){
+ return part;
+ }
+ }
+ return null;
+ }
+
+// private EventHandler testHandler;
+//
+// @Inject
+// public EventUtility(IEventBroker eventBroker) {
+// testHandler = new EventHandler() {
+//
+// @Override
+// public void handleEvent(Event event) {
+// Object part = event.getProperty(UIEvents.EventTags.ELEMENT);
+// boolean tbr =(Boolean) event.getProperty(UIEvents.EventTags.NEW_VALUE);
+// if (part instanceof MPart){
+// System.out.println("Part "+((MPart)part).getElementId()+" is "+(!tbr?"NOT":"")+" visible");
+// }
+// else if(part instanceof MPlaceholder){
+// System.out.println("Part "+((MPlaceholder)part).getRef().getElementId()+" is "+(!tbr?"NOT":"")+" visible");
+// }
+// }
+// };
+// eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, testHandler);
+// }
+
+}
--- /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.event;
+
+/**
+ * @author pplitzner
+ * @since Sep 4, 2017
+ *
+ */
+public interface WorkbenchEventConstants {
+
+ public static final String CURRENT_ACTIVE_EDITOR = "CURRENT/ACTIVE_EDITOR";
+
+}
import javax.inject.Inject;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
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.ui.IMemento;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
import eu.etaxonomy.cdm.model.description.FeatureNode;
import eu.etaxonomy.cdm.model.description.FeatureTree;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
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.IE4SavablePart;
import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
/**
*
*/
public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListener, ISelectionChangedListener,
- IE4ViewerPart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener {
+ IE4ViewerPart, IE4SavablePart, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, IConversationEnabled {
private ConversationHolder conversation;
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();
+ save(new NullProgressMonitor());
}
else{
return;
return (IStructuredSelection) composite.getViewer().getSelection();
}
- @Persist
- public void save(){
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ @Override
+ @Persist
+ public void save(IProgressMonitor monitor){
if (!conversation.isBound()) {
conversation.bind();
}
public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void update(CdmDataChangeMap arg0) {
+ }
+
}
btnOpenFeatureTree.setToolTipText(Messages.FeatureTreeEditorComposite_OPEN_TREE);
btnOpenFeatureTree.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
- viewer = new TreeViewer(this);
+ viewer = new TreeViewer(new Tree(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
Tree tree = viewer.getTree();
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
viewer.getControl().setLayoutData(
+++ /dev/null
-/**
-* Copyright (C) 2007 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.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import eu.etaxonomy.cdm.model.common.User;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
-
-/**
- * <p>ShowLoginWindowHandler class.</p>
- *
- * @author n.hoffmann
- * @created Aug 7, 2009
- * @version 1.0
- */
-public class OpenPasswordWizzardHandler extends AbstractHandler implements IHandler{
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
-
- if(principal instanceof User){
-
- PasswordWizard wizard = new PasswordWizard((User)principal, null);
- WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
-
- dialog.open();
-
- } else {
- // should never happen, log an error
- MessagingUtils.error(OpenPasswordWizzardHandler.class, "The principal currently authenticated is not a eu.etaxonomy.cdm.model.common.User", null);
- }
-
- return null;
-
- }
-
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
-
-/**
- *
- *
- * @author c.mathew
- */
-public class ReconnectHandler extends AbstractHandler implements IHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
-
- loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), true, true);
-
- return null;
-
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
-
-/**
- * <p>ShowLoginWindowHandler class.</p>
- *
- * @author n.hoffmann
- * @created Aug 7, 2009
- * @version 1.0
- */
-public class ShowLoginWindowHandler extends AbstractHandler implements IHandler{
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- LoginDialog loginDialog = new LoginDialog(HandlerUtil.getActiveShell(event));
- loginDialog.open();
-
- return null;
-
- }
-
-
-
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
-
-/**
- *
- *
- * @author c.mathew
- */
-public class ShowRemotingLoginWindowHandler extends AbstractHandler implements IHandler{
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- loginDialog.open();
-
-
- return null;
-
- }
-}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.handler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
-
-/**
- *
- *
- * @author c.mathew
- */
-public class SwitchUserHandler extends AbstractHandler implements IHandler {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- RemotingLoginDialog loginDialog = new RemotingLoginDialog(HandlerUtil.getActiveShell(event),
- SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
-
- loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), false, false);
-
- return null;
-
- }
-}
-
+++ /dev/null
-package eu.etaxonomy.taxeditor.handler.defaultHandler;
-
-import java.util.UUID;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-import eu.etaxonomy.cdm.api.service.IClassificationService;
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-public class DefaultOpenClassificationWizardHandler extends DefaultOpenHandlerBase<Classification> {
-
- @Override
- protected Classification getEntity(UUID uuid) {
- return CdmStore.getService(IClassificationService.class).load(uuid);
- }
-
- @Override
- protected void open(ExecutionEvent event, Classification entity) {
- NewClassificationWizard classificationWizard = new NewClassificationWizard();
- classificationWizard.init(null, null);
- classificationWizard.setEntity(entity);
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
- dialog.open();
- }
-
-
-}
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.ParameterType;
import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
public abstract class DefaultOpenHandlerBase <T> extends AbstractHandler {
}
//if not try current selection
else{
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if(selection instanceof IStructuredSelection){
- open(event, (T) ((IStructuredSelection) selection).getFirstElement());
- }
+ MessagingUtils.errorDialog("Default Handler", this, "Migrate handler!!!", TaxeditorStorePlugin.PLUGIN_ID, null, false);
+// ISelection selection = HandlerUtil.getCurrentSelection(event);
+// if(selection instanceof IStructuredSelection){
+// open(event, (T) ((IStructuredSelection) selection).getFirstElement());
+// }
}
return null;
}
+++ /dev/null
-package eu.etaxonomy.taxeditor.handler.defaultHandler;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.e4.ui.workbench.modeling.EPartService;
-import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
-
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-
-public class OpenReferencingObjectsView extends AbstractHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
- eu.etaxonomy.taxeditor.bulkeditor.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4,
- PartState.ACTIVATE);
- return null;
- }
-
-}
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+
+public class OpenReferencingObjectsViewHandler {
+
+ @Execute
+ public void execute(EPartService partService) {
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.e4.ReferencingObjectsViewE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
+
+import java.util.UUID;
+
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class DefaultOpenClassificationWizardHandlerE4 extends DefaultOpenHandlerBaseE4<TaxonNode> {
+
+ @Override
+ protected TaxonNode getEntity(UUID uuid) {
+ return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+ }
+
+ @Override
+ protected void open(TaxonNode entity, Shell shell, EPartService partService) {
+ NewClassificationWizard classificationWizard = new NewClassificationWizard();
+ classificationWizard.init(null, null);
+ classificationWizard.setEntity(entity.getClassification());
+ WizardDialog dialog = new WizardDialog(shell, classificationWizard);
+ dialog.open();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean canExecute(TaxonNode entity) {
+ return entity.getClassification().getRootNode().equals(entity);
+ }
+
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
+
+import java.util.UUID;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.swt.widgets.Shell;
+
+public abstract class DefaultOpenHandlerBaseE4 <T> {
+
+ protected IEclipseContext context;
+
+ protected MApplication application;
+
+ protected EModelService modelService;
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MHandledMenuItem menuItem,
+ EModelService modelService, EPartService partService, MApplication application,
+ IEclipseContext context) {
+ this.context = context;
+ this.modelService = modelService;
+ this.application = application;
+
+ String commandId = menuItem.getCommand().getElementId();
+ Object transientData = menuItem.getTransientData().get(commandId+".uuid");
+ if(transientData instanceof UUID){
+ T entity = getEntity((UUID) transientData);
+ open(entity, shell, partService);
+ }
+ }
+
+ @CanExecute
+ public boolean canExecute(MHandledMenuItem menuItem) {
+ boolean canExecute = false;
+ String commandId = menuItem.getCommand().getElementId();
+ Object transientData = menuItem.getTransientData().get(commandId+".uuid");
+ if(transientData instanceof UUID){
+ T entity = getEntity((UUID) transientData);
+ canExecute = canExecute(entity);
+ }
+ menuItem.setVisible(canExecute);
+ return canExecute;
+ }
+
+ protected abstract T getEntity(UUID uuid);
+
+ protected abstract void open(T entity, Shell shell, EPartService partService);
+
+ protected abstract boolean canExecute(T entity);
+
+}
* 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.handler.defaultHandler;
+package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
import java.util.UUID;
-import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
* @date 22.03.2016
*
*/
-public class DefaultOpenTaxonNodeWizardHandler extends DefaultOpenHandlerBase<TaxonNode> {
+public class DefaultOpenTaxonNodeWizardHandlerE4 extends DefaultOpenHandlerBaseE4<TaxonNode> {
+
@Override
protected TaxonNode getEntity(UUID uuid) {
return CdmStore.getService(ITaxonNodeService.class).load(uuid);
}
@Override
- protected void open(ExecutionEvent event, TaxonNode entity) {
- EditTaxonNodeWizard taxonNodeWizard = new EditTaxonNodeWizard();
+ protected void open(TaxonNode entity, Shell shell, EPartService partService) {
+ EditTaxonNodeWizard taxonNodeWizard = ContextInjectionFactory.make(EditTaxonNodeWizard.class, context);
taxonNodeWizard.init(null, null);
taxonNodeWizard.setEntity(entity);
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), taxonNodeWizard);
+ WizardDialog dialog = new WizardDialog(shell, taxonNodeWizard);
dialog.open();
}
-}
+
+ @Override
+ public boolean canExecute(TaxonNode entity) {
+ return entity.getTaxon()!=null;
+ }
+
+}
\ No newline at end of file
* 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.handler;
+package eu.etaxonomy.taxeditor.handler.e4;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionWizard;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
/**
- * @author a.oppermann
- * @date 21.07.2014
+ *
+ * @author pplitzner
+ * @date 10.10.2017
*
*/
-public class OpenDistributionEditorWizardHandler extends AbstractHandler{
+public class OpenDistributionEditorWizardHandlerE4 {
String commandID = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler";
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
AvailableDistributionWizard availableDistributionWizard = new AvailableDistributionWizard();
- WizardDialog dialog = new WizardDialog(StoreUtil.getShell(),
+ WizardDialog dialog = new WizardDialog(shell,
availableDistributionWizard);
dialog.open();
- return null;
}
-
}
--- /dev/null
+/**
+* Copyright (C) 2007 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @date 10.10.2017
+ *
+ */
+public class OpenPasswordWizzardHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
+
+ if(principal instanceof User){
+
+ PasswordWizard wizard = new PasswordWizard((User)principal, null);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+
+ dialog.open();
+
+ } else {
+ // should never happen, log an error
+ MessagingUtils.error(OpenPasswordWizzardHandlerE4.class, "The principal currently authenticated is not a eu.etaxonomy.cdm.model.common.User", null);
+ }
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @date 10.10.2017
+ *
+ */
+public class ReconnectHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell,
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+ loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), true, true);
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @date 10.10.2017
+ *
+ */
+public class ShowLoginWindowHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ LoginDialog loginDialog = new LoginDialog(shell);
+ loginDialog.open();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @date 10.10.2017
+ *
+ */
+public class ShowRemotingLoginWindowHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell,
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+ loginDialog.open();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.handler.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
+
+/**
+ *
+ * @author pplitzner
+ * @date 10.10.2017
+ *
+ */
+public class SwitchUserHandlerE4 {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+ RemotingLoginDialog loginDialog = new RemotingLoginDialog(shell,
+ SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+ loginDialog.open((CdmRemoteSource) CdmStore.getActiveCdmSource(), false, false);
+ }
+}
+
package eu.etaxonomy.taxeditor.io;
import java.io.BufferedWriter;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.text.SimpleDateFormat;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
import eu.etaxonomy.cdm.io.common.ExportDataWrapper;
import eu.etaxonomy.cdm.io.common.ExportResult;
import eu.etaxonomy.cdm.io.common.ExportResultType;
import eu.etaxonomy.cdm.io.common.IExportConfigurator;
-import eu.etaxonomy.cdm.io.common.IImportConfigurator;
import eu.etaxonomy.cdm.io.common.IIoConfigurator;
-import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
-import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
import eu.etaxonomy.cdm.io.service.IIOService;
+import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-import eu.etaxonomy.taxeditor.operation.FeedbackGenerator;
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* @version 1.0
*/
public class ExportManager extends AbstractIOManager<IExportConfigurator> implements IPostMoniteredOperationEnabled {
-
+
private final String successMessage = "The export was successfull";
private static final Logger logger = Logger.getLogger(ExportManager.class);
@Override
public void run() {
- IWorkbenchPart activePart = StoreUtil.getActivePage()
- .getActivePart();
+ Object activePart = EventUtility.getActivePart();
if (activePart instanceof IConversationEnabled) {
// terminate any open transactions
IConversationEnabled conversationEnabled = (IConversationEnabled) activePart;
ExportManager.this,
feedBackGeneratorList,
monitor);
-
+
} catch (Exception ex) {
return new Status(Status.ERROR, TaxeditorStorePlugin.PLUGIN_ID, "Operation Interrupted", ex);
}
-
+
ExportResult result = (ExportResult)remotingMonitor.getResult();
ExportDataWrapper data = result.getExportData();
try{
FileOutputStream stream = new FileOutputStream(exportFile);
stream.write(exportData);
stream.close();
- }
+ }
} else if (result.getExportData().getType().equals(ExportResultType.MAP_BYTE_ARRAY)){
Map<String, byte[]> resultMap = (Map<String, byte[]>)data.getExportData();
Set<String> keySet = resultMap.keySet();
String fileEnding = ".zip";
if (configurator instanceof DwcaTaxExportConfigurator){
DwcaTaxExportConfigurator dwcaConfig = (DwcaTaxExportConfigurator)configurator;
-
- File file = new File(dwcaConfig.getDestination().toURI());
+
+ File file = new File(dwcaConfig.getDestination().toURI());
FileOutputStream stream = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(stream);
for (String key: keySet){
byte[] fileData = resultMap.get(key);
- ZipEntry entry = new ZipEntry( key + fileEnding);
+ ZipEntry entry = new ZipEntry( key + fileEnding);
zos.putNextEntry(entry);
zos.write(fileData);
zos.closeEntry();
} else{
logger.error("This kind of result data is not supported yet." + result.getExportData().getType().toString());
}
-
+
} catch(Exception e){
logger.error(e.getStackTrace());
}
- showResult(configurator.getClass().getSimpleName(), display, result, successMessage);
+ showResult(configurator.getClass().getSimpleName(), display, result, successMessage);
} catch (Exception e) {
public Job createIOServiceJob(CdmLightExportConfigurator configurator, String urlString) {
Assert.isNotNull(configurator, "Configuration may not be null");
final Display display = Display.getDefault();
-
+
Job job = new Job("Export: " + configurator.getClass().getSimpleName()) { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
Calendar cal = Calendar.getInstance();
String fileEnding = ".csv";
-
- if (configurator.isCreateZipFile()){
- File file = new File(urlString+File.separator + "csv_light_" + sdf.format(cal.getTime())+ ".zip");
+
+ if (configurator.isCreateZipFile()){
+ File file = new File(urlString+File.separator + "csv_light_" + sdf.format(cal.getTime())+ ".zip");
FileOutputStream stream = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(stream);
for (String key: keySet){
byte[] fileData = resultMap.get(key);
- ZipEntry entry = new ZipEntry( key + fileEnding);
+ ZipEntry entry = new ZipEntry( key + fileEnding);
zos.putNextEntry(entry);
zos.write(fileData);
zos.closeEntry();
public void runMoniteredOperation(final IExportConfigurator configurator, String urlString) {
IIOService ioService = CdmApplicationState.getIOService();
final UUID uuid = ioService.monitExportData(configurator);
-
+
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
CdmStore.getContextManager().notifyContextRefresh();
}
});
-
+
}
}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.SWT;
+
+import eu.etaxonomy.cdm.io.common.IImportConfigurator;
+import eu.etaxonomy.cdm.io.common.IIoConfigurator;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ * @param <CONFIG>
+ */
+public abstract class AbstractImportWizardE4<CONFIG extends IIoConfigurator> extends Wizard {
+
+ protected GenericConfiguratorWizardPageE4 pageConfiguration;
+ private NomenclaturalCodeWizardPageE4 pageNomenclaturalCode;
+
+ protected IStructuredSelection selection;
+
+ protected IEclipseContext context;
+
+ private EPartService partService;
+
+ public AbstractImportWizardE4(IEclipseContext context, EPartService partService) {
+ this(context, partService, null);
+ }
+
+ public AbstractImportWizardE4(IEclipseContext context, EPartService partService, IStructuredSelection selection) {
+ this.context = context;
+ this.partService = partService;
+ this.selection = selection;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ addConfiguratorPage();
+
+ pageNomenclaturalCode = ContextInjectionFactory.make(NomenclaturalCodeWizardPageE4.class, context);
+ pageNomenclaturalCode.setConfigurator((IImportConfigurator)getConfigurator());
+ this.addPage(pageNomenclaturalCode);
+ }
+
+ protected void addConfiguratorPage(){
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), null, Messages.AbstractImportWizard_ConfigurationLabel);
+ this.addPage(pageConfiguration);
+ }
+
+ @Override
+ public void setContainer(IWizardContainer wizardContainer) {
+ if(existUnsavedEditors() && wizardContainer!=null){
+ MessageDialog.open(MessageDialog.WARNING, getShell(), "Unsaved editors", "Please save all open editors before executing " +
+ "an import operation. The import operation will be cancelled", SWT.NONE);
+ }
+ else{
+ super.setContainer(wizardContainer);
+ }
+ }
+
+ public abstract void init();
+
+ protected boolean existUnsavedEditors(){
+ return !partService.getDirtyParts().isEmpty();
+ }
+
+ @Override
+ public boolean canFinish() {
+ return !existUnsavedEditors() && super.canFinish();
+ }
+
+ public abstract CONFIG getConfigurator();
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+}
--- /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.io.e4.in;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public abstract class AbstractOpenImportWizard {
+ @Execute
+ public void execute(IEclipseContext ctx, Shell s)
+ {
+ AbstractImportWizardE4 wizard = ContextInjectionFactory.make(getImportWizardClass(), ctx);
+ wizard.init();
+ WizardDialog dialog = new WizardDialog(s, wizard);
+ dialog.open();
+ }
+
+ protected abstract Class<? extends AbstractImportWizardE4> getImportWizardClass();
+
+}
\ No newline at end of file
--- /dev/null
+/**
+ * Copyright (C) 2007 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.io.e4.in;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.inject.Inject;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.io.common.IIoConfigurator;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class GenericConfiguratorWizardPageE4 extends WizardPage {
+
+ private IIoConfigurator configurator;
+ private ResourceBundle resourceBundle;
+ private List<String> ignoreMethods;
+
+ @Inject
+ public GenericConfiguratorWizardPageE4() {
+ super("Configuration");
+ }
+
+ private void init(String title, String description, IIoConfigurator configurator, List<String> ignoreMethods){
+ this.setTitle(title);
+ this.setDescription(description);
+ this.configurator = configurator;
+ this.ignoreMethods = ignoreMethods;
+ resourceBundle = getResourceBundle(configurator);
+ }
+
+ private ResourceBundle getResourceBundle(IIoConfigurator configurator){
+ try{
+ if (configurator != null){
+ return ResourceBundle.getBundle(configurator.getClass().getName());
+ }else{
+ return ResourceBundle.getBundle("Configuration");
+ }
+ }catch(MissingResourceException e){
+ return null;
+ }
+ }
+
+ public void initImport(IIoConfigurator configurator, List<String> ignoreMethods, String label) {
+ init("Import Configuration", label, configurator, ignoreMethods);
+ }
+
+ public void initExport(IIoConfigurator configurator, List<String> ignoreMethods) {
+ init("Export Configuration", "Configure the export mechanism.", configurator, ignoreMethods);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+
+ // TODO wrap this composite in a scrolled composite
+ Composite composite = new Composite(parent, SWT.NULL);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ GridLayout gridLayout = new GridLayout();
+ composite.setLayout(gridLayout);
+
+ List<Method> methods = getConfiguratorsBooleanSetMethods(configurator);
+ Collections.sort(methods, new Comparator<Method>() {
+ @Override
+ public int compare(Method o1, Method o2) {
+ if (o1.equals(o2)){
+ return 0;
+ }
+ if(o1.getName()==null && o2.getName()!=null){
+ return -1;
+ }
+ if(o1.getName()!=null && o2.getName()==null){
+ return 1;
+ }
+ if(o1.getName()==null && o2.getName()==null){
+ return o1.toString().compareTo(o1.toString());
+ }
+ int result = o1.getName().compareTo(o2.getName());
+ if (result == 0){
+ return o1.toString().compareTo(o1.toString());
+ }
+ return result;
+ }
+ });
+
+ for (Method method : methods) {
+ if (ignoreMethods != null){
+ if (!ignoreMethods.contains( method.getName())) {
+ createCheckbox(composite, method, configurator);
+ }
+ }else{
+ createCheckbox(composite, method, configurator);
+ }
+
+ }
+
+ setControl(composite);
+ }
+
+ private void createCheckbox(Composite parent, Method method,
+ final IIoConfigurator configurator) {
+
+ final String methodName = method.getName();
+ final Button checkBox = new Button(parent, SWT.CHECK);
+
+ // if(configurator.getClass().equals(Abcd206ImportConfigurator.class)){
+ String[] r = methodName.split("set")[1].split("(?=\\p{Upper})");
+ checkBox.setText(getLabel(StringUtils.join(r," ")));
+// }
+// else{
+// checkBox.setText(getLabel(methodName));
+// }
+ // retrieve the default values and set the checkbox accordingly
+ boolean defaultSelection = executeBooleanGetMethod(configurator, "is"
+ + methodName.substring(3));
+ checkBox.setSelection(defaultSelection);
+ checkBox.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ executeBooleanSetMethod(configurator, methodName,
+ checkBox.getSelection());
+ }
+
+ });
+
+ }
+
+ private String getLabel(String methodName){
+
+ if(resourceBundle == null){
+ return methodName;
+ }
+
+ try{
+ return resourceBundle.getString(methodName);
+ }catch(MissingResourceException e){
+ return methodName;
+ }
+ }
+
+ private boolean executeBooleanGetMethod(IIoConfigurator configurator,
+ String methodName) {
+
+ Class<? extends IIoConfigurator> configuratorClass = configurator
+ .getClass();
+
+ boolean result = false;
+
+ Method[] methods = configuratorClass.getMethods();
+
+ for (Method method : methods) {
+ if (!method.getName().equals(methodName)) {
+ continue;
+ }
+
+ try {
+ Object returnType = method.invoke(configurator, null);
+ if (returnType.getClass().equals(Boolean.class)) {
+ result = ((Boolean) returnType).booleanValue();
+ }
+
+ break;
+ } catch (Exception e) {
+ MessagingUtils.warn(this.getClass(), "Could not invoke method");
+ }
+ }
+
+ return result;
+ }
+
+ private void executeBooleanSetMethod(IIoConfigurator configurator,
+ String methodName, boolean selected) {
+
+ Class<? extends IIoConfigurator> configuratorClass = configurator
+ .getClass();
+
+ Method[] methods = configuratorClass.getMethods();
+
+ for (Method method : methods) {
+ if (!method.getName().equals(methodName)) {
+ continue;
+ }
+
+ try {
+ method.invoke(configurator, selected);
+
+ break;
+ } catch (Exception e) {
+ MessagingUtils.warn(this.getClass(), "Could not invoke method");
+ }
+ }
+ }
+
+ private List<Method> getConfiguratorsBooleanSetMethods(
+ IIoConfigurator configurator) {
+ List<Method> booleanMethods = new ArrayList<Method>();
+
+ Class<? extends IIoConfigurator> configuratorClass = configurator
+ .getClass();
+
+ Method[] allMethods = configuratorClass.getMethods();
+
+ for (Method method : allMethods) {
+ if (method.getName().startsWith("set")) {
+
+ Class<?>[] typeList = method.getParameterTypes();
+
+ if (typeList.length > 1) {
+ new IllegalStateException(
+ "Found a setter with parameter count > 1");
+ }
+
+ if (typeList[0].getName().equals("boolean")) {
+ booleanMethods.add(method);
+ }
+ }
+ }
+
+ return booleanMethods;
+ }
+}
--- /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.io.e4.in;
+
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import eu.etaxonomy.cdm.api.service.IVocabularyService;
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 04.05.2017
+ *
+ */
+public class ImportFromFileAndChooseVocIdWizardPageE4 extends ImportFromFileDataSourceWizardPageE4 {
+
+ private Combo vocabularyCombo;
+ UUID vocUuid;
+ String[][] labelAndValues;
+
+ @Inject
+ public ImportFromFileAndChooseVocIdWizardPageE4() {
+ super();
+ setTitle("Choose Excel File");
+ setDescription("Please choose an xls file in the Distribution Update format.");
+ setExtensions(new String[]{"*.xlsx", "*.xls", "*.*"});
+
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ Composite composite = (Composite)getControl();
+ // final Composite composite = new Composite(parent, SWT.NULL);
+ GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ composite.setLayoutData(gridData);
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.ImportFromFileAndChooseVocIdWizardPage_AreaVoc);
+ label.setToolTipText(Messages.ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip);
+ vocabularyCombo = new Combo(composite, SWT.DROP_DOWN);
+ List<TermVocabulary<DefinedTermBase>> vocs = CdmStore.getService(IVocabularyService.class).findByTermType(TermType.NamedArea, null);
+ for(TermVocabulary voc: vocs){
+ vocabularyCombo.add(voc.getLabel());
+ }
+ getLabelAndValues(vocs);
+ vocabularyCombo.select(0);
+ setVocUuidFromVocCombo();
+ vocabularyCombo.addSelectionListener(new SelectionAdapter(){
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String name = vocabularyCombo.getText();
+ setVocUuidFromVocCombo();
+ if (vocUuid != null){
+ setPageComplete(isPageComplete());
+ }
+ }
+
+ });
+ }
+
+ /**
+ * @return
+ */
+ private void setVocUuidFromVocCombo() {
+ String name = vocabularyCombo.getText();
+
+ for (String[] labelAndValue: labelAndValues){
+ if (labelAndValue[0].equals(name)){
+ String uuidString = labelAndValue[1];
+ vocUuid = UUID.fromString(uuidString);
+ }
+ }
+
+ }
+
+ public UUID getVocUuid() {
+ return vocUuid;
+ }
+
+ public void setVocUuid(UUID vocUuid) {
+ this.vocUuid = vocUuid;
+ }
+
+ private String[][] getLabelAndValues(List<TermVocabulary<DefinedTermBase>> vocs) {
+
+ labelAndValues = new String[vocs.size()][2];
+ for (int i = 0; i < vocs.size(); i++) {
+ labelAndValues[i][0] = vocs.get(i).getLabel();
+ labelAndValues[i][1] = vocs.get(i).getUuid().toString();
+ }
+ return labelAndValues;
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ boolean result = CdmUtils.isNotBlank(text_source.getText()) && vocUuid != null;
+
+ return result;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in;
+
+import java.io.File;
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.common.CdmUtils;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class ImportFromFileDataSourceWizardPageE4 extends WizardPage {
+
+ public static final String PAGE_NAME = "CdmXmlDataSourceWizardPage";
+
+ private String[] extensions = {"*.xml"};
+
+ private FileDialog fileDialog;
+ private Text textReferenceString;
+
+ protected Text text_source;
+
+ @Inject
+ public ImportFromFileDataSourceWizardPageE4() {
+ super(PAGE_NAME);
+
+ setTitle("Xml File");
+
+ setDescription("Select XML file.");
+
+ setExtensions(new String[]{"*.xml","*.*"});
+ }
+
+ public void setExtensions(String[] extensions) {
+ this.extensions = extensions;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NULL);
+
+ setPageComplete(false);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ composite.setLayout(gridLayout);
+
+ Label folderLabel = new Label(composite, SWT.NONE);
+ folderLabel.setText("File");
+
+ fileDialog = new FileDialog(parent.getShell());
+
+ fileDialog.setFilterExtensions(extensions);
+
+ text_source = new Text(composite, SWT.BORDER);
+ text_source.setEditable(false);
+ text_source.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+
+ Button button = new Button(composite, SWT.PUSH);
+ button.setText("Browse...");
+
+ button.addSelectionListener(new SelectionAdapter(){
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String path = fileDialog.open();
+ if(path!=null){
+ text_source.setText(path);
+ setPageComplete(isPageComplete());
+ }
+ }
+
+ });
+
+ Label labelRef = new Label(composite, SWT.NONE);
+ labelRef.setText("Default import souce reference");
+ labelRef.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+ textReferenceString = new Text(composite, SWT.NONE);
+ textReferenceString.setEnabled(true);
+ GridData gd_textReferenceString = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1);
+ gd_textReferenceString.widthHint = 229;
+ textReferenceString.setLayoutData(gd_textReferenceString);
+ setControl(composite);
+ }
+
+ public File getFile() {
+ return new File(text_source.getText());
+ }
+
+ public Text getTextReferenceString() {
+ return textReferenceString;
+ }
+
+ public void setTextReferenceString(Text textReferenceString) {
+ this.textReferenceString = textReferenceString;
+ }
+
+ public URI getUri() {
+ return getFile().toURI();
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return CdmUtils.isNotBlank(text_source.getText());
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+
+import eu.etaxonomy.cdm.io.common.IImportConfigurator;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ *
+ * @author p.ciardelli
+ * @created 11.09.2009
+ * @version 1.0
+ */
+public class NomenclaturalCodeWizardPageE4 extends WizardPage {
+
+ private IImportConfigurator configurator;
+
+ @Inject
+ public NomenclaturalCodeWizardPageE4() {
+ super("Choose nomenclatural code");
+
+ this.setTitle("Choose nomenclatural code");
+
+ this.setDescription("Choose which code to use for imported names.");
+ }
+
+ public void setConfigurator(IImportConfigurator configurator) {
+ this.configurator = configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ container.setLayout(new FillLayout());
+
+ final Group group = new Group(container, SWT.NONE);
+ group.setLayout(new GridLayout());
+
+ NomenclaturalCode preferredCode = PreferencesUtil.getPreferredNomenclaturalCode(false);
+
+ // set preferred code as default
+ configurator.setNomenclaturalCode(preferredCode);
+
+ for (final NomenclaturalCode code : NomenclaturalCodeHelper.getSupportedCodes()) {
+ Button button = new Button(group, SWT.RADIO);
+ button.setText(NomenclaturalCodeHelper.getDescription(code));
+ button.setData(code);
+ button.setSelection(preferredCode.equals(code));
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setNomenclaturalCode((NomenclaturalCode) e.widget.getData());
+ }
+ });
+ }
+ setControl(container);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.abcd;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ *
+ * @author pplitzner
+ *
+ */
+public class AbcdImportConfiguratorWizardPageE4 extends WizardPage {
+
+ public static final String PAGE_NAME = "AbcdImportConfiguratorWizardPage";
+
+ private Abcd206ImportConfigurator configurator;
+
+ @Inject
+ public AbcdImportConfiguratorWizardPageE4() {
+ super(PAGE_NAME);
+ setTitle("Configure import parameters");
+ setDescription("Tooltips will explain parameters in more detail");
+ }
+
+// protected AbcdImportConfiguratorWizardPageE4(String title, String description, Abcd206ImportConfigurator configurator, boolean isPreferencePage) {
+// super(PAGE_NAME);
+// this.configurator = configurator;
+// setTitle(title);
+// setDescription(description);
+// this.isPreferencePage = isPreferencePage;
+// }
+//
+// public static AbcdImportConfiguratorWizardPageE4 createPreferencePage(Abcd206ImportConfigurator configurator){
+// return new AbcdImportConfiguratorWizardPageE4("Configure import parameters",
+// "Tooltips will explain parameters in more detail", configurator, true);
+// }
+
+
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NULL);
+ //composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
+ GridLayout gridLayout = new GridLayout();
+ composite.setLayout(gridLayout);
+// if (isPreferencePage){
+// ListComponent list = new ListComponent(composite, composite.getStyle());
+// }
+
+ Button checkBoxMediaSpecimen = new Button(composite, SWT.CHECK);
+ checkBoxMediaSpecimen.setSelection(configurator.isAddMediaAsMediaSpecimen());
+ checkBoxMediaSpecimen.setText("Import media as media specimen");
+ checkBoxMediaSpecimen
+ .setToolTipText("Any media attached to a ABCD unit will be imported as a sub derivative of the specimen created from this unit");
+ checkBoxMediaSpecimen.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setAddMediaAsMediaSpecimen(!configurator.isAddMediaAsMediaSpecimen());
+ }
+ });
+
+ Button checkBoxIgnoreExisting = new Button(composite, SWT.CHECK);
+ checkBoxIgnoreExisting.setSelection(configurator.isIgnoreImportOfExistingSpecimen());
+ checkBoxIgnoreExisting.setText("Do not import existing specimens");
+ checkBoxIgnoreExisting
+ .setToolTipText("Specimens that have previously been imported will be ignored in this import");
+ checkBoxIgnoreExisting.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setIgnoreImportOfExistingSpecimen(!configurator.isIgnoreImportOfExistingSpecimen());
+ }
+ });
+
+ Button checkBoxIgnoreAuthorship = new Button(composite, SWT.CHECK);
+ checkBoxIgnoreAuthorship.setSelection(configurator.isIgnoreAuthorship());
+ checkBoxIgnoreAuthorship.setText("Ignore Authorship for name matching");
+ checkBoxIgnoreAuthorship
+ .setToolTipText("Name matching with existing names will be done without "
+ + "the authorship part of the name");
+ checkBoxIgnoreAuthorship.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setIgnoreAuthorship(!configurator.isIgnoreAuthorship());
+ }
+ });
+
+ Button checkBoxMapUnitIdToCatalogNumber = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToCatalogNumber.setSelection(configurator.isMapUnitIdToCatalogNumber());
+ checkBoxMapUnitIdToCatalogNumber.setText("Map UnitID to catalog number");
+ checkBoxMapUnitIdToCatalogNumber
+ .setToolTipText("The UnitID of every ABCD unit will be mapped the catalog number "
+ + "of the specimen");
+ checkBoxMapUnitIdToCatalogNumber.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToCatalogNumber(!configurator.isMapUnitIdToCatalogNumber());
+ }
+ });
+//TODO: only one of the mappings can be checked!
+ Button checkBoxMapUnitIdToAccessionNumber = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToAccessionNumber.setSelection(configurator.isMapUnitIdToAccessionNumber());
+ checkBoxMapUnitIdToAccessionNumber.setText("Map UnitID to accession number");
+ checkBoxMapUnitIdToAccessionNumber
+ .setToolTipText("The UnitID of every ABCD unit will be mapped the accession number "
+ + "of the specimen");
+ checkBoxMapUnitIdToAccessionNumber.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToAccessionNumber(!configurator.isMapUnitIdToAccessionNumber());
+ }
+ });
+
+ Button checkBoxMapUnitIdToBarcode = new Button(composite, SWT.CHECK);
+ checkBoxMapUnitIdToBarcode.setSelection(configurator.isMapUnitIdToBarcode());
+ checkBoxMapUnitIdToBarcode.setText("Map UnitID to barcode");
+ checkBoxMapUnitIdToBarcode
+ .setToolTipText("The UnitID of every ABCD unit will be mapped the barcode "
+ + "of the specimen");
+ checkBoxMapUnitIdToBarcode.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMapUnitIdToBarcode(!configurator.isMapUnitIdToBarcode());
+ }
+ });
+
+ Button checkBoxRemoveCountry = new Button(composite, SWT.CHECK);
+ checkBoxRemoveCountry.setSelection(configurator.isRemoveCountryFromLocalityText());
+ checkBoxRemoveCountry.setText("Remove country from locality text");
+ checkBoxRemoveCountry
+ .setToolTipText("If the locality text contains information about the "
+ + "country which is additionally stored in other ABCD "
+ + "elements then it is removed from the locality text");
+ checkBoxRemoveCountry.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setRemoveCountryFromLocalityText(!configurator.isRemoveCountryFromLocalityText());
+ }
+ });
+
+ Button checkBoxMoveToDefaultClassification = new Button(composite, SWT.CHECK);
+ checkBoxMoveToDefaultClassification.setSelection(configurator.isMoveNewTaxaToDefaultClassification());
+ checkBoxMoveToDefaultClassification.setText("Create new classification for new taxa");
+ checkBoxMoveToDefaultClassification
+ .setToolTipText("For taxa that do not exist in the data base "
+ + "a new classification will be created");
+ checkBoxMoveToDefaultClassification.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setMoveNewTaxaToDefaultClassification(!configurator.isMoveNewTaxaToDefaultClassification());
+ }
+ });
+
+ Button checkBoxImportSiblings = new Button(composite, SWT.CHECK);
+ checkBoxImportSiblings.setSelection(configurator.isGetSiblings());
+ checkBoxImportSiblings.setText("Import all children of cultures or tissue samples");
+ checkBoxImportSiblings
+ .setToolTipText("For a tissue sample or culture all children will be searched and imported");
+ checkBoxImportSiblings.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setGetSiblings(checkBoxImportSiblings.getSelection());
+ }
+ });
+
+ Button checkBoxAddIndividualsAssociations = new Button(composite, SWT.CHECK);
+ checkBoxAddIndividualsAssociations.setSelection(configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ checkBoxAddIndividualsAssociations.setText("Create an Individual Association for each Specimen");
+ checkBoxAddIndividualsAssociations
+ .setToolTipText("For each specimen associated to a taxon an indiviadual association to this taxon is created");
+ checkBoxAddIndividualsAssociations.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(!configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ }
+ });
+
+ Button checkBoxReuseDescriptiveGroups = new Button(composite, SWT.CHECK);
+ checkBoxReuseDescriptiveGroups.setSelection(configurator.isReuseExistingDescriptiveGroups());
+ checkBoxReuseDescriptiveGroups.setText("Reuse existing descriptive group");
+ checkBoxReuseDescriptiveGroups
+ .setToolTipText("Reuse one of the existing descriptive groups or create a new one for every import");
+ checkBoxReuseDescriptiveGroups.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setReuseExistingDescriptiveGroups(!configurator.isReuseExistingDescriptiveGroups());
+ }
+ });
+
+ Button checkBoxReuseExistingTaxa = new Button(composite, SWT.CHECK);
+ checkBoxReuseExistingTaxa.setSelection(configurator.isReuseExistingTaxaWhenPossible());
+ checkBoxReuseExistingTaxa.setText("Reuse existing taxa when possible");
+ checkBoxReuseExistingTaxa
+ .setToolTipText("Reuse existing taxa when the name matches the identified name of the specimen");
+ checkBoxReuseExistingTaxa.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ configurator.setReuseExistingTaxaWhenPossible(!configurator.isReuseExistingTaxaWhenPossible());
+ }
+ });
+
+
+ setControl(composite);
+ }
+
+ public void saveConfigToPrefernceStore() {
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS,
+ configurator.isAddIndividualsAssociationsSuchAsSpecimenAndObservations());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN,
+ configurator.isAddMediaAsMediaSpecimen());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS,
+ configurator.isAllowReuseOtherClassifications());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS,
+ configurator.isDeduplicateClassifications());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES,
+ configurator.isDeduplicateReferences());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS,
+ configurator.isGetSiblings());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP,
+ configurator.isIgnoreAuthorship());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN,
+ configurator.isIgnoreImportOfExistingSpecimen());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER,
+ configurator.isMapUnitIdToAccessionNumber());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE,
+ configurator.isMapUnitIdToBarcode());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER,
+ configurator.isMapUnitIdToCatalogNumber());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION,
+ configurator.isMoveNewTaxaToDefaultClassification());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_OVERWRITE_EXISTING_SPECIMEN,
+ configurator.isOverwriteExistingSpecimens());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS,
+ configurator.isReuseExistingDescriptiveGroups());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_META_DATA,
+ configurator.isReuseExistingMetaData());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE,
+ configurator.isReuseExistingTaxaWhenPossible());
+
+ }
+
+ public String createConfigString(){
+ return configurator.toString();
+
+ }
+
+ public void setConfigurator(Abcd206ImportConfigurator configurator) {
+ this.configurator = configurator;
+ }
+
+ protected IPreferenceStore doGetPreferenceStore() {
+ return PreferencesUtil.getPreferenceStore();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.abcd;
+
+import java.io.File;
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class AbcdImportWizardE4 extends AbstractImportWizardE4<Abcd206ImportConfigurator> {
+
+ private Abcd206ImportConfigurator configurator;
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+ private ClassificationChooserWizardPageE4 classificationChooserWizardPage;
+
+ @Inject
+ public AbcdImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Abcd206ImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+
+ if(classificationChooserWizardPage.getClassification()!=null){
+ configurator.setClassificationUuid(classificationChooserWizardPage.getClassification().getUuid());
+ }
+
+ CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+
+ return true;
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = PreferencesUtil.getAbcdImportConfigurationPreference(true);
+ }
+
+ @Override
+ protected void addConfiguratorPage() {
+ AbcdImportConfiguratorWizardPageE4 configuratorWizardPage = ContextInjectionFactory.make(AbcdImportConfiguratorWizardPageE4.class, context);//AbcdImportConfiguratorWizardPage.createPage(configurator);
+ configuratorWizardPage.setConfigurator(configurator);
+ addPage(configuratorWizardPage);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+
+ classificationChooserWizardPage = ContextInjectionFactory.make(ClassificationChooserWizardPageE4.class, context);
+
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+
+ addPage(classificationChooserWizardPage);
+ addPage(dataSourcePage);
+
+ super.addPages();
+
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.abcd;
+
+import javax.inject.Inject;
+
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.ResourceManager;
+
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
+
+/**
+ * <p>ImportFromFileDataSourceWizardPage class.</p>
+ *
+ * @author n.hoffmann
+ * @created 04.08.2009
+ * @version 1.0
+ */
+public class ClassificationChooserWizardPageE4 extends WizardPage implements Listener{
+
+ public static final String PAGE_NAME = "ClassificationChooserWizardPage";
+
+ //classification
+ private Text textClassification;
+ private Classification classification;
+ private Button btnBrowseClassification;
+
+ private Button btnClear;
+
+ @Inject
+ public ClassificationChooserWizardPageE4() {
+ super(PAGE_NAME);
+
+ setTitle("Configure import destinations");
+
+ setDescription("Note: Selecting no classification will create a default one.");
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void createControl(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NULL);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 4;
+ composite.setLayout(gridLayout);
+
+ //classification
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Classification");
+ textClassification = new Text(composite, SWT.NONE);
+ textClassification.setEnabled(false);
+ textClassification.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ btnBrowseClassification = new Button(composite, SWT.NONE);
+ btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+ btnBrowseClassification.addListener(SWT.Selection, this);
+ btnClear = new Button(composite, SWT.NONE);
+ btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+ btnClear.addListener(SWT.Selection, this);
+
+ setControl(composite);
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ if(event.widget==btnBrowseClassification){
+ classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, getShell(), null, null);
+ if(classification!=null){
+ textClassification.setText(classification.getTitleCache());
+ }
+ }
+ else if(event.widget==btnClear){
+ classification = null;
+ textClassification.setText("");
+ }
+ }
+
+ /**
+ * @return the classification
+ */
+ public Classification getClassification() {
+ return classification;
+ }
+
+}
--- /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.io.e4.in.abcd;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenAbcdImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return AbcdImportWizardE4.class;
+ }
+
+}
--- /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.io.e4.in.excel.distribution;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.distribution.excelupdate.ExcelDistributionUpdateConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileAndChooseVocIdWizardPageE4;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 03.05.2017
+ *
+ */
+public class ExcelDistributionUpdateWizardE4 extends AbstractImportWizardE4<ExcelDistributionUpdateConfigurator> {
+
+
+ private ExcelDistributionUpdateConfigurator configurator;
+
+ private ImportFromFileAndChooseVocIdWizardPageE4 dataSourcePage;
+
+ private static final Logger logger = Logger.getLogger(ExcelDistributionUpdateWizardE4.class);
+
+ @Inject
+ public ExcelDistributionUpdateWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public ExcelDistributionUpdateConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ // configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ File file = new File(source);
+ FileInputStream fis = null;
+
+ try {
+ fis = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ logger.error("Error while reading file" + source.toString());
+ }
+ try {
+ configurator.setStream(IOUtils.toByteArray(fis));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ UUID vocUuid = dataSourcePage.getVocUuid();
+
+ configurator.setAreaVocabularyUuid(vocUuid);
+ //CdmStore.getImportManager().runMoniteredOperation(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM);
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator);
+ CdmStore.getImportManager().run(job);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = CdmStore.getImportManager().ExcelDistributionUpdateConfigurator();
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ addDataSourcePage();
+ addConfiguratorPage();
+
+ }
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setIgnoreNull");
+ ignoreMethods.add("setInteractWithUser");
+ ignoreMethods.add("setUseClassification");
+ ignoreMethods.add("setRegisterAuditing");
+ ignoreMethods.add("setDeduplicateAuthors");
+ ignoreMethods.add("setDeduplicateReferences");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, Messages.ExcelDistributionUpdateWizard_ConfiguratorWizard_label);
+ addPage(pageConfiguration);
+ }
+
+ private void addDataSourcePage(){
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileAndChooseVocIdWizardPageE4.class, context);
+ addPage(dataSourcePage);
+ }
+
+
+}
--- /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.io.e4.in.excel.distribution;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenExcelDistributionImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return ExcelDistributionUpdateWizardE4.class;
+ }
+
+}
--- /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.io.e4.in.excel.specimen;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenExcelSpecimenImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return SpecimenCdmExcelImportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.io.e4.in.excel.specimen;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.specimen.excel.in.SpecimenCdmExcelImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class SpecimenCdmExcelImportWizardE4 extends AbstractImportWizardE4<SpecimenCdmExcelImportConfigurator> {
+
+
+ private SpecimenCdmExcelImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+
+ @Inject
+ public SpecimenCdmExcelImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ @Override
+ public SpecimenCdmExcelImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = CdmStore.getImportManager().SpecimenCdmExcelImportConfigurator();
+ }
+
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+
+ CdmStore.getImportManager().run(configurator);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ dataSourcePage.setTitle("Choose Specimen CDM Excel");
+ dataSourcePage.setDescription("Please choose an xls file in the SpecimenCdmExcel format.");
+ dataSourcePage.setExtensions(new String[]{"*.xlsx", "*.xls", "*.*"});
+
+ addPage(dataSourcePage);
+ super.addPages();
+ }
+
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setIgnoreNull");
+ ignoreMethods.add("setInteractWithUser");
+ ignoreMethods.add("setUseClassification");
+ ignoreMethods.add("setRegisterAuditing");
+ ignoreMethods.add("setDeduplicateAuthors");
+ ignoreMethods.add("setDeduplicateReferences");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, Messages.ExcelSpecimenUpdateWizard_ConfiguratorWizard_label);
+ addPage(pageConfiguration);
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.excel.taxa;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class ExcelNormalExplicitTaxaImportWizardE4 extends AbstractImportWizardE4<NormalExplicitImportConfigurator>{
+
+ private NormalExplicitImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+ private static final Logger logger = Logger.getLogger(ExcelNormalExplicitTaxaImportWizardE4.class);
+
+ @Inject
+ public ExcelNormalExplicitTaxaImportWizardE4(IEclipseContext context, EPartService partService,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
+ super(context, partService, selection);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public NormalExplicitImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ configurator.setSourceReferenceTitle(dataSourcePage.getTextReferenceString().getText());
+ File file = new File(source);
+ FileInputStream fis = null;
+
+ try {
+ fis = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ logger.error("Error while reading file" + source.toString());
+ }
+ try {
+ configurator.setStream(IOUtils.toByteArray(fis));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator,file , SOURCE_TYPE.INPUTSTREAM);
+ CdmStore.getImportManager().run(job);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = CdmStore.getImportManager().NormalExplicitConfigurator();
+ if (selection instanceof TreeSelection && !selection.isEmpty()){
+ TaxonNode node = (TaxonNode)selection.getFirstElement();
+ configurator.setParentUUID(node.getTaxon().getUuid());
+ configurator.setClassificationUuid(node.getClassification().getUuid());
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ dataSourcePage.setTitle("Choose NormalExplicit");
+ dataSourcePage.setDescription("Please choose an xls file in the NormalExplicit format.");
+ dataSourcePage.setExtensions(new String[]{"*.xlsx", "*.xls", "*.*"});
+ addPage(dataSourcePage);
+ super.addPages();
+
+ }
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setIgnoreNull");
+ ignoreMethods.add("setInteractWithUser");
+ ignoreMethods.add("setUseClassification");
+ ignoreMethods.add("setRegisterAuditing");
+ ignoreMethods.add("setDeduplicateAuthors");
+ ignoreMethods.add("setDeduplicateReferences");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, Messages.ExcelTaxonUpdateWizard_ConfiguratorWizard_label);
+ addPage(pageConfiguration);
+ }
+}
--- /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.io.e4.in.excel.taxa;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenExcelTaxaImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return ExcelNormalExplicitTaxaImportWizardE4.class;
+ }
+
+}
--- /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.io.e4.in.ris;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenRisImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return RISImportWizardE4.class;
+ }
+
+}
--- /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.io.e4.in.ris;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.reference.ris.in.RisReferenceImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExcelDistributionUpdateWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 12.05.2017
+ *
+ */
+public class RISImportWizardE4 extends AbstractImportWizardE4<RisReferenceImportConfigurator>{
+
+ private RisReferenceImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+
+ private static final Logger logger = Logger.getLogger(ExcelDistributionUpdateWizard.class);
+
+ @Inject
+ public RISImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public RisReferenceImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ File file = new File(source);
+ FileInputStream fis;
+
+ try {
+ fis = new FileInputStream(file);
+ byte[] data;
+ data = IOUtils.toByteArray(fis);
+ configurator.setStream(data);
+//TODO: workaround, needs to be changed to source as byte array
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, data, SOURCE_TYPE.INPUTSTREAM);
+ CdmStore.getImportManager().run(job);
+ } catch (FileNotFoundException e) {
+ logger.error("Error while reading file" + source.toString());
+ } catch (IOException e){
+
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = RisReferenceImportConfigurator.NewInstance();
+
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ addDataSourcePage();
+ }
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setIgnoreNull");
+ ignoreMethods.add("setInteractWithUser");
+ ignoreMethods.add("setUseClassification");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, "Ris Import");
+ addPage(pageConfiguration);
+ }
+
+ private void addDataSourcePage(){
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ dataSourcePage.setTitle("Choose Ris File");
+ dataSourcePage.setDescription("Please choose an xls file in the Distribution Update format.");
+ dataSourcePage.setExtensions(new String[]{"*.txt"});
+ addPage(dataSourcePage);
+ }
+
+}
--- /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.io.e4.in.sdd;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenSddImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return SddImportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.sdd;
+
+import java.io.File;
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.sdd.in.SDDImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class SddImportWizardE4 extends AbstractImportWizardE4<SDDImportConfigurator> {
+
+
+ private SDDImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+
+ @Inject
+ public SddImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public SDDImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public void addPages() {
+
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ dataSourcePage.setTitle("Choose File");
+ dataSourcePage.setDescription("Please choose an XML file in the SDD format.");
+ dataSourcePage.setExtensions(new String[]{"*.xml", "*.sdd"});
+
+ addPage(dataSourcePage);
+ super.addPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = CdmStore.getImportManager().SddConfigurator();
+ }
+}
--- /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.io.e4.in.tcs;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenTcsImportWizard extends AbstractOpenImportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+ return TcsImportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.in.tcs;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.tcsxml.in.TcsXmlImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPageE4;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class TcsImportWizardE4 extends AbstractImportWizardE4<TcsXmlImportConfigurator> {
+
+
+ private TcsXmlImportConfigurator configurator;
+
+ private ImportFromFileDataSourceWizardPageE4 dataSourcePage;
+
+ @Inject
+ public TcsImportWizardE4(IEclipseContext context, EPartService partService) {
+ super(context, partService);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ URI source = dataSourcePage.getUri();
+ configurator.setSource(source);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+
+ Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+ CdmStore.getImportManager().run(job);
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ configurator = CdmStore.getImportManager().TcsConfigurator();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public TcsXmlImportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ protected void addConfiguratorPage(){
+ List<String> ignoreMethods = new ArrayList<>();
+ ignoreMethods.add("setRegisterAuditing");
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initImport(getConfigurator(), ignoreMethods, Messages.TCSImportWizard_ConfiguratorWizard_label);
+ addPage(pageConfiguration);
+ }
+
+
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPageE4.class, context);
+ addPage(dataSourcePage);
+ super.addPages();
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.out;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+
+import eu.etaxonomy.cdm.io.common.IIoConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.GenericConfiguratorWizardPageE4;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 6, 2017
+ *
+ * @param <CONFIG>
+ */
+public abstract class AbstractExportWizardE4<CONFIG extends IIoConfigurator> extends Wizard {
+
+ protected final String CONFIGURATION_PAGE = "CONFIGURATION_PAGE";
+
+ private GenericConfiguratorWizardPageE4 pageConfiguration;
+
+ protected IStructuredSelection selection;
+
+ private IEclipseContext context;
+
+ public AbstractExportWizardE4(IEclipseContext context) {
+ this(context, null);
+ }
+
+ public AbstractExportWizardE4(IEclipseContext context, IStructuredSelection selection) {
+ this.context = context;
+ this.selection = selection;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ pageConfiguration = ContextInjectionFactory.make(GenericConfiguratorWizardPageE4.class, context);
+ pageConfiguration.initExport(getConfigurator(), null);
+ this.addPage(pageConfiguration);
+ }
+
+ public abstract void init();
+
+ public abstract CONFIG getConfigurator();
+}
--- /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.io.e4.out;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public abstract class AbstractOpenExportWizard {
+
+ @Execute
+ public void execute(IEclipseContext ctx, Shell s)
+ {
+ AbstractExportWizardE4 wizard = ContextInjectionFactory.make(getExportWizardClass(), ctx);
+ wizard.init();
+ WizardDialog dialog = new WizardDialog(s, wizard);
+ dialog.open();
+ }
+
+ protected abstract Class<? extends AbstractExportWizardE4> getExportWizardClass();
+
+}
\ No newline at end of file
--- /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.io.e4.out.cdmlight;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
+import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @date 21.03.2017
+ *
+ */
+public class CdmLightExportWizardE4 extends
+AbstractExportWizardE4<CdmLightExportConfigurator> {
+
+
+ private CdmLightExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ @Inject
+ public CdmLightExportWizardE4(IEclipseContext context,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
+ super(context, selection);
+ }
+
+ @Override
+ public void init() {
+ configurator = new CdmLightExportConfigurator(null);
+ if (selection instanceof TreeSelection && !selection.isEmpty()){
+ TaxonNode node = (TaxonNode)selection.getFirstElement();
+ if (node.getParent() == null){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(node.getClassification().getUuid()));
+ }else{
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewSubtreeInstance(node.getUuid()));
+ }
+
+ }
+ }
+
+
+ @Override
+ public CdmLightExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator;
+ //+ page.getExportFileName();
+
+ final Combo combo = page.getCombo();
+ final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+ if(combo != null){
+ int selectionIndex = combo.getSelectionIndex();
+ HashSet<UUID> set = new HashSet<UUID>();
+ if(selectionIndex == -1){
+ for(Classification c:listClassifications){
+ set.add(c.getUuid());
+ }
+ }else{
+ for(Classification c:listClassifications){
+ if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
+ set.add(c.getUuid());
+
+ if (!page.getCheckUseSelectedTaxonNode()){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(c.getUuid()));
+ }
+ }
+ }
+
+
+ }
+ }
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, urlString);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+ PreferencesUtil.getPreferenceStore().setValue("exportFolder", page.getFolderText());
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ //standard page
+ page = ExportToFileDestinationWizardPage.OutputModel(configurator);
+
+ addPage(page);
+ super.addPages();
+ }
+
+}
--- /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.io.e4.out.cdmlight;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenCdmLightExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return CdmLightExportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.io.e4.out.csv;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author a.oppermann
+ * @created Nov. 11, 2014
+ * @version 1.0
+ */
+public class CsvExportWizardE4 extends AbstractExportWizardE4<CsvDemoExportConfigurator> {
+
+ private CsvDemoExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ @Inject
+ public CsvExportWizardE4(IEclipseContext context) {
+ super(context);
+ }
+ @Override
+ public void init() {
+ configurator = CsvDemoExportConfigurator.NewInstance(null, null);
+ }
+
+ @Override
+ public CsvDemoExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator
+ + page.getExportFileName();
+
+ final Combo combo = page.getCombo();
+ final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+ if(combo != null){
+ int selectionIndex = combo.getSelectionIndex();
+ HashSet<UUID> set = new HashSet<UUID>();
+ if(selectionIndex == -1){
+ for(Classification c:listClassifications){
+ set.add(c.getUuid());
+ }
+ }else{
+ for(Classification c:listClassifications){
+ if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
+ set.add(c.getUuid());
+ }
+ }
+ configurator.setClassificationUuids(set);
+ configurator.setDoTaxa(true);
+ configurator.setHasHeaderLines(true);
+ configurator.setClassification(true);
+ configurator.setTaxonName(true);
+ configurator.setAuthor(true);
+ configurator.setRank(true);
+ configurator.setLastChange(true);
+ }
+ }
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ //TODO create page with drop down menu for export for single classification.
+// super.addPages();
+
+
+ //standard page
+ page = ExportToFileDestinationWizardPage.Csv(configurator);
+
+ addPage(page);
+ }
+}
--- /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.io.e4.out.csv;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenCsvExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return CsvExportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.io.e4.out.csv.name;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @created Apr. 12, 2015
+ * @version 1.0
+ */
+public class CsvNameExportWizardE4 extends AbstractExportWizardE4<CsvNameExportConfigurator> {
+
+
+ protected CsvNameExportConfigurator configurator;
+ protected ExportToFileDestinationWizardPage page;
+
+ @Inject
+ public CsvNameExportWizardE4(IEclipseContext context) {
+ super(context);
+ }
+
+ @Override
+ public void init() {
+ configurator = CsvNameExportConfigurator.NewInstance(null,null);
+ configurator.setNamesOnly(true);
+ }
+
+ @Override
+ public CsvNameExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator
+ + page.getExportFileName();
+
+ final Combo combo = page.getCombo();
+ configurator.setClassificationUUID(page.getSelectedClassificationUUID());
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ //TODO create page with drop down menu for export for single classification.
+// super.addPages();
+
+
+ //standard page
+ page = ExportToFileDestinationWizardPage.CsvNames(configurator);
+
+ addPage(page);
+ }
+}
+
--- /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.io.e4.out.csv.name;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenCsvNameExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return CsvNameExportWizardE4.class;
+ }
+
+}
--- /dev/null
+package eu.etaxonomy.taxeditor.io.e4.out.csv.print;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.out.csv.name.CsvNameExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class CsvPrintExportWizardE4 extends CsvNameExportWizardE4{
+
+ @Inject
+ public CsvPrintExportWizardE4(IEclipseContext context) {
+ super(context);
+ }
+
+ @Override
+ public void init() {
+ configurator = CsvNameExportConfigurator.NewInstance(null,null);
+ configurator.setNamesOnly(false);
+ }
+
+ @Override
+ public CsvNameExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public void addPages() {
+ //TODO create page with drop down menu for export for single classification.
+// super.addPages();
+
+
+ //standard page
+ page = ExportToFileDestinationWizardPage.CsvPrint(configurator);
+
+ addPage(page);
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator
+ + page.getExportFileName();
+
+ configurator.setClassificationUUID(page.getSelectedClassificationUUID());
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, new File(urlString));
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ return true;
+ }
+
+}
--- /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.io.e4.out.csv.print;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenCsvPrintExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return CsvPrintExportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+ * Copyright (C) 2007 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.io.e4.out.dwca;
+
+import java.io.File;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeSelection;
+
+import eu.etaxonomy.cdm.filter.TaxonNodeFilter;
+import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 6, 2017
+ *
+ */
+public class DarwinCoreArchiveExportWizardE4 extends
+ AbstractExportWizardE4<DwcaTaxExportConfigurator> {
+
+ private DwcaTaxExportConfigurator configurator;
+ private ExportToFileDestinationWizardPage page;
+
+ @Inject
+ public DarwinCoreArchiveExportWizardE4(IEclipseContext context,
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection) {
+ super(context, selection);
+ }
+
+ @Override
+ public void init() {
+ configurator = DwcaTaxExportConfigurator.NewInstance(null, null, null);
+ if (selection instanceof TreeSelection && !selection.isEmpty()){
+ TaxonNode node = (TaxonNode)selection.getFirstElement();
+ if (node.getParent() == null){
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewClassificationInstance(node.getClassification().getUuid()));
+ }else{
+ configurator.setTaxonNodeFilter(TaxonNodeFilter.NewSubtreeInstance(node.getUuid()));
+ }
+
+ }
+ }
+
+ @Override
+ public DwcaTaxExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ @Override
+ public boolean performFinish() {
+ String urlString = page.getFolderText() + File.separator
+ + page.getExportFileName();
+
+
+ CdmStore.getExportManager().runMoniteredOperation(configurator, urlString);
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ page = ExportToFileDestinationWizardPage.Dwca(configurator);
+ addPage(page);
+ super.addPages();
+ }
+}
--- /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.io.e4.out.dwca;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenDwcaExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return DarwinCoreArchiveExportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.out.jaxb;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 6, 2017
+ *
+ */
+public class JaxbExportWizardE4 extends AbstractExportWizardE4<JaxbExportConfigurator> {
+
+ private ExportToFileDestinationWizardPage page;
+
+ private JaxbExportConfigurator configurator;
+
+ @Inject
+ public JaxbExportWizardE4(IEclipseContext context) {
+ super(context);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ this.setWindowTitle("JAXB Export");
+ this.configurator = CdmStore.getExportManager().JaxbConfigurator();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ boolean performFinish = false;
+
+ File exportFile = new File(page.getFolderText() + File.separator + page.getExportFileName());
+
+ configurator.setDestination(exportFile);
+
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, exportFile);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ performFinish = true;
+ return performFinish;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ page = ExportToFileDestinationWizardPage.Jaxb(configurator);
+ addPage(page);
+ super.addPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public JaxbExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+
+}
--- /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.io.e4.out.jaxb;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenJaxbExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return JaxbExportWizardE4.class;
+ }
+
+}
--- /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.io.e4.out.sdd;
+
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractOpenExportWizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 5, 2017
+ *
+ */
+public class OpenSddExportWizard extends AbstractOpenExportWizard {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<? extends AbstractExportWizardE4> getExportWizardClass() {
+ return SddExportWizardE4.class;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.io.e4.out.sdd;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.ui.progress.IProgressConstants;
+
+import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.out.AbstractExportWizardE4;
+import eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 6, 2017
+ *
+ */
+public class SddExportWizardE4 extends AbstractExportWizardE4<SDDExportConfigurator> {
+
+ private ExportToFileDestinationWizardPage page;
+
+ private SDDExportConfigurator configurator;
+
+ @Inject
+ public SddExportWizardE4(IEclipseContext context) {
+ super(context);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public SDDExportConfigurator getConfigurator() {
+ return configurator;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ File file = new File(page.getFolderText() + File.separator + page.getExportFileName());
+ // create job
+ Job job = CdmStore.getExportManager().createIOServiceJob(configurator, file);
+ // configure the job
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
+ job.setUser(true);
+ // schedule job
+ job.schedule();
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ page = ExportToFileDestinationWizardPage.Sdd(configurator);
+ addPage(page);
+ super.addPages();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void init() {
+ this.setWindowTitle("SDD Export");
+ this.configurator = CdmStore.getExportManager().SddConfigurator();
+ }
+}
package eu.etaxonomy.taxeditor.io.wizard;
-import java.awt.Checkbox;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
import eu.etaxonomy.cdm.io.csv.caryophyllales.out.CsvNameExportConfigurator;
import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
-import eu.etaxonomy.cdm.io.csv.redlist.out.CsvTaxExportConfiguratorRedlist;
import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
import eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator;
import eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator;
public static final String CSV = "csv";
-
-
public static final String ZIP = "zip";
private boolean csvExport = false;
private boolean csvNameExport = false;
-
-
private boolean csvPrintExport = false;
private boolean outputModelExport = false;
private List<Classification> classifications;
private Classification selectedClassification;
+
private Label classificationLabel;
-
+
private ExportConfiguratorBase configurator;
private Button checkUseSelectedtaxonNode;
private Button checkUseSelectedClassification;
- /**
- * @param pageName
- * @param selection
- */
protected ExportToFileDestinationWizardPage(String pageName, String type,
String title, String description, String extension, ExportConfiguratorBase configurator) {
super(pageName);
case DWCA_EXPORT:
dwcaExport = true;
break;
-
+
}
this.extension = extension;
this.setTitle(title);
this.setDescription(description);
}
- /**
- * <p>
- * Jaxb
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
- * object.
- */
public static ExportToFileDestinationWizardPage Jaxb(JaxbExportConfigurator configurator) {
return new ExportToFileDestinationWizardPage(
JAXB_EXPORT,
XML, configurator);
}
- /**
- * <p>
- * Tcs
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
- * object.
- */
public static ExportToFileDestinationWizardPage Tcs(TcsXmlExportConfigurator config) {
return new ExportToFileDestinationWizardPage(
TCS_EXPORT,
XML, config);
}
- /**
- * <p>
- * Sdd
- * </p>
- *
- * @return a
- * {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
- * object.
- */
public static ExportToFileDestinationWizardPage Sdd(SDDExportConfigurator config) {
return new ExportToFileDestinationWizardPage(
SDD_EXPORT,
XML, config);
}
- /**
- * @return
- */
public static ExportToFileDestinationWizardPage Dwca(DwcaTaxExportConfigurator config) {
return new ExportToFileDestinationWizardPage(
DWCA_EXPORT,
ZIP, config);
}
- /**
- * @return
- */
public static ExportToFileDestinationWizardPage OutputModel(CdmLightExportConfigurator config) {
-
+
return new ExportToFileDestinationWizardPage(
OUTPUT_MODEL_EXPORT,
OUTPUT_MODEL_EXPORT,
CSV,config);
}
-
- /**
- * @return
- */
public static ExportToFileDestinationWizardPage Csv(CsvDemoExportConfigurator config) {
-
+
return new ExportToFileDestinationWizardPage(
CSV_EXPORT,
CSV_EXPORT,
CSV, config);
}
- /**
- * @return
- */
public static ExportToFileDestinationWizardPage CsvNames(CsvNameExportConfigurator config) {
-
+
return new ExportToFileDestinationWizardPage(
CSV_NAME_EXPORT,
CSV_NAME_EXPORT,
CSV, config);
}
- /**
- * @return
- */
public static ExportToFileDestinationWizardPage CsvPrint(CsvNameExportConfigurator config) {
-
+
return new ExportToFileDestinationWizardPage(
CSV_PRINT_EXPORT,
CSV_NAME_EXPORT,
CSV, config);
}
- /*
- * (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.NONE);
GridLayout gridLayout = new GridLayout();
-
+
gridLayout.numColumns = 2;
TaxonNode node = null;
-
+
composite.setLayout(gridLayout);
if(classifications == null){
classifications = CdmStore.getService(IClassificationService.class).list(null, null, null, null, null);
if (!configurator.getTaxonNodeFilter().getClassificationFilter().isEmpty()){
selectedClassification = CdmStore.getService(IClassificationService.class).load(configurator.getTaxonNodeFilter().getClassificationFilter().get(0).getUuid());
}else{
-
+
selectedClassification = classifications.iterator().next();
}
}
if(csvExport || csvPrintExport || outputModelExport|| csvNameExport || dwcaExport){
+
// Label comboBoxLabel = new Label(composite, SWT.NONE);
// comboBoxLabel.setText("Classification");
-
+ Composite selectNodeOrClassification = new Composite(composite, SWT.NONE);
+ GridLayout grid = new GridLayout();
+ grid.numColumns = 1;
+ selectNodeOrClassification.setLayout(grid);
if ((outputModelExport || dwcaExport)&& !configurator.getTaxonNodeFilter().getSubtreeFilter().isEmpty()){
- Composite selectNodeOrClassification = new Composite(composite, SWT.NONE);
- GridLayout grid = new GridLayout();
- grid.numColumns = 1;
- selectNodeOrClassification.setLayout(grid);
checkUseSelectedtaxonNode= new Button(selectNodeOrClassification, SWT.RADIO);
String taxonStr = "";
node = CdmApplicationState.getCurrentAppConfig().getTaxonNodeService().load(configurator.getTaxonNodeFilter().getSubtreeFilter().get(0).getUuid());
GridData data = (GridData) classificationSelectionCombo.getLayoutData();
data.exclude = b.getSelection();
classificationSelectionCombo.setVisible(!data.exclude);
- classificationLabel.setVisible(!data.exclude);
+
}
});
checkUseSelectedtaxonNode.setSelection(true);
GridData data = (GridData) classificationSelectionCombo.getLayoutData();
data.exclude = b.getSelection();
classificationSelectionCombo.setVisible(data.exclude);
- classificationLabel.setVisible(data.exclude);
+
}
});
}
if (node!= null){
selectedClassification = node.getClassification();
}
- createClassificationSelectionCombo(composite);
-
- classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
- true, false, 2, 1));
+ createClassificationSelectionCombo(selectNodeOrClassification);
+
+
+
if (checkUseSelectedtaxonNode != null){
-
+
if (checkUseSelectedtaxonNode.getSelection()){
classificationSelectionCombo.setVisible(false);
- classificationLabel.setVisible(false);
+
}
+ }else{
+ classificationSelectionCombo.setVisible(true);
+ classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
+ true, false, 2, 1));
}
-
-
+
}
-
Label folderLabel = new Label(composite, SWT.NONE);
folderLabel.setText("Select Folder for exported files");
button.setText("Browse...");
button.addSelectionListener(new SelectionAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
- * .swt.events.SelectionEvent)
- */
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
}
});
if (!outputModelExport){
-
+
Label fileLabel = new Label(composite, SWT.NONE);
fileLabel.setText("File");
text_exportFileName = new Text(composite, SWT.BORDER);
return buffer.toString();
}
- /**
- * <p>
- * getExportFileName
- * </p>
- *
- * @return the exportFileName
- */
public String getExportFileName() {
return text_exportFileName.getText();
}
- /**
- * <p>
- * getFolderText
- * </p>
- *
- * @return the folderText
- */
public String getFolderText() {
return text_folder.getText();
}
-
- /**
- * <p>
- * getFolderComposite
- * </p>
- *
- * @return the folderText
- */
+
public Text getFolderComposite() {
return text_folder;
}
private void createClassificationSelectionCombo(Composite parent){
-// classifications = CdmStore.getTaxonTreeService().list(null, null, null, null, null);
-
- Composite classificationSelection = new Composite(parent, SWT.NULL);
- classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
- GridLayout layout = new GridLayout();
- classificationSelection.setLayout(layout);
+// Composite classificationSelection = new Composite(parent, SWT.NULL);
+// classificationSelection.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
- classificationLabel = new Label(classificationSelection, SWT.NULL);
- // TODO not working is not really true but leave it here to remind everyone that this is under construction
- classificationLabel.setText("Export complete classification");
-
- classificationSelectionCombo = new Combo(classificationSelection, SWT.BORDER | SWT.READ_ONLY);
- classificationSelectionCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 2,1));
+// GridLayout layout = new GridLayout();
+// classificationSelection.setLayout(layout);
+ GridData gridData = new GridData();
+ gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
+ gridData.horizontalIndent = 5;
+// classificationSelection.setLayoutData(gridData);
+ classificationSelectionCombo = new Combo(parent, SWT.BORDER| SWT.READ_ONLY);
+ classificationSelectionCombo.setLayoutData(gridData);
for(Classification tree : classifications){
classificationSelectionCombo.add(tree.getName().getText(), classifications.indexOf(tree));
return checkUseSelectedtaxonNode.getSelection();
}
-
@Override
public boolean canFlipToNextPage() {
return getFolderText() != null;
}
-
-
-
}
public static String SetSecundumConfiguration_NewSecundum_Label;
public static String SetSecundumConfiguration_Description;
public static String SetSecundumConfiguration_Description_Configurator;
+ public static String SetSecundumConfiguration_Title;
public static String DatabasePreferncesPage_Is_redList;
public static String DatabasePreferncesPage_Determination_only_for_field_unnits;
public static String AbstractImportWizard_ConfigurationLabel;
-
+
public static String FeatureTreeEditorComposite_ADD_FEATURE;
public static String NonViralNameDetails_descriptionDeleteOfCultivarNameParts;
-
+ public static String NameDetailsViewComposite_Show_TypeDesignation;
+ public static String NameDetailsViewComposite_Show_Namerelationships;
+ public static String NameDetailsViewComposite_Show_Hybrid;
+ public static String NameDetailsViewComposite_Show_NameApprobiation;
+ public static String NameDetailsViewComposite_Show_Taxon;
+ public static String NameDetailsViewComposite_Show_LSID;
+ public static String NameDetailsViewComposite_Show_NomenclaturalCode;
+ public static String NameDetailsViewComposite_Show_NameCache;
+ public static String NameDetailsViewComposite_Show_AppendedPhrase;
+ public static String NameDetailsViewComposite_Show_Rank;
+ public static String NameDetailsViewComposite_Show_AtomisedEpithets;
+ public static String NameDetailsViewComposite_Show_AuthorCache;
+ public static String NameDetailsViewComposite_Show_Author;
+ public static String NameDetailsViewComposite_Show_NomenclaturalReference;
+ public static String NameDetailsViewComposite_Show_NomenclaturalStatus;
+ public static String NameDetailsViewComposite_Show_Protologue;
+
+ public static String NameDetailsViewConfiguration_activateSimpleDetailsView;
+ public static String NameDetailsViewConfiguration_useLocalSettings;
+
+
+ public static String SetPublishConfiguration_Publish;
+ public static String SetPublishConfiguration_Publish_tooltip;
+ public static String SetPublishConfiguration_Description_Configurator;
+
+
+ public static String SetPublishConfiguration_IncludeAcceptedTaxa;
+ public static String SetPublishConfiguration_IncludeSharedtaxa;
+ public static String SetPublishConfiguration_IncludeSynonyms;
+
+
+ public static String ExcelSpecimenUpdateWizard_ConfiguratorWizard_label;
+
+
+ public static String ExcelTaxonUpdateWizard_ConfiguratorWizard_label;
+
+
+ public static String SetPublishConfiguration_Title;
+ public static String SetPublishConfiguration_publish;
+ public static String SetPublishConfiguration_dont_publish;
+
+
+ public static String TCSImportWizard_ConfiguratorWizard_label;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
SetSecundumConfiguration_NewSecundum_Label=New secundum reference:
SetSecundumConfiguration_Description=If no reference is chosen existing secundum references are deleted.
SetSecundumConfiguration_Description_Configurator=Configure how to perform the set secundum reference operation.
+SetSecundumConfiguration_Title=Configuration
DatabasePreferncesPage_Is_redList=Red List 2020
DatabasePreferncesPage_Determination_only_for_field_unnits=Determinations only for field units
ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip=Please choose a vocabulary for the used areas.
ExcelDistributionUpdateWizard_ConfiguratorWizard_label=Configure Excel distribution update
AbstractImportWizard_ConfigurationLabel=Configure the Import
+TCSImportWizard_ConfiguratorWizard_label=Konfiguration des TCS Imports
FeatureTreeEditorComposite_ADD_FEATURE=Add a feature to this feature tree.
FeatureTreeEditorComposite_FEATURE_TREE=Feature Tree
FeatureTreeEditorComposite_OPEN_TREE=Open Tree
NonViralNameDetails_confirmDeleteOfFungiNameParts=The fungi information anamorph will be lost
NonViralNameDetails_descriptionDeleteOfFungiNameParts=If you click Ok, the anamorph flag is removed and the nomenclatural code is changed.
NonViralNameDetails_confirmDeleteOfCultivarNameParts=The cultivar name needs to be removed
-NonViralNameDetails_descriptionDeleteOfCultivarNameParts=If you click Ok, the cultivar name is removed and the nomenclatural code is changed
\ No newline at end of file
+NonViralNameDetails_descriptionDeleteOfCultivarNameParts=If you click Ok, the cultivar name is removed and the nomenclatural code is changed
+
+NameDetailsViewComposite_Show_TypeDesignation=Name type designation section
+NameDetailsViewComposite_Show_Namerelationships=Name relationship section
+NameDetailsViewComposite_Show_Hybrid=Hybrid section
+NameDetailsViewComposite_Show_NameApprobiation=Name approbiation (for bacterial names)
+NameDetailsViewComposite_Show_Taxon=Taxon of the name
+NameDetailsViewComposite_Show_LSID=Lsid of the name
+NameDetailsViewComposite_Show_NomenclaturalCode=Nomenclatural code
+NameDetailsViewComposite_Show_NameCache=NameCache of the name (only the scientific name without the author and year)
+NameDetailsViewComposite_Show_AppendedPhrase=Appended phrase
+NameDetailsViewComposite_Show_Rank=Rank of the name
+NameDetailsViewComposite_Show_AtomisedEpithets=Atomised epithets
+NameDetailsViewComposite_Show_AuthorCache=Authorship cache
+NameDetailsViewComposite_Show_Author=Whole Authorship section
+NameDetailsViewComposite_Show_NomenclaturalReference=Nomenclatural reference section
+NameDetailsViewComposite_Show_NomenclaturalStatus=Nomenclatural status section
+NameDetailsViewComposite_Show_Protologue=Protologue section
+
+NameDetailsViewConfiguration_activateSimpleDetailsView=Show simplified name details view with the following elements:
+NameDetailsViewConfiguration_useLocalSettings=Use local settings for display of name details
+
+SetPublishConfiguration_Publish=Set Publish Flag
+SetPublishConfiguration_Publish_tooltip=With set publish flag, the taxa are published in data portal and print publications
+SetPublishConfiguration_Description_Configurator=Configure where the publish flag should be set
+SetPublishConfiguration_IncludeAcceptedTaxa=Accepted taxa
+SetPublishConfiguration_IncludeSharedtaxa=Shared taxa
+SetPublishConfiguration_IncludeSynonyms=Synonyms
+
+ExcelSpecimenUpdateWizard_ConfiguratorWizard_label=Configuration of excel specimen import
+ExcelTaxonUpdateWizard_ConfiguratorWizard_label=Configuration of excel taxon import
+
+SetPublishConfiguration_Title=Configuration for setting the publish flag
+SetPublishConfiguration_publish=publish
+SetPublishConfiguration_dont_publish=don't publish
SetSecundumConfiguration_NewSecundum_Label=Neue Secundum Referenz:
SetSecundumConfiguration_Description=Wenn keine Referenz ausgewählt wird, werden die bestehenden Secundum Referenzen gelöscht.
SetSecundumConfiguration_Description_Configurator=Konfigurieren Sie, wie das Ersetzen der Secundum Referenz durchgeführt werden soll.
+SetSecundumConfiguration_Title=Konfiguration
DatabasePreferncesPage_Is_redList=Rote Liste 2020
DatabasePreferncesPage_Determination_only_for_field_unnits=Determinations nur für Field Units
DatabasePreferencesPage_Specimen_Or_Observation=Belege und Observationen
DatabasePreferencesPage_SetPublishFlag=Konfiguriere das Handling des Publish Flags bei neuen Taxa
-ImportFromFileAndChooseVocIdWizardPage_AreaVoc=Area Vokabular
+ImportFromFileAndChooseVocIdWizardPage_AreaVoc=Gebiets Vokabular
ImportFromFileAndChooseVocIdWizardOage_AreaVoc_toolTip=Bitte wählen Sie ein Vokabular für die genutzten Areas aus.
ExcelDistributionUpdateWizard_ConfiguratorWizard_label=Konfiguration des Excel Distribution Updates
AbstractImportWizard_ConfigurationLabel=Konfiguration des Imports
+
+TCSImportWizard_ConfiguratorWizard_label=Konfiguration des TCS Imports
FeatureTreeEditorComposite_ADD_FEATURE=Merkmal zum Merkmalsbaum hinzufügen
FeatureTreeEditorComposite_FEATURE_TREE=Merkmalsbaum
FeatureTreeEditorComposite_OPEN_TREE=Merkmalsbaum öffnen
NonViralNameDetails_confirmDeleteOfFungiNameParts=Die Information, ob der Pilz anamorph ist, muss gelöscht werden
NonViralNameDetails_descriptionDeleteOfFungiNameParts=Bestätigen Sie, wenn Sie die Information, ob der Pilz anamorph ist, löschen und den Nomenklatorischen Code ändern wollen.
NonViralNameDetails_confirmDeleteOfCultivarNameParts=Der Cultivar Name muss gelöscht werden
-NonViralNameDetails_descriptionDeleteOfCultivarNameParts=Bestätigen Sie, wenn Sie den Cultivar Name löschen und den Nomenklatorischen Code ändern wollen.
\ No newline at end of file
+NonViralNameDetails_descriptionDeleteOfCultivarNameParts=Bestätigen Sie, wenn Sie den Cultivar Name löschen und den Nomenklatorischen Code ändern wollen.
+
+NameDetailsViewComposite_Show_TypeDesignation=Type Designations
+NameDetailsViewComposite_Show_Namerelationships=Namensrelationen
+NameDetailsViewComposite_Show_Hybrid=Hybride
+NameDetailsViewComposite_Show_NameApprobiation=Namens Approbation (für Bakterien)
+NameDetailsViewComposite_Show_Taxon=Taxon
+NameDetailsViewComposite_Show_LSID=Lsid
+NameDetailsViewComposite_Show_NomenclaturalCode=Nomenclatorischer Code
+NameDetailsViewComposite_Show_NameCache=Cache des Namens (nur der wissenschaftliche Name ohne Autor und Jahr)
+NameDetailsViewComposite_Show_AppendedPhrase=Appended phrase
+NameDetailsViewComposite_Show_Rank=Rang
+NameDetailsViewComposite_Show_AtomisedEpithets=Atomisierte Epithete
+NameDetailsViewComposite_Show_AuthorCache=Autoren Cache
+NameDetailsViewComposite_Show_Author=Alle Autoreninformationen
+NameDetailsViewComposite_Show_NomenclaturalReference=Nomenklatorische Referenz
+NameDetailsViewComposite_Show_NomenclaturalStatus=Nomenklatorischer Status
+NameDetailsViewComposite_Show_Protologue=Protologue
+
+NameDetailsViewConfiguration_activateSimpleDetailsView=Zeige vereinfachten Details view mit folgenden Elementen:
+NameDetailsViewConfiguration_useLocalSettings=Verwende die lokalen Eigenschaften für die Darstellung der Details
+
+SetPublishConfiguration_Publish=Setze das Publish Flag
+SetPublishConfiguration_Publish_tooltip=Wenn das Publish Flag gesetzt ist, werden die Taxa veröffentlicht, sowohl im Datenportal als auch bei Print Publikationen
+
+SetPublishConfiguration_Description_Configurator=Konfigurieren Sie, wie das Setzen des Publish Flags durchgeführt werden soll.
+SetPublishConfiguration_IncludeAcceptedTaxa=Akzeptierte Taxa
+SetPublishConfiguration_IncludeSharedtaxa=Mehrfach verwendete Taxa mit einbeziehen
+SetPublishConfiguration_IncludeSynonyms=Synonyme
+
+ExcelSpecimenUpdateWizard_ConfiguratorWizard_label=Konfiguration des Excel Specimen Imports
+ExcelTaxonUpdateWizard_ConfiguratorWizard_label=Konfiguration des Excel Taxon Imports
+
+SetPublishConfiguration_Title=Konfiguration zum Setzen des Publish Flags
+SetPublishConfiguration_publish=veröffentlichen
+SetPublishConfiguration_dont_publish=nicht veröffentlichen
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.ICoreRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
-import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.progress.IProgressConstants;
-import org.eclipse.ui.progress.IProgressService;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
-import org.eclipse.ui.themes.ITheme;
-import org.eclipse.ui.themes.IThemeManager;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
import eu.etaxonomy.cdm.io.common.ExportResult;
import eu.etaxonomy.cdm.io.common.ExportResultType;
import eu.etaxonomy.cdm.io.common.ExportType;
-import eu.etaxonomy.cdm.io.dwca.out.DwcaTaxExportConfigurator;
import eu.etaxonomy.cdm.model.common.IEnumTerm;
+import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
import eu.etaxonomy.taxeditor.operation.IPostMoniteredOperationEnabled;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.operation.RemotingCdmHandler;
+import eu.etaxonomy.taxeditor.operation.e4.RemotingCdmHandlerE4;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.ReportTextDialog;
-import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
+import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
/**
*
/** Constant <code>DATE_FORMAT_NOW="yyyyMMddHHmm"</code> */
public static final String DATE_FORMAT_NOW = "yyyyMMddHHmm";
- public static boolean closeAll() {
- if(getActivePage()!=null){
- return getActivePage().closeAllEditors(true);
- }
- return false;
- }
-
- /**
- * Close the given editor.
- *
- * @param editor
- * The <tt>MultipageTaxonEditor</tt> to close.
- * @return <tt>true</tt> on success
- */
- public static boolean close(EditorPart editor) {
- return getActivePage() != null ? getActivePage().closeEditor(editor, true):false;
- }
-
- public static Shell getShell() {
-
- return TaxeditorStorePlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getShell();
- }
-
- public static IWorkbenchPage getActivePage() {
- try{
- return TaxeditorStorePlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- } catch(NullPointerException npe){
- return null;
- }
- }
-
- public static IWorkbenchPart getActiveWorkbenchPart() {
- IWorkbenchPage activePage = getActivePage();
- if(activePage!=null){
- IWorkbenchPart activePart = activePage.getActivePart();
- if(activePart!=null){
- return activePart;
- }
+ public static Object getActivePart() {
+ MPart activePart = EventUtility.getActivePart();
+ if(activePart!=null){
+ return activePart.getObject();
}
return null;
}
- public static Object getActiveE4Part() {
- IWorkbenchPage activePage = getActivePage();
- if(activePage!=null){
- IWorkbenchPart activePart = activePage.getActivePart();
- Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
- return e4WrappedPart!=null?e4WrappedPart:activePart;
- }
- return null;
+ public static Shell getShell() {
+ return EventUtility.getShell();
}
public static IWorkbench getWorkbench() {
return TaxeditorStorePlugin.getDefault().getWorkbench();
}
- public static IWorkbenchWindow getWorkbenchWindow() {
- if (getWorkbench().getWorkbenchWindowCount() > 1) {
- throw new IllegalStateException("More than one workbench window");
- }
- return getWorkbench().getWorkbenchWindows()[0];
- }
-
- public static IViewPart showView(String id) {
- try {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage()
- .showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
- } catch (PartInitException e) {
- MessagingUtils.messageDialog("Error opening view", AbstractUtility.class, "Could not open view: " + id, e);
- return null;
- }
- }
-
- public static void hideView(IViewPart view) {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .hideView(view);
- }
-
- public static IViewPart getView(String id, boolean restore) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
- IViewReference[] references = null;
- if(activeWorkbenchWindow!=null && activeWorkbenchWindow.getActivePage()!=null){
- references = activeWorkbenchWindow.getActivePage().getViewReferences();
- }
- else if(workbench.getWorkbenchWindows().length>0 && workbench.getWorkbenchWindows()[0].getActivePage()!=null){
- references = workbench.getWorkbenchWindows()[0].getActivePage().getViewReferences();
- }
- if(references!=null){
- for (IViewReference reference : references) {
- if (reference.getId().equals(id)) {
- return reference.getView(restore);
- }
- }
- }
- return null;
- }
-
public static Object getService(Class api) {
return TaxeditorStorePlugin.getDefault().getWorkbench().getService(api);
}
- public static ITheme getCurrentTheme() {
- IThemeManager themeManager = TaxeditorStorePlugin.getDefault()
- .getWorkbench().getThemeManager();
- return themeManager.getCurrentTheme();
- }
-
- /**
- * Fonts registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus fonts are chooseable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the FontRegistry for the current theme
- */
- public static FontRegistry getFontRegistry() {
- return getCurrentTheme().getFontRegistry();
- }
-
public static Font getFont(String symbolicName) {
- return getFontRegistry().get(symbolicName);
- }
-
- /**
- * Color registered to the plugin may be obtained with the Eclipse themeing
- * functionality. Thus colors are editable by the user via
- * Preferences->General->Appearance->Colors and Fonts
- *
- * @return the ColorRegistry for the current theme
- */
- public static ColorRegistry getColorRegistry() {
- return getCurrentTheme().getColorRegistry();
+ return FontResources.getFont(symbolicName);
}
public static Color getColor(String symbolicName) {
- return getColorRegistry().get(symbolicName);
+ return ColorResources.getColor(symbolicName);
}
- public static IStatus executeOperation(final AbstractPostOperation operation) {
+ public static IStatus executeOperation(final AbstractPostOperation operation, UISynchronize sync) {
if (getOperationHistory() == null) {
throw new IllegalArgumentException(
"There is no operation history for this context");
final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
.getUIInfoAdapter(getShell());
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
-
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
+ Job job = Job.create(operation.getLabel(), (ICoreRunnable) monitor -> {
+ sync.syncExec(() -> {
String operationlabel = operation.getLabel();
monitor.beginTask(operationlabel, 100);
IStatus status = Status.CANCEL_STATUS;
try {
operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
- status = getOperationHistory().execute(operation, monitor,
- uiInfoAdapter);
+ status = operation.execute(monitor, uiInfoAdapter);
} catch (ExecutionException e) {
- MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
+ MessagingUtils.operationDialog(AbstractUtility.class, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
} finally {
monitor.done();
String statusString = status.equals(Status.OK_STATUS) ? "completed"
: "cancelled";
setStatusLine(operationlabel + " " + statusString + ".");
-
- }
- };
+ IPostOperationEnabled postOperationEnabled = operation
+ .getPostOperationEnabled();
+ if (postOperationEnabled != null) {
+ postOperationEnabled.onComplete();
+ }
+ });
+ });
try {
- runInUI(runnable, null);
+ job.setUser(true);
+ job.schedule();
} catch (Exception e) {
MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
}
- IPostOperationEnabled postOperationEnabled = operation
- .getPostOperationEnabled();
- if (postOperationEnabled != null) {
- postOperationEnabled.onComplete();
- }
return Status.OK_STATUS;
}
- public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandler handler) {
+ public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandlerE4 handler, UISynchronize sync) {
+ return executeOperation_internal(operation, handler, sync);
+ }
+
+ public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandler handler, UISynchronize sync) {
+ return executeOperation_internal(operation, handler, sync);
+ }
+
+ private static IStatus executeOperation_internal(final AbstractOperation operation, final Object handler,
+ UISynchronize sync) {
if (getOperationHistory() == null) {
throw new IllegalArgumentException(
"There is no operation history for this context");
final IAdaptable uiInfoAdapter = WorkspaceUndoUtil
.getUIInfoAdapter(getShell());
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- @Override
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
+ Job job = Job.create(operation.getLabel(), (ICoreRunnable) monitor -> {
+ sync.syncExec(() -> {
String operationlabel = operation.getLabel();
monitor.beginTask(operationlabel, 100);
IStatus status = Status.CANCEL_STATUS;
try {
operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
- status = getOperationHistory().execute(operation, monitor,
+ status = operation.execute(monitor,
uiInfoAdapter);
- if(handler != null) {
- handler.postOperation(status);
+ if(handler instanceof RemotingCdmHandler) {
+ ((RemotingCdmHandler) handler).postOperation(status);
+ }
+ else if(handler instanceof RemotingCdmHandlerE4) {
+ ((RemotingCdmHandlerE4) handler).postOperation(status);
}
} catch (ExecutionException e) {
- MessagingUtils.operationDialog(this, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
+ MessagingUtils.operationDialog(AbstractUtility.class, e, TaxeditorStorePlugin.PLUGIN_ID, operationlabel, null);
} finally {
monitor.done();
}
String statusString = status.equals(Status.OK_STATUS) ? "completed"
: "cancelled";
setStatusLine(operationlabel + " " + statusString + ".");
-
- }
- };
+ });
+ });
try {
- runInUI(runnable, null);
+ job.setUser(true);
+ sync.syncExec(()->job.schedule());
} catch (Exception e) {
MessagingUtils.messageDialog("Error executing operation", AbstractUtility.class, "An error occured while executing " + operation.getLabel(), e);
}
final StringBuilder reportSb = new StringBuilder();
if (remotingMonitor.getResult() instanceof ExportResult){
ExportResult result = (ExportResult)remotingMonitor.getResult();
-
+
reportSb.append(result.createReport());
-
+
if(!StringUtils.isBlank(reportSb.toString())) {
Display.getDefault().asyncExec(new Runnable() {
@Override
}
});
}
-
+
if (urlString != null){
ExportDataWrapper data = result.getExportData();
try{
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
Calendar cal = Calendar.getInstance();
String fileEnding = ".csv";
-
- if (createZip){
- File file = new File(urlString+File.separator + sdf.format(cal.getTime())+ ".zip");
+
+ if (createZip){
+ File file = new File(urlString+File.separator + sdf.format(cal.getTime())+ ".zip");
FileOutputStream stream = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(stream);
for (String key: keySet){
byte[] fileData = resultMap.get(key);
- ZipEntry entry = new ZipEntry( key + fileEnding);
+ ZipEntry entry = new ZipEntry( key + fileEnding);
zos.putNextEntry(entry);
zos.write(fileData);
zos.closeEntry();
zos.close();
}else{
if(result.getExportType().equals(ExportType.DWCA)){
-
- File file = new File(urlString);
+
+ File file = new File(urlString);
FileOutputStream stream = new FileOutputStream(file);
ZipOutputStream zos = new ZipOutputStream(stream);
for (String key: keySet){
byte[] fileData = resultMap.get(key);
- ZipEntry entry = new ZipEntry( key + fileEnding);
+ ZipEntry entry = new ZipEntry( key + fileEnding);
zos.putNextEntry(entry);
zos.write(fileData);
zos.closeEntry();
newMonitor.worked(steps);
}
- /**
- * Present a progress dialog to the user. This dialog will block the UI
- *
- * @param runnable
- * an implementation of {@link IRunnableWithProgress}
- * @throws java.lang.InterruptedException
- * if any.
- * @throws java.lang.reflect.InvocationTargetException
- * if any.
- */
- public static void busyCursorWhile(IRunnableWithProgress runnable)
- throws InvocationTargetException, InterruptedException {
- getProgressService().busyCursorWhile(runnable);
- }
-
- public static void runInUI(IRunnableWithProgress runnable,
- ISchedulingRule rule) throws InvocationTargetException,
- InterruptedException {
- getProgressService().runInUI(getWorkbenchWindow(), runnable, rule);
- }
-
- public static void run(boolean fork, boolean cancelable,
- IRunnableWithProgress runnable) throws InvocationTargetException,
- InterruptedException {
- getProgressService().run(fork, cancelable, runnable);
- }
-
- public static IProgressService getProgressService() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- return workbench.getProgressService();
- }
-
- public static IWorkbenchSiteProgressService getProgressService2() {
- return (IWorkbenchSiteProgressService) getService(IWorkbenchSiteProgressService.class);
- }
-
public static String getPluginId() {
return "eu.taxeditor";
}
- public static IEditorPart getActiveEditor() {
- return getActivePage() != null ? getActivePage().getActiveEditor()
- : null;
- }
-
- public static Object getActiveE4Editor() {
- if(getActivePage()!=null){
- IEditorPart activeEditor = getActivePage().getActiveEditor();
- Object wrappedPart = WorkbenchUtility.getE4WrappedPart(getActivePage().getActivePart());
- return wrappedPart!=null?wrappedPart:activeEditor;
+ public static Object getActiveEditor() {
+ MPart activePart = EventUtility.getActivePart();
+ if(activePart!=null && activePart.getObject()!=null
+ && activePart.getObject() instanceof IE4SavablePart){
+ return activePart.getObject();
}
return null;
}
- public static DetailsViewPart getDetailsView() {
- return (DetailsViewPart) getView(DetailsViewPart.ID, false);
- }
-
- public static void refreshDetailsViewer() {
- if (getDetailsView() != null) {
- ((AbstractCdmDataViewer) getDetailsView().getViewer()).refresh();
+ public static DetailsPartE4 getDetailsView(EPartService partService) {
+ MPart part = partService.findPart("eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4");
+ if(part!=null){
+ return (DetailsPartE4) part.getObject();
}
+ return null;
}
- public static void reflowDetailsViewer() {
- if (getDetailsView() != null) {
- ((AbstractCdmDataViewer) getDetailsView().getViewer()).reflow();
+ public static void refreshDetailsViewer(EPartService partService) {
+ if (getDetailsView(partService) != null) {
+ ((AbstractCdmDataViewerE4) getDetailsView(partService).getViewer()).refresh();
}
}
- public static SupplementalDataViewPart getSupplementalDataView() {
- return (SupplementalDataViewPart) getView(SupplementalDataViewPart.ID,
- false);
- }
-
- public static void reflowSupplementalViewer() {
- if (getSupplementalDataView() != null) {
- ((AbstractCdmDataViewer) getSupplementalDataView().getViewer())
- .reflow();
+ public static void reflowDetailsViewer(EPartService partService) {
+ if (getDetailsView(partService) != null) {
+ ((AbstractCdmDataViewerE4) getDetailsView(partService).getViewer()).reflow();
}
}
}
}
-
- public static void executeCommand(String commandId, Object source, String pluginId) {
- IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
- Exception exception = null;
- try {
- handlerService.executeCommand(commandId, null);
- } catch (ExecutionException e) {
- exception = e;
- } catch (NotDefinedException e) {
- exception = e;
- } catch (NotEnabledException e) {
- exception = e;
- } catch (NotHandledException e) {
- exception = e;
- } finally {
- if(exception != null) {
- MessagingUtils.errorDialog("Error executing command",
- source,
- "Could not execute command with id " + commandId ,
- pluginId,
- exception,
- true);
- }
- }
- }
-
public static Object getElementsFromSelectionChangedEvent(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
Object selectionToSet = selection;
final boolean cancelable,
final IPostMoniteredOperationEnabled postOp,
final IFeedbackGenerator feedbackGenerator) {
-
+
try{
// get the remoting monitor the first time to make sure that the
// operation is valid
--- /dev/null
+/**
+* Copyright (C) 2007 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.model;
+
+import org.eclipse.jface.resource.ColorRegistry;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @since Nov 1, 2017
+ *
+ */
+public class ColorResources {
+
+ private static ColorResources instance;
+
+ public static ColorResources getInstance(){
+ if(instance == null){
+ instance = new ColorResources();
+ }
+ return instance;
+ }
+
+ private static ColorRegistry colorRegistry;
+
+ public ColorRegistry getColorRegistry() {
+ if (colorRegistry == null) {
+ colorRegistry = new ColorRegistry();
+ initializeColorRegistry(colorRegistry);
+ }
+ return colorRegistry;
+ }
+
+ public static Color getColor(String key){
+ return getInstance().getColorRegistry().get(key);
+ }
+
+ protected void initializeColorRegistry(ColorRegistry registry) {
+ registerColor(registry, Resources.COLOR_COMPOSITE_BACKGROUND, 255,255,255);
+ registerColor(registry, Resources.COLOR_CONTROL_BACKGROUND, 220, 220, 220);
+ registerColor(registry, Resources.COLOR_CONTROL_SELECTED, 210, 210, 210);
+ registerColor(registry, Resources.COLOR_CONTROL_SELECTED_FOCUS, 232,242,254);
+ registerColor(registry, Resources.COLOR_COMPOSITE_IRRELEVANT, 241,139,18);
+ registerColor(registry, Resources.SEARCH_VIEW_FOREGROUND, 192, 192, 192);
+ registerColor(registry, Resources.SEARCH_VIEW_FOCUS, 0, 0, 0);
+ registerColor(registry, Resources.COLOR_LIST_BACKGROUND, 150,150,150);
+ registerColor(registry, Resources.COLOR_FONT_DEFAULT, 0,0,0);
+ registerColor(registry, Resources.COLOR_TEXT_DISABLED, 150,150,150);
+ registerColor(registry, Resources.COLOR_TEXT_DISABLED_BACKGROUND, 230,230,230);
+ registerColor(registry, Resources.COLOR_DRAG_ENTER, 185,255,133);
+ registerColor(registry, Resources.COLOR_LIST_EVEN, 255,255,255);
+ registerColor(registry, Resources.COLOR_LIST_ODD, 230,230,230);
+ registerColor(registry, Resources.COLOR_PARSE_ERROR, 255,0,0);
+ registerColor(registry, Resources.COLOR_DISABLED_EDITOR, 105,114,124);
+ registerColor(registry, Resources.COLOR_EDITOR_ERROR, 255,0,0);
+ }
+
+ private void registerColor(ColorRegistry registry, String key,
+ int red, int green, int blue) {
+ registry.put(key, new RGB(red, green, blue));
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2007 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.model;
+
+import org.eclipse.jface.resource.FontRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+
+import eu.etaxonomy.taxeditor.preference.Resources;
+
+/**
+ *
+ * @author pplitzner
+ * @since Nov 1, 2017
+ *
+ */
+public class FontResources {
+
+ private static FontResources instance;
+
+ public static FontResources getInstance(){
+ if(instance == null){
+ instance = new FontResources();
+ }
+ return instance;
+ }
+
+ private static FontRegistry fontRegistry;
+
+ public FontRegistry getFontRegistry() {
+ if (fontRegistry == null) {
+ fontRegistry = new FontRegistry();
+ initializeFontRegistry(fontRegistry);
+ }
+ return fontRegistry;
+ }
+
+ public static Font getFont(String key){
+ return getInstance().getFontRegistry().get(key);
+ }
+
+ protected void initializeFontRegistry(FontRegistry registry) {
+ registerFont(registry, Resources.ACCEPTED_TAXON_FONT, "Georgia", 12, SWT.NORMAL);
+ registerFont(registry, Resources.SYNONYM_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.MISAPPLIEDNAME_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.CONCEPT_FONT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_DEFAULT_PROMPT, "Georgia", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_ACCEPTED, "Arial", 10, SWT.NORMAL);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_SYNONYM, "Arial", 10, SWT.ITALIC);
+ registerFont(registry, Resources.FONT_SEARCH_VIEW_OTHER, "Lucida Grande", 11, SWT.NORMAL);
+ }
+
+ private void registerFont(FontRegistry registry, String key, String name, int height, int style) {
+ registry.put(key, new FontData[]{new FontData(name, height, style)});
+ }
+}
package eu.etaxonomy.taxeditor.newWizard;
+import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
- * <p>Abstract AbstractNewEntityWizard class.</p>
*
* @author n.hoffmann
* @created Jun 1, 2010
* @version 1.0
*/
public abstract class AbstractNewEntityWizard<T> extends Wizard implements
- INewWizard, IConversationEnabled {
+ IConversationEnabled {
private ConversationHolder conversation;
private T entity;
- private IWorkbench workbench;
-
private IStructuredSelection selection;
- /**
- * <p>Constructor for AbstractNewEntityWizard.</p>
- *
- * @param <T> a T object.
- */
public AbstractNewEntityWizard(){
setWindowTitle(String.format("New %s", getEntityName()));
}
*/
protected abstract String getEntityName();
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
/** {@inheritDoc} */
@Override
public boolean performFinish() {
return true;
}
- /**
- * <p>Getter for the field <code>entity</code>.</p>
- *
- * @return a T object.
- */
public T getEntity() {
return entity;
}
- /**
- * <p>Setter for the field <code>entity</code>.</p>
- *
- * @param entity a T object.
- */
public void setEntity(T entity){
this.entity = entity;
}
*/
protected abstract void saveEntity();
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
/** {@inheritDoc} */
- @Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench != null ? workbench : AbstractUtility.getWorkbench();
-
- if(selection == null){
- ISelectionService service = this.workbench.getActiveWorkbenchWindow().getSelectionService();
- if(service.getSelection() instanceof IStructuredSelection){
- selection = (IStructuredSelection) service.getSelection();
- }
- }
- this.selection = selection;
-
- formFactory = new CdmFormFactory(Display.getCurrent(), null);
- conversation = CdmStore.createConversation();
+ formFactory = new CdmFormFactory(Display.getCurrent(), null);
+ conversation = CdmStore.createConversation();
+ this.selection = selection;
entity = createNewEntity();
}
- /**
- * <p>createNewEntity</p>
- *
- * @return a T object.
- */
protected abstract T createNewEntity();
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
@Override
public ConversationHolder getConversationHolder() {
return conversation;
@Override
public void update(CdmDataChangeMap changeEvents) {}
- /**
- * @return the workbench
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
-
- /**
- * @return the selection
- */
public IStructuredSelection getSelection() {
return selection;
}
private ICdmEntitySessionEnabled cdmEntitySessionEnabled;
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- */
- protected AbstractPostOperation(String label, IUndoContext undoContext) {
- super(label);
- addContext(undoContext);
- }
-
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param element a {@link ICdmBase} object on which this operation is working.
- */
- public AbstractPostOperation(String label, IUndoContext undoContext, T element) {
- this(label, undoContext);
- this.element = element;
- }
-
/**
* @param label
* @param element
*/
public AbstractPostOperation(String label, IUndoContext undoContext,
T element, IPostOperationEnabled postOperationEnabled) {
- this(label, undoContext);
- this.element = element;
- this.postOperationEnabled = postOperationEnabled;
+ this(label, undoContext, element, postOperationEnabled, null);
}
public AbstractPostOperation(String label, IUndoContext undoContext,
T element, IPostOperationEnabled postOperationEnabled,
ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
- this(label, undoContext);
+ super(label);
+ addContext(undoContext);
this.element = element;
this.postOperationEnabled = postOperationEnabled;
this.cdmEntitySessionEnabled = cdmEntitySessionEnabled;
protected UUID parentNodeUuid;
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
Taxon taxon, IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, taxon, postOperationEnabled, null);
+ this(label, undoContext, taxon, postOperationEnabled, null);
}
public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
super(label, undoContext, taxon, postOperationEnabled, cdmEntitySessionEnabled);
}
- /**
- * <p>Constructor for AbstractPostOperation.</p>
- *
- * @param label a {@link java.lang.String} object.
- * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
- * @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
- * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
- */
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled){
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode,
+ IPostOperationEnabled postOperationEnabled) {
this(label, undoContext, taxonNode, postOperationEnabled, null);
}
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode, IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled){
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, TaxonNode taxonNode,
+ IPostOperationEnabled postOperationEnabled, ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
this(label, undoContext, taxonNode.getTaxon(), postOperationEnabled, cdmEntitySessionEnabled);
this.taxonNode = taxonNode;
}
* @param parentNodeUuid a {@link java.util.UUID} object.
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid, IPostOperationEnabled postOperationEnabled){
+ public AbstractPostTaxonOperation(String label, IUndoContext undoContext, UUID parentNodeUuid,
+ IPostOperationEnabled postOperationEnabled) {
super(label, undoContext, null, postOperationEnabled, null);
this.parentNodeUuid = parentNodeUuid;
}
*/
public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
IPostOperationEnabled postOperationEnabled) {
- super(label, undoContext, null, postOperationEnabled, null);
+ this(label, undoContext, postOperationEnabled, null);
}
public AbstractPostTaxonOperation(String label, IUndoContext undoContext,
super(label, undoContext, null, postOperationEnabled, cdmEntitySessionEnabled);
}
- /**
- * @param text
- * @param undoContext
- * @param taxon
- */
public AbstractPostTaxonOperation(String label, IUndoContext undoContext, Taxon taxon) {
this(label, undoContext, taxon, null);
}
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
/**
if(allowStatus.isOK()) {
AbstractOperation op = prepareOperation(event);
if(op != null) {
- AbstractUtility.executeOperation(op, this);
+// AbstractUtility.executeOperation(op, this);
}
} else if(allowStatus.getSeverity() == IStatus.ERROR ||
allowStatus.getSeverity() == IStatus.WARNING ||
*/
public abstract class RemotingCdmUpdateOperation extends RemotingCdmOperation {
- private UpdateResult updateResult;
+ protected UpdateResult updateResult;
public static boolean throwExceptions = false;
/**
--- /dev/null
+/**
+* Copyright (C) 2015 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.operation.e4;
+
+import javax.inject.Named;
+
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+/**
+ * @author cmathew
+ * @date 16 Jun 2015
+ *
+ */
+public abstract class RemotingCdmHandlerE4 {
+
+ protected String label;
+ protected EPartService partService;
+
+ public RemotingCdmHandlerE4(String label) {
+ this.label = label;
+ }
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+ @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+ @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MHandledMenuItem menuItem, EPartService partService, UISynchronize sync) {
+ this.partService = partService;
+ IStatus allowStatus = allowOperations(selection, shell, activePart, menuItem);
+ if(allowStatus.isOK()) {
+ AbstractOperation op = prepareOperation(selection, shell, activePart, menuItem);
+ if(op != null) {
+ AbstractUtility.executeOperation(op, this, sync);
+ }
+ } else if(allowStatus.getSeverity() == IStatus.ERROR ||
+ allowStatus.getSeverity() == IStatus.WARNING ||
+ allowStatus.getSeverity() == IStatus.INFO) {
+ MessagingUtils.warningDialog("Can not perform " + label, getTrigger(), allowStatus);
+ }
+ return;
+ }
+
+ public void postOperation(IStatus status) {
+
+ switch(status.getSeverity()) {
+ case IStatus.WARNING:
+ ErrorDialog.openError(null, "Operation successful but with warnings", null, status);
+ break;
+ case IStatus.ERROR:
+ ErrorDialog.openError(null, "Error executing operation", null, status);
+ break;
+ default:
+ }
+
+ onComplete();
+ }
+
+ public abstract IStatus allowOperations(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem);
+
+ public abstract AbstractOperation prepareOperation(IStructuredSelection selection,
+ Shell shell,
+ MPart activePart,
+ MHandledMenuItem menuItem);
+
+ public abstract void onComplete();
+
+ protected abstract Object getTrigger();
+
+}
+++ /dev/null
-/**
-* Copyright (C) 2007 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.preference;
-
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * <p>CdmPreferences class.</p>
- *
- * @author p.ciardelli
- * @created 20.05.2008
- * @version 1.0
- */
-public class CdmPreferences extends PreferencePage implements
- IWorkbenchPreferencePage {
-
- /** Constant <code>PLUGIN_ID="eu.etaxonomy.taxeditor.preferences.cdm"</code> */
- public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.cdm";
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- /** {@inheritDoc} */
- @Override
- protected Control createContents(Composite parent) {
-
- Composite container = new Composite(parent, SWT.NULL);
- container.setLayout(new GridLayout());
-
- //
- return container;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- /** {@inheritDoc} */
- public void init(IWorkbench workbench) {
-
- }
-}
private void createTextTreeSelection(Composite parent){
final CLabel label = new CLabel(parent, SWT.NONE);
- label.setText("Deafult Feature Tree to be used for textual descriptions");
+ label.setText("Default Feature Tree to be used for textual descriptions");
final ListViewer viewer = new ListViewer(parent);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
private void createStructureTreeSelection(Composite parent){
final CLabel label = new CLabel(parent, SWT.NONE);
- label.setText("Deafult Feature Tree to be used for structured descriptions");
+ label.setText("Default Feature Tree to be used for structured descriptions");
final ListViewer viewer = new ListViewer(parent);
viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
public static final String SHOW_TAXON_ASSOCIATIONS = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations";
public static final String SHOW_LIFE_FORM = "eu.etaxonomy.taxeditor.specimen.showLifeForm";
-
+
public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
public static final String DISTRIBUTION_AREA_OCCURENCE_STATUS = "eu.etaxonomy.taxeditor.checklist.distributionAreaStatus";
public static final String CHECKLIST_SYMBOL = "eu.etaxonomy.taxeditor.checklist.checklistSymbol";
public static final String CHECKLIST_SHOW_RANK = "eu.etaxonomy.taxeditor.checklist.checklistShowRank";
- public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
+
public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
public static final String SHOW_NAME_DETAILS_SECTION_LSID = "eu.etaxonomy.taxeditor.name.showNameLsid";
public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase";
public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache";
public static final String SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE = "eu.etaxonomy.taxeditor.name.showAuthorCache";
+
+
public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
public static final String DEFAULT_LANGUAGE_EDITOR = "eu.etaxonomy.taxeditor.default.language";
* Key for the saved P2 repositories
*/
public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
- public static final String ALLOW_OVERRIDE_NAMEDETAILS = "eu.etaxonomy.taxeditor.details.allow_override";
+// public static final String ALLOW_OVERRIDE_NAMEDETAILS = "eu.etaxonomy.taxeditor.details.allow_override";
public static final String ALLOW_OVERRIDE_RL = "eu.etaxonomy.taxeditor.isRL.allow_override";
-
-
+ public static final String ALLOW_OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.allowOverride";
+ public static final String ALLOW_OVERRIDE_NAME_DETAILS = "eu.etaxonomy.taxeditor.name.allowOverride";
+ public static final String OVERRIDE_NAME_DETAILS = "eu.etaxonomy.taxeditor.name.override";
+ public static final String OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.override";
/*
* Keys for the Abcd Import Configurator
*
public static final String ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR = "eu.etaxonomy.taxeditor.abcd_import_configurator.defaultAuthor";
public static final String ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID = "eu.etaxonomy.taxeditor.abcd_import_configurator.classificationUuid";
public static final String ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG = "eu.etaxonomy.taxeditor.abcd_import_configurator.allowOverride";
- public static final String BIOCASE_PROVIDER_LIST = "eu.etaxonomy.taxeditor.abcd_import.biocaseProviderList";
-
+
+
/*
* Keys for the biocase providers
*/
+ public static final String BIOCASE_PROVIDER_LIST = "eu.etaxonomy.taxeditor.abcd_import.biocaseProviderList";
+
+ public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
+ public static final String SHOW_MEDIA_PREVIEW = "eu.etaxonomy.taxeditor.media.showMediaPreview";
+
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_ADVANCED_MEDIA_SECTION,
"Show Advanced Media Section",
getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_MEDIA_PREVIEW,
+ "Show Preview in Media View",
+ getFieldEditorParent()));
}
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+
public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage {
boolean isSimpleDetailsViewActivated;
+ boolean isUseLocalSettings;
Composite child ;
+ Composite localSettings ;
@Override
public void init(IWorkbench workbench) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
+ CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
+ boolean isAllowOverride = false;
+ if (nameDetailsPref != null){
+ isAllowOverride = nameDetailsPref.isAllowOverride();
+ }
+
+
+ if (isAllowOverride){
+
+ final Button activateLocalButton = new Button(composite, SWT.CHECK);
+ activateLocalButton.setText(Messages.NameDetailsViewConfiguration_useLocalSettings);
+ isUseLocalSettings =PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS);
+ activateLocalButton.setSelection(isUseLocalSettings);
+ activateLocalButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isUseLocalSettings = activateLocalButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS, isUseLocalSettings);
+ if(isUseLocalSettings ){
+ child.setVisible(true);
+ child.setEnabled(true);
+ }else{
+ child.setVisible(false);
+ child.setEnabled(false);
+ }
+ }
+ });
+
+ child = new Composite(composite, SWT.NONE);
+ child.setLayout(new GridLayout());
+ child.setVisible(isUseLocalSettings);
+
+ isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
+
+
+
+ final Button activateCheckButton = new Button(child, SWT.CHECK);
+ activateCheckButton.setText(Messages.NameDetailsViewConfiguration_activateSimpleDetailsView);
+ activateCheckButton.setSelection(isSimpleDetailsViewActivated);
+ activateCheckButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ isSimpleDetailsViewActivated = activateCheckButton.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
+ if(isSimpleDetailsViewActivated && isUseLocalSettings){
+ localSettings.setVisible(true);
+ localSettings.setEnabled(true);
+ }else{
+ localSettings.setVisible(false);
+ localSettings.setEnabled(false);
+ }
+ }
+ });
+ localSettings = new Composite(child, SWT.NONE);
+ localSettings.setLayout(new GridLayout());
+ localSettings.setVisible(isSimpleDetailsViewActivated);
+
+
+ final Button showTaxon = new Button(localSettings, SWT.CHECK);
+ boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
+ showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
+ showTaxon.setSelection(isShowTaxon);
+ showTaxon.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowTaxon = showTaxon.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
+ }
+ });
+
+ final Button showLsid = new Button(localSettings, SWT.CHECK);
+ boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
+ showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
+ showLsid.setSelection(isShowLSID);
+ showLsid.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowLSID = showLsid.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
+ }
+ });
+
+ final Button showNomenclaturalCode = new Button(localSettings, SWT.CHECK);
+ boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
+ showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
+ showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
+ showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
+ }
+ });
+
+ final Button showNameCache = new Button(localSettings, SWT.CHECK);
+ boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
+ showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
+ showNameCache.setSelection(isShowNomenclaturalCode);
+ showNameCache.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNameCache = showNameCache.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
+ }
+ });
+ final Button showAppendedPhrase = new Button(localSettings, SWT.CHECK);
+ boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
+ showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
+ showAppendedPhrase.setSelection(isShowAppendedPhrase);
+ showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
+ }
+ });
+
+ final Button showRank = new Button(localSettings, SWT.CHECK);
+ boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
+ showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
+ showRank.setSelection(isShowRank);
+ showRank.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowRank = showRank.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
+ }
+ });
+ final Button showEpithets = new Button(localSettings, SWT.CHECK);
+ boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
+ showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
+ showEpithets.setSelection(isShowEpithets);
+ showEpithets.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowEpithets = showEpithets.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
+ }
+ });
+
+ final Button showAuthorCache = new Button(localSettings, SWT.CHECK);
+ boolean isShowAuthorCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
+ showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
+ showAuthorCache.setSelection(isShowAuthorCache);
+ showAuthorCache.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowAuthorCache = showAuthorCache.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, isShowAuthorCache);
+ }
+ });
+
+ final Button showAuthorship = new Button(localSettings, SWT.CHECK);
+ boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
+ showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
+ showAuthorship.setSelection(isShowAuthorship);
+ showAuthorship.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowAuthorship = showAuthorship.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
+ }
+ });
+
+ final Button showNomenclaturalRef = new Button(localSettings, SWT.CHECK);
+ boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
+ showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
+ showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
+ showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
+ }
+ });
+
+ final Button showNomenclaturalStatus = new Button(localSettings, SWT.CHECK);
+ boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
+ showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
+ showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
+ showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
+ }
+ });
+
+ final Button showProtologue = new Button(localSettings, SWT.CHECK);
+ boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
+ showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
+ showProtologue.setSelection(isShowProtologue);
+ showProtologue.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowProtologue = showProtologue.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
+ }
+ });
+
+ final Button showTypeDesignation = new Button(localSettings, SWT.CHECK);
+ boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
+ showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
+ showTypeDesignation.setSelection(isShowTypeDesignation);
+ showTypeDesignation.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowTypeDesignation = showTypeDesignation.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
+ }
+ });
+
+
+ final Button showNameRelationship = new Button(localSettings, SWT.CHECK);
+ boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
+ showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
+ showNameRelationship.setSelection(isShowNameRelationship);
+ showNameRelationship.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNameRelationship = showNameRelationship.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
+ }
+ });
+
+ final Button showHybrid = new Button(localSettings, SWT.CHECK);
+ boolean isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
+ showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
+ showHybrid.setSelection(isShowHybrid);
+ showHybrid.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowHybrid = showHybrid.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
+ }
+ });
+ final Button showNameApprobiation = new Button(localSettings, SWT.CHECK);
+ boolean isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
+ showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
+ showNameApprobiation.setSelection(isShowNameApprobiation);
+ showNameApprobiation.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean isShowNameApprobiation = showNameApprobiation.getSelection();
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
+ }
+ });
+
- //boolean isAllowOverride = PreferencesUtil
- isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
- final Button activateCheckButton = new Button(composite, SWT.CHECK);
- activateCheckButton.setText("Show only a simple name details view");
- activateCheckButton.setSelection(isSimpleDetailsViewActivated);
- activateCheckButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- isSimpleDetailsViewActivated = activateCheckButton.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
if(isSimpleDetailsViewActivated){
- child.setVisible(true);
- child.setEnabled(true);
+ localSettings.setEnabled(true);
}else{
- child.setVisible(false);
- child.setEnabled(false);
+ localSettings.setEnabled(false);
}
- }
- });
-
- child = new Composite(composite, SWT.H_SCROLL);
- child.setLayout(new GridLayout());
- child.setVisible(isSimpleDetailsViewActivated);
-
- final Button showTaxon = new Button(child, SWT.CHECK);
- boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
- showTaxon.setText("Show taxon of the name");
- showTaxon.setSelection(isShowTaxon);
- showTaxon.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowTaxon = showTaxon.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
- }
- });
-
- final Button showLsid = new Button(child, SWT.CHECK);
- boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
- showLsid.setText("Show Lsid of the name");
- showLsid.setSelection(isShowLSID);
- showLsid.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowLSID = showLsid.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
- }
- });
-
- final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
- showNomenclaturalCode.setText("Show the nomenclatural code");
- showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
- showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
- }
- });
-
- final Button showNameCache = new Button(child, SWT.CHECK);
- boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
- showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
- showNameCache.setSelection(isShowNomenclaturalCode);
- showNameCache.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNameCache = showNameCache.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
- }
- });
- final Button showAppendedPhrase = new Button(child, SWT.CHECK);
- boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
- showAppendedPhrase.setText("Show appended phrase");
- showAppendedPhrase.setSelection(isShowAppendedPhrase);
- showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowAppendedPhrase = showAppendedPhrase.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
- }
- });
-
- final Button showRank = new Button(child, SWT.CHECK);
- boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
- showRank.setText("Show rank of the name");
- showRank.setSelection(isShowRank);
- showRank.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowRank = showRank.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
- }
- });
- final Button showEpithets = new Button(child, SWT.CHECK);
- boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
- showEpithets.setText("Show atomised epithets");
- showEpithets.setSelection(isShowEpithets);
- showEpithets.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowEpithets = showEpithets.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
- }
- });
- final Button showAuthorship = new Button(child, SWT.CHECK);
- boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
- showAuthorship.setText("Show authorship section");
- showAuthorship.setSelection(isShowAuthorship);
- showAuthorship.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowAuthorship = showAuthorship.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
- }
- });
-
- final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
- showNomenclaturalRef.setText("Show nomenclatural reference section");
- showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
- showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
- }
- });
-
- final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
- boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
- showNomenclaturalStatus.setText("Show nomenclatural status section");
- showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
- showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
- }
- });
-
- final Button showProtologue = new Button(child, SWT.CHECK);
- boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
- showProtologue.setText("Show protologue section");
- showProtologue.setSelection(isShowProtologue);
- showProtologue.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowProtologue = showProtologue.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
- }
- });
-
- final Button showTypeDesignation = new Button(child, SWT.CHECK);
- boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
- showTypeDesignation.setText("Show name type designation section");
- showTypeDesignation.setSelection(isShowTypeDesignation);
- showTypeDesignation.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowTypeDesignation = showTypeDesignation.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
- }
- });
-
-
- final Button showNameRelationship = new Button(child, SWT.CHECK);
- boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
- showNameRelationship.setText("Show name relationship section");
- showNameRelationship.setSelection(isShowNameRelationship);
- showNameRelationship.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowNameRelationship = showNameRelationship.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
- }
- });
-
- final Button showHybrid = new Button(child, SWT.CHECK);
- boolean isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
- showHybrid.setText("Show hybrid section");
- showHybrid.setSelection(isShowHybrid);
- showHybrid.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- boolean isShowHybrid = showHybrid.getSelection();
- PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
- }
- });
-
-
-
- if(isSimpleDetailsViewActivated){
- child.setEnabled(true);
}else{
- child.setEnabled(false);
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("The CDM settings don't allow to set the preferences for the display of name details locally. If you need to make local settings, please ask an administrator.");
}
-
return composite;
return null;
}
+ public static boolean isShowTaxonAssociations(){
+ if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS);
+ } else{
+ CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
+
+ return pref!=null?Boolean.valueOf(pref.getValue()):false;
+ }
+ }
+
+ public static boolean isShowLifeForm(){
+ if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ return getPreferenceStore().getBoolean(SHOW_LIFE_FORM);
+ } else{
+ CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
+
+ return pref!=null?Boolean.valueOf(pref.getValue()):false;
+ }
+ }
+
+ public static boolean isDeterminationOnlyForFieldUnits(){
+ if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS);
+ } else{
+ CdmPreference pref = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
+
+ return pref!=null?Boolean.valueOf(pref.getValue()):false;
+ }
+ }
+
+ public static boolean isCollectingAreaInGeneralSection(){
+ if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
+ } else{
+ CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
+
+ return pref!=null?Boolean.valueOf(pref.getValue()):false;
+ }
+ }
+
+ public static boolean isShowSimpleDetailsView(){
+ if (getPreferenceStore().getBoolean(OVERRIDE_NAME_DETAILS) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_NAME_DETAILS)) {
+ return getPreferenceStore().getBoolean(SHOW_SIMPLE_NAME_DETAILS_SECTION);
+ } else{
+ CdmPreference pref = getPreferenceFromDB(PreferencePredicate.NameDetailsView);
+
+ return pref!=null?Boolean.valueOf(pref.getValue()):false;
+ }
+ }
+
+
- private static CdmPreference getPreferenceFromDB(PreferencePredicate predicate){
+ public static CdmPreference getPreferenceFromDB(PreferencePredicate predicate){
ICdmRepository controller;
CdmPreference pref = null;
try{
- controller = CdmStore.getCurrentApplicationConfiguration();
- PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), predicate);
- pref = controller.getPreferenceService().find(key);
+ if(CdmStore.isActive()){
+ controller = CdmStore.getCurrentApplicationConfiguration();
+ PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), predicate);
+ pref = controller.getPreferenceService().find(key);
+ }
}catch(Exception e){
e.printStackTrace();
}
return null;
}
+ public static boolean isShowMediaPreview(){
+ boolean isShowMediaPreview = getPreferenceStore().getBoolean(SHOW_MEDIA_PREVIEW);
+ return isShowMediaPreview;
+ }
+
/**
* Get the match strategy for the given class that was stored in preferences
* or the default strategy if it was not stored in preferences
public static void setShowIdInVocabularyInChecklistEditor(boolean selection) {
getPreferenceStore().setValue(CHECKLIST_ID_IN_VOCABULARY, selection);
}
-
+
/**
* @return
*/
return null;
}
- getPreferenceStore().setValue(ALLOW_OVERRIDE_NAMEDETAILS, preference.isAllowOverride());
+ getPreferenceStore().setValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
//the preference value is build like this:
//<section1>:true;<section2>:false....
sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1]));
}
+ config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated"));
-
- getPreferenceStore().setValue(SHOW_SIMPLE_NAME_DETAILS_TAXON,
- (getValue(sectionMap, "taxon")));
+// getPreferenceStore().setValue(SHOW_SIMPLE_NAME_DETAILS_TAXON,
+// (getValue(sectionMap, "taxon")));
config.setTaxonSectionActivated(getValue(sectionMap, "taxon"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_LSID,
- (getValue(sectionMap, "lsid")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_LSID,
+// (getValue(sectionMap, "lsid")));
config.setLSIDActivated(getValue(sectionMap, "lsid"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
- (getValue(sectionMap, "nc")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
+// (getValue(sectionMap, "nc")));
config.setNomenclaturalCodeActived(getValue(sectionMap, "nc"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
- (getValue(sectionMap, "ap")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
+// (getValue(sectionMap, "ap")));
config.setAppendedPhraseActivated(getValue(sectionMap, "ap"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_RANK,
- (getValue(sectionMap, "rank")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_RANK,
+// (getValue(sectionMap, "rank")));
config.setRankActivated(getValue(sectionMap, "rank"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
- (getValue(sectionMap, "atomisedEpithets")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
+// (getValue(sectionMap, "atomisedEpithets")));
config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
- (getValue(sectionMap,"author")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
+// (getValue(sectionMap,"author")));
config.setAuthorshipSectionActivated(getValue(sectionMap,"author"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
- (getValue(sectionMap, "nomRef")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
+// (getValue(sectionMap, "nomRef")));
config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
- (getValue(sectionMap, "nomStat")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
+// (getValue(sectionMap, "nomStat")));
config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
- (getValue(sectionMap,"protologue")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
+// (getValue(sectionMap,"protologue")));
config.setProtologueActivated(getValue(sectionMap,"protologue"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
- (getValue(sectionMap,"typeDes")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
+// (getValue(sectionMap,"typeDes")));
config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes"));
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
- (getValue(sectionMap,"nameRelation")));
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
+// (getValue(sectionMap,"nameRelation")));
config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation"));
-
- getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID,
- (getValue(sectionMap, "hybrid")));
+
+// getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID,
+// (getValue(sectionMap, "hybrid")));
config.setHybridActivated(getValue(sectionMap,"hybrid"));
return config;
}else{
return true;
}
-
- }
-
- public static boolean getIsDeterminiationOnlyForFieldUnit(boolean local){
- CdmPreference preference = null;
-
- if (!local) {
- preference = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
- }
- if (preference == null){
- return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS);
- }
- return Boolean.valueOf(preference.getValue());
- }
- public static boolean getIsShowCollectingAreasInGeneralSection(boolean local){
- CdmPreference preference = null;
-
- if (!local) {
- preference = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
- }
- if (preference == null){
- return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
- }
- return Boolean.valueOf(preference.getValue());
- }
-
- public static boolean getIsShowTaxonAssociations(boolean local){
- CdmPreference preference = null;
+ }
- if (!local) {
- preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
- }
- if (preference == null){
- return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS);
- }
- return Boolean.valueOf(preference.getValue());
- }
+// public static boolean isDeterminiationOnlyForFieldUnit(boolean local){
+// CdmPreference preference = null;
+//
+// if (!local) {
+// preference = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
+// }
+// if (preference == null){
+// return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS);
+// }
+// return Boolean.valueOf(preference.getValue());
+// }
+//
+// public static boolean isShowCollectingAreasInGeneralSection(boolean local){
+// CdmPreference preference = null;
+//
+// if (!local) {
+// preference = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
+// }
+// if (preference == null){
+// return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
+// }
+// return Boolean.valueOf(preference.getValue());
+// }
+//
+// public static boolean isShowTaxonAssociations(boolean local){
+// CdmPreference preference = null;
+//
+// if (!local) {
+// preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
+// }
+// if (preference == null){
+// return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS);
+// }
+// return Boolean.valueOf(preference.getValue());
+// }
// public static boolean getBioCaseProvider(boolean local){
// CdmPreference preference = null;
}
-
+ /**
+ *
+ */
+ public NameDetailsConfigurator createLocalNameDetailsViewConfig(boolean local) {
+ NameDetailsConfigurator config = new NameDetailsConfigurator(true);
+ if (local){
+ config.setSimpleDetailsViewActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
+ config.setAppendedPhraseActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
+ config.setAtomisedEpithetsActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
+ config.setAuthorshipSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
+ config.setLSIDActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
+ config.setNameApprobiationActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION));
+ config.setNameCacheActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
+ config.setNameRelationsSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
+ config.setNomenclaturalCodeActived(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
+ config.setNomenclaturalStatusSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
+ config.setNomenclaturalReferenceSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
+ config.setProtologueActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
+ config.setRankActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
+ config.setTaxonSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
+ config.setTypeDesignationSectionActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
+ config.setHybridActivated(getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID));
+ }else{
+
+ }
+
+ return config;
+ }
+
+
+ public static void saveConfigToPrefernceStore(NameDetailsConfigurator config) {
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
+ config.isSimpleDetailsViewActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, config.isTaxonSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, config.isLSIDActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
+ config.isNomenclaturalCodeActived());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE,
+ config.isNameCacheActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
+ config.isAppendedPhraseActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, config.isRankActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
+ config.isAtomisedEpithetsActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE,
+ config.isAuthorCacheActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
+ config.isAuthorshipSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
+ config.isNomenclaturalReferenceSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
+ config.isNomenclaturalStatusSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
+ config.isProtologueActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
+ config.isTypeDesignationSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
+ config.isNameRelationsSectionActivated());
+ PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID,
+ config.isHybridActivated());
+
+ }
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.api.service.IPreferenceService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
/**
* @author pplitzner
* @date 13.02.2014
*/
public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+ public SpecimenOrObservationPreferences(){
+ super();
+ setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)){
+ setDescription("Set the preferences for the display of specimen and obeservations.");
+ }else{
+ setDescription("The CDM settings don't allow to set the preferences for the display of specimen and obeservations locally. If you need to make local settings, please ask an administrator.");
+ }
+ }
+
+
@Override
public void init(IWorkbench workbench) {
- setPreferenceStore(PreferencesUtil.getPreferenceStore());
+// setPreferenceStore(PreferencesUtil.getPreferenceStore());
+ ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+ if (controller != null){
+ IPreferenceService service = controller.getPreferenceService();
+ PrefKey keyTaxonAssociation = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowTaxonAssociations);
+ CdmPreference prefTaxonAssociation = service.find(keyTaxonAssociation);
+ PrefKey keyDeterminationFieldUnit = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
+ CdmPreference prefDeterminationFieldUnit = service.find(keyDeterminationFieldUnit);
+ PrefKey keyCollectingAreas = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
+ CdmPreference prefCollectingAreas = service.find(keyCollectingAreas);
+
+ getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, prefTaxonAssociation == null? true : prefTaxonAssociation.isAllowOverride());
+ }
+ if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
+ setDescription("Set the preferences for the display of specimen and obeservations.");
+ }else{
+ setDescription("The CDM settings don't allow to set the preferences for the display of specimen and obeservations locally. If you need to make local settings, please ask an administrator.");
+
+ }
}
@Override
protected void createFieldEditors() {
- addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
- "Taxon determination only on FieldUnit level",
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
- "Show \"Collecting Areas\" in \"General\" section of details view",
- getFieldEditorParent()));
- addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
- "Show taxon associations of a specimen in the details view",
- getFieldEditorParent()));
+ if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF)) {
+ addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
+ "Taxon determination only on FieldUnit level",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
+ "Show \"Collecting Areas\" in \"General\" section of details view",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
+ "Show taxon associations of a specimen in the details view",
+ getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_LIFE_FORM,
+ "Show taxon associations of a specimen in the details view",
+ getFieldEditorParent()));
+ Label label = new Label(getFieldEditorParent(), SWT.NONE);
+
+ label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
+
+ addField(new BooleanFieldEditor(
+ IPreferenceKeys.OVERRIDE_SPECIMEN_PREF,
+ "Use local specimen preferences",
+ getFieldEditorParent()));
+
+
+ }
+
}
import org.eclipse.ui.IWorkbench;
-import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
import eu.etaxonomy.cdm.strategy.match.MatchException;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
+import eu.etaxonomy.taxeditor.editor.definedterm.e4.DefinedTermEditorE4;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
ICommandService commandService = (ICommandService) AbstractUtility.getService(ICommandService.class);
- Command command = commandService.getCommand(DefinedTermEditor.OPEN_COMMAND_ID);
+ Command command = commandService.getCommand(DefinedTermEditorE4.OPEN_COMMAND_ID);
IParameter parameter;
try {
handlerService.executeCommand(pCommand, null);
} catch (NotDefinedException e) {
throw new RuntimeException("Could not find open command: "
- + DefinedTermEditor.OPEN_COMMAND_ID);
+ + DefinedTermEditorE4.OPEN_COMMAND_ID);
} catch (Exception e) {
MessagingUtils
.error(getClass(),
* <p>Constructor for NomenclaturalStatusTypeMenuPreferences.</p>
*/
public NomenclaturalStatusTypeMenuPreferences() {
- super("Nomenlcatural Status Type Preferences",
+ super("Nomenclatural Status Type Preferences",
"Configure nomenclatural status types",
false);
}
--- /dev/null
+package eu.etaxonomy.taxeditor.store;
+
+public class AppModelId {
+ public static final String ADDON_EU_ETAXONOMY_TAXEDITOR_EVENT_EVENTUTILITY = "eu.etaxonomy.taxeditor.event.EventUtility";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENCLASSIFICATIONWIZARD = "eu.etaxonomy.taxeditor.command.openClassificationWizard";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENPART = "eu.etaxonomy.taxeditor.command.openPart";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_COMMAND_OPENTAXONNODEWIZARD = "eu.etaxonomy.taxeditor.command.openTaxonNodeWizard";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_DELETE = "eu.etaxonomy.taxeditor.editor.definedTerms.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_NEWDEFINEDTERM = "eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_NEWKINDOFTERM = "eu.etaxonomy.taxeditor.editor.definedTerms.newKindOfTerm";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERMS_NEWTERMVOCABULARY = "eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_OPENREFERENCINGOBJECTSVIEW = "eu.etaxonomy.taxeditor.openReferencingObjectsView";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCDMLIGHT = "eu.etaxonomy.taxeditor.store.command.exportCdmLight";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSV = "eu.etaxonomy.taxeditor.store.command.exportCsv";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSVNAME = "eu.etaxonomy.taxeditor.store.command.exportCsvName";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTCSVPRINT = "eu.etaxonomy.taxeditor.store.command.exportCsvPrint";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTDWCA = "eu.etaxonomy.taxeditor.store.command.exportDwca";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTJAXB = "eu.etaxonomy.taxeditor.store.command.exportJaxb";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_EXPORTSDD = "eu.etaxonomy.taxeditor.store.command.exportSdd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_FEATURETREE_ADDFEATURE = "eu.etaxonomy.taxeditor.store.command.featureTree.addFeature";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_FEATURETREE_EXPORTTREE = "eu.etaxonomy.taxeditor.store.command.featureTree.exportTree";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_FEATURETREE_REMOVEFEATURE = "eu.etaxonomy.taxeditor.store.command.featureTree.removeFeature";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTABCD = "eu.etaxonomy.taxeditor.store.command.importAbcd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELDISTRIBUTION = "eu.etaxonomy.taxeditor.store.command.importExcelDistribution";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELSPECIMEN = "eu.etaxonomy.taxeditor.store.command.importExcelSpecimen";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTEXCELTAXA = "eu.etaxonomy.taxeditor.store.command.importExcelTaxa";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTRISREFERENCE = "eu.etaxonomy.taxeditor.store.command.importRisReference";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTSDD = "eu.etaxonomy.taxeditor.store.command.importSdd";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_COMMAND_IMPORTTCS = "eu.etaxonomy.taxeditor.store.command.importTcs";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_CHANGE = "eu.etaxonomy.taxeditor.store.datasource.change";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_CLONE = "eu.etaxonomy.taxeditor.store.datasource.clone";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_CREATE = "eu.etaxonomy.taxeditor.store.datasource.create";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_EDIT = "eu.etaxonomy.taxeditor.store.datasource.edit";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_UPDATE = "eu.etaxonomy.taxeditor.store.datasource.update";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_STORE_OPENDEFINEDTERMEDITOR = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_DELETE = "eu.etaxonomy.taxeditor.view.datasource.delete";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMAND_IMPORTSPECIMENS = "eu.etaxonomy.taxeditor.workbench.command.importSpecimens";
+ public static final String COMMAND_ORG_ECLIPSE_UI_FILE_SAVE = "org.eclipse.ui.file.save";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_STORE_DYNAMICMENUCONTRIBUTION_0 = "eu.etaxonomy.taxeditor.store.dynamicmenucontribution.0";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_CLONE = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.clone";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_CREATEMODEL = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.createModel";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_DELETE = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.delete";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_EDIT = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.edit";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_NEWDATASOURCE = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.newDataSource";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_DATASOURCE_HANDLEDMENUITEM_REFRESH = "eu.etaxonomy.taxeditor.store.datasource.handledmenuitem.refresh";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_ADDFEATURE = "eu.etaxonomy.taxeditor.store.handledmenuitem.addFeature";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_COMMANDLABEL12 = "eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel12";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_COMMANDLABEL13 = "eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel13";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_COMMANDLABEL14 = "eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabel14";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTCDMLIGHT = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportCdmLight";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTCSV = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsv";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTCSVNAME = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvName";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTCSVPRINT = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportCsvPrint";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTDWCA = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportDwca";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTFEATURETREE = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportFeatureTree";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTJAXB = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportJaxb";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_EXPORTSDD = "eu.etaxonomy.taxeditor.store.handledmenuitem.exportSdd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTABCD = "eu.etaxonomy.taxeditor.store.handledmenuitem.importAbcd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTEXCELDISTRIBUTION = "eu.etaxonomy.taxeditor.store.handledmenuitem.importExceldistribution";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTEXCELSPECIMEN = "eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelSpecimen";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTEXCELTAXA = "eu.etaxonomy.taxeditor.store.handledmenuitem.importExcelTaxa";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTRISREFERENCE = "eu.etaxonomy.taxeditor.store.handledmenuitem.importRisReference";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTSDD = "eu.etaxonomy.taxeditor.store.handledmenuitem.importSdd";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_IMPORTTCS = "eu.etaxonomy.taxeditor.store.handledmenuitem.importTcs";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_KINDOFTERM = "eu.etaxonomy.taxeditor.store.handledmenuitem.kindofterm";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_HANDLEDMENUITEM_REMOVEFEATURE = "eu.etaxonomy.taxeditor.store.handledmenuitem.removeFeature";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_DATASOURCE = "eu.etaxonomy.taxeditor.store.showViewMenu.datasource";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_DETAILS = "eu.etaxonomy.taxeditor.store.showViewMenu.details";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_LOGVIEW = "eu.etaxonomy.taxeditor.store.showViewMenu.logView";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_SESSIONS = "eu.etaxonomy.taxeditor.store.showViewMenu.sessions";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_SUPPLEMENTAL = "eu.etaxonomy.taxeditor.store.showViewMenu.supplemental";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_TERMEDITORMENU_FEATURETREEEDITOR = "eu.etaxonomy.taxeditor.store.termEditorMenu.featureTreeEditor";
+ public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_HANDLEDMENUITEM_IMPORTSPECIMENS = "eu.etaxonomy.taxeditor.workbench.handledmenuitem.importspecimens";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM_E4_HANDLER_CREATEDEFINEDTERMHANDLERE4_NEWDEFINEDTERM = "eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4.newDefinedTerm";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM_E4_HANDLER_CREATEDEFINEDTERMHANDLERE4_NEWKINDOFTERM = "eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateDefinedTermHandlerE4.newKindOfTerm";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM_E4_HANDLER_CREATETERMVOCABULARYHANDLERE4 = "eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.CreateTermVocabularyHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM_E4_HANDLER_DELETETERMBASEHANDLERE4 = "eu.etaxonomy.taxeditor.editor.definedterm.e4.handler.DeleteTermBaseHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_FEATURETREE_E4_HANDLER_ADDFEATUREHANDLER = "eu.etaxonomy.taxeditor.featuretree.e4.handler.AddFeatureHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_FEATURETREE_E4_HANDLER_FEATURETREEEXPORTHANDLER = "eu.etaxonomy.taxeditor.featuretree.e4.handler.FeatureTreeExportHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_FEATURETREE_E4_HANDLER_REMOVEFEATUREHANDLER = "eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_FEATURETREE_HANDLER_SAVEHANDLER = "eu.etaxonomy.taxeditor.featuretree.handler.SaveHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_HANDLER_DEFAULTHANDLER_E4_DEFAULTOPENCLASSIFICATIONWIZARDHANDLERE4 = "eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenClassificationWizardHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_HANDLER_DEFAULTHANDLER_E4_DEFAULTOPENTAXONNODEWIZARDHANDLERE4 = "eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenTaxonNodeWizardHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_HANDLER_DEFAULTHANDLER_OPENREFERENCINGOBJECTSVIEWHANDLER = "eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsViewHandler";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_ABCD_OPENABCDIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.abcd.OpenAbcdImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_EXCEL_DISTRIBUTION_OPENEXCELDISTRIBUTIONIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.excel.distribution.OpenExcelDistributionImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_EXCEL_SPECIMEN_OPENEXCELSPECIMENIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.excel.specimen.OpenExcelSpecimenImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_EXCEL_TAXA_OPENEXCELTAXAIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.excel.taxa.OpenExcelTaxaImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_IN_TCS_OPENTCSIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.in.tcs.OpenTcsImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CDMLIGHT_OPENCDMLIGHTEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.cdmlight.OpenCdmLightExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CSV_NAME_OPENCSVNAMEEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.csv.name.OpenCsvNameExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CSV_OPENCSVEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.csv.OpenCsvExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_CSV_PRINT_OPENCSVPRINTEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.csv.print.OpenCsvPrintExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_DWCA_OPENDWCAEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.dwca.OpenDwcaExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_JAXB_OPENJAXBEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.jaxb.OpenJaxbExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_OUT_SDD_OPENSDDEXPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.out.sdd.OpenSddExportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_RIS_OPENRISIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.ris.OpenRisImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_IO_E4_SDD_OPENSDDIMPORTWIZARD = "eu.etaxonomy.taxeditor.io.e4.sdd.OpenSddImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATAIMPORT_E4_HANDLER_OPENSPECIMENIMPORTWIZARD = "eu.etaxonomy.taxeditor.view.dataimport.e4.handler.OpenSpecimenImportWizard";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_CHANGECONNECTIONHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.ChangeConnectionHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_CLONEDATASOURCEHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.CloneDataSourceHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_CREATEDATASOURCEHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.CreateDataSourceHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_DELETEDATASOURCEHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.DeleteDataSourceHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_EDITDATASOURCEHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.EditDataSourceHandlerE4";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE_E4_HANDLER_UPDATEDATASOURCEHANDLERE4 = "eu.etaxonomy.taxeditor.view.datasource.e4.handler.UpdateDataSourceHandlerE4";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_STORE_MENUSEPARATOR_1 = "eu.etaxonomy.taxeditor.store.menuseparator.1";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_STORE_MENUSEPARATOR_2 = "eu.etaxonomy.taxeditor.store.menuseparator.2";
+ public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_STORE_MENUSEPARATOR_3 = "eu.etaxonomy.taxeditor.store.menuseparator.3";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_STORE_MENU_EXPORT = "eu.etaxonomy.taxeditor.store.menu.export";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_STORE_MENU_IMPORT = "eu.etaxonomy.taxeditor.store.menu.import";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_STORE_MENU_MENULABEL0 = "eu.etaxonomy.taxeditor.store.menu.menulabel0";
+ public static final String MENU_EU_ETAXONOMY_TAXEDITOR_STORE_MENU_TERMEDITOR = "eu.etaxonomy.taxeditor.store.menu.termeditor";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_DETAILSVIEW = "eu.etaxonomy.taxeditor.store.showView.parameter.detailsView";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_FEATURETREEEDITOR = "eu.etaxonomy.taxeditor.store.showView.parameter.featureTreeEditor";
+ public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_SESSIONVIEW = "eu.etaxonomy.taxeditor.store.showView.parameter.sessionView";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DEFINEDTERM = "eu.etaxonomy.taxeditor.editor.definedTerm";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_FEATURETREE_E4_FEATURETREEEDITOR = "eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATAIMPORT_E4_GBIFRESPONSEIMPORTVIEWE4 = "eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportViewE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATAIMPORT_E4_SPECIMENIMPORTVIEWE4 = "eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenImportViewE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_DATASOURCE = "eu.etaxonomy.taxeditor.view.datasource";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_DETAILS_DETAILSPARTE4 = "eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_E4_SUPPLEMENTALDATA_SUPPLEMENTALDATAPARTE4 = "eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4";
+ public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_VIEW_SESSIONS_SESSIONSVIEWPART = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_DATASOURCEVIEW = "eu.etaxonomy.taxeditor.store.popupmenu.datasourceview";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_FEATURETREEEDITOR = "eu.etaxonomy.taxeditor.store.popupmenu.featureTreeEditor";
+ public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_STORE_POPUPMENU_TERMEDITOR = "eu.etaxonomy.taxeditor.store.popupmenu.termeditor";
+}
\ No newline at end of file
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
import eu.etaxonomy.cdm.api.service.IService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
import eu.etaxonomy.cdm.persistence.hibernate.permission.ICdmPermissionEvaluator;
import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
else if (cdmBase instanceof TaxonName) {
service = (IService<T>) getService(INameService.class);
}
+ else if (cdmBase instanceof TaxonBase) {
+ service = (IService<T>) getService(ITaxonService.class);
+ }
else if (cdmBase instanceof SpecimenOrObservationBase) {
service = (IService<T>) getService(IOccurrenceService.class);
}
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog;
-import eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4;
-import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
Thread.currentThread().setPriority(10);
applicationController = getApplicationController(cdmSource,subprogressMonitor);
MessagingUtils.informationDialog(Messages.CdmStoreConnector_SUCCESS, Messages.CdmStoreConnector_DATA_MODEL_CREATION_SUCCESSFUL);
- CdmDataSourceViewPartE4 dataSourceView = (CdmDataSourceViewPartE4) WorkbenchUtility.getE4WrappedPart(AbstractUtility.getView("eu.etaxonomy.taxeditor.view.datasource", false));
- if(dataSourceView!=null){
- dataSourceView.refresh();
- }
+ //FIXME E4 migrate or delete because data source view is not used anymore
+// CdmDataSourceViewPartE4 dataSourceView = (CdmDataSourceViewPartE4) WorkbenchUtility.getE4WrappedPart(AbstractUtility.getView("eu.etaxonomy.taxeditor.view.datasource", false));
+// if(dataSourceView!=null){
+// dataSourceView.refresh();
+// }
return Status.OK_STATUS;
} catch (Exception e) {
if(! causeIsCancelationExceptionRecursive(e)){
import eu.etaxonomy.cdm.model.common.Group;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IContextListener;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
* @return true if the login attempt was successful even if the authentication has changed or not
*/
public boolean authenticate(String username, String password){
-
- // close all open editors
- if(!AbstractUtility.closeAll()){
- return false;
- }
-
-
try{
doAuthenticate(username, password);
} catch (CdmAuthenticationException e) {
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.common.CdmBase;
statusLineManager = manager;
}
+ public static void reflowParentScrolledForm(Composite composite, boolean flushCashes){
+ ScrolledForm scrolledForm = null;
+ Composite parent = composite;
+ while(parent!=null && !(parent instanceof ScrolledForm)){
+ parent = parent.getParent();
+ }
+ scrolledForm = (ScrolledForm)parent;
+ if(scrolledForm!=null){
+ scrolledForm.reflow(flushCashes);
+ scrolledForm.redraw();
+ }
+ }
+
/**
* <p>getUndoContext</p>
return TaxeditorStorePlugin.PLUGIN_ID;
}
- /**
- *
- * @return
- */
- public static IEditorInput getActiveEditorInput() {
- IEditorPart activeEditor = getActiveEditor();
- if (activeEditor != null){
- return activeEditor.getEditorInput();
- }
- return null;
- }
}
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IMemento;
-
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.cdm.model.common.TermBase;
import eu.etaxonomy.cdm.model.common.TermType;
import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
/**
* @author n.hoffmann
* @created Dec 7, 2010
* @version 1.0
*/
-public class TermManager extends ContextListenerAdapter{
+public class TermManager {
private static final String TERMS = "terms";
private static final String TERM = "term";
private static final String CLASS = "class";
private static final String UUID_STRING = "uuid";
- private final Map<String, Collection<UUID>> hiddenTermsMap = new HashMap<String, Collection<UUID>>();
-
public TermManager(){
- CdmStore.getContextManager().addContextListener(this);
}
/**
return getFilteredTerms(TermStore.getTerms(clazz));
}
- @Override
- public void contextStart(IMemento memento, IProgressMonitor monitor) {
- // read preferred terms from memento into an in memory representation
- if(memento == null){
- return;
- }
-
- IMemento terms = memento.getChild(TERMS);
-
- if(terms == null){
- return;
- }
-
- for(IMemento term : terms.getChildren(TERM)){
- String typeName = term.getString(CLASS);
- Collection<UUID> hiddenTermUuids = new ArrayList<UUID>();
- for(IMemento hide : term.getChildren(HIDE)){
- String uuidString = hide.getString(UUID_STRING);
- UUID uuid = UUID.fromString(uuidString);
- hiddenTermUuids.add(uuid);
- }
- hiddenTermsMap.put(typeName, hiddenTermUuids);
- }
- }
-
- @Override
- public void contextStop(IMemento memento, IProgressMonitor monitor) {
- saveTerms(memento, monitor);
- }
-
- @Override
- public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
- saveTerms(memento, monitor);
- }
-
- private void saveTerms(IMemento memento, IProgressMonitor monitor){
- if(memento == null) {
- return;
- }
-
- IMemento terms = memento.createChild(TERMS);
- for (String preferredTerm : hiddenTermsMap.keySet()){
- IMemento term = terms.createChild(TERM);
- term.putString(CLASS, preferredTerm);
- for(UUID uuid : hiddenTermsMap.get(preferredTerm)){
- IMemento hide = term.createChild(HIDE);
- hide.putString(UUID_STRING, uuid.toString());
- }
- }
- }
-
/**
* Generic method to get term preferences for a term vocabulary
*
List<T> filteredTerms = new ArrayList<T>();
- String typeName = getTermClass(initialTerms);
- Collection<UUID> hiddenTermUuids = hiddenTermsMap.get(typeName);
-
-
- if(hiddenTermUuids == null){
- return initialTerms;
- }
-
for (T term : initialTerms){
+
if (term instanceof TaxonRelationshipTypeInverseContainer){
- if(! hiddenTermUuids.contains(((TaxonRelationshipTypeInverseContainer) term).getType().getUuid())){
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(getPrefName(term))){
T type = (T)((TaxonRelationshipTypeInverseContainer) term).getType();
filteredTerms.add(type);
}
}
- if(! hiddenTermUuids.contains(term.getUuid())){
+
+ if(!PreferencesUtil.getPreferenceStore().getBoolean(getPrefName(term))){
filteredTerms.add(term);
}
}
return filteredTerms;
}
+ private <T extends TermBase> String getPrefName(T term) {
+ return term.getTermType()!=null?term.getTermType().toString()+term.getUuid().toString():""+term.getUuid().toString();
+ }
+
+
private <T extends DefinedTermBase> String getTermClass(Collection<T> initialTerms){
String result = null;
return null;
}
-// /**
-// * <p>getPreferredSpecimenTypeDesignationStatus</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<SpecimenTypeDesignationStatus> getPreferredSpecimenTypeDesignationStatus() { return getFilteredTerms(TermStore.getSpecimenTypeDesignationStatus());}
-//
-// /**
-// * <p>getPreferredNameTypeDesignationStatus</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<NameTypeDesignationStatus> getPreferredNameTypeDesignationStatus() { return getFilteredTerms(TermStore.getNameTypeDesignationStatus()); }
-//
-// /**
-// * <p>getPreferredTaxonRelationshipTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<TaxonRelationshipType> getPreferredTaxonRelationshipTypes() { return getFilteredTerms(TermStore.getTaxonRelationshipTypes());}
-//
-// private static List<TaxonRelationshipType> excludeTaxonRelationshipTypes = Arrays.asList(new TaxonRelationshipType[]{
-// TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN(),
-// TaxonRelationshipType.MISAPPLIED_NAME_FOR(),
-// TaxonRelationshipType.ALL_RELATIONSHIPS()
-// });
-//
-// /**
-// * Please note that the {@link TaxonRelationshipType}s TAXONOMICALLY_INCLUDED_IN, MISAPPLIED_NAME_FOR and ALL_RELATIONSHIPS
-// * are filtered out as they are most likely not needed. If you do need them please refactor this method to your needs.
-// *
-// * @return a list of {@link TaxonRelationshipTypeInverseContainer} elements
-// */
-// public List<TaxonRelationshipTypeInverseContainer> getPreferredRelationshipTypesWithInverses(){
-// List<TaxonRelationshipTypeInverseContainer> relationshipTypeInverseContainers = new ArrayList<TaxonRelationshipTypeInverseContainer>();
-//
-// List<TaxonRelationshipType> relationshipTypes = getPreferredTaxonRelationshipTypes();
-//
-// relationshipTypes.removeAll(excludeTaxonRelationshipTypes);
-//
-// for (TaxonRelationshipType relationshipType : relationshipTypes){
-// if(!relationshipType.isSymmetric()){
-// TaxonRelationshipTypeInverseContainer inverseContainer = new TaxonRelationshipTypeInverseContainer(relationshipType, true);
-// relationshipTypeInverseContainers.add(inverseContainer);
-// }
-// TaxonRelationshipTypeInverseContainer container = new TaxonRelationshipTypeInverseContainer(relationshipType, false);
-// relationshipTypeInverseContainers.add(container);
-// }
-//
-// return relationshipTypeInverseContainers;
-// }
-
-
-
-
-//
-// /**
-// * <p>getPreferredFeatures</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Feature> getPreferredFeatures() { return getFilteredTerms(TermStore.getFeatures());}
-//
-// /**
-// * <p>getPreferredRanks</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Rank> getPreferredRanks() { return getFilteredTerms(TermStore.getRanks());}
-//
-// /**
-// * <p>getPreferredPresenceAbsenceTerms</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<PresenceAbsenceTermBase> getPreferredPresenceAbsenceTerms(){ return getFilteredTerms(TermStore.getPresenceAbsenceTerms());}
-//
-// /**
-// * <p>getPreferredNomenclaturalStatusTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<NomenclaturalStatusType> getPreferredNomenclaturalStatusTypes(){ return getFilteredTerms(TermStore.getNomenclaturalStatusTypes());}
-//
-// /**
-// * <p>getPreferredNameRelationshipTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<NameRelationshipType> getPreferredNameRelationshipTypes(){ return getFilteredTerms(TermStore.getNameRelationshipTypes());}
-//
-// /**
-// * <p>getPreferredLanguages</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Language> getPreferredLanguages() { return getFilteredTerms(TermStore.getLanguages()); }
-//
-// /**
-// * <p>getPreferredMarkerTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<MarkerType> getPreferredMarkerTypes() { return getFilteredTerms(TermStore.getNonTechnicalMarkerTypes()); }
-//
-// /**
-// * <p>getPreferredExtensionTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<ExtensionType> getPreferredExtensionTypes() { return getFilteredTerms(TermStore.getExtensionTypes()); }
-//
-// /**
-// * <p>getPreferredRightsTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<RightsType> getPreferredRightsTypes() { return getFilteredTerms(TermStore.getRightsTypes());}
-//
-// /**
-// * <p>getPreferredNamedAreaTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<NamedAreaType> getPreferredNamedAreaTypes() { return getFilteredTerms(TermStore.getNamedAreaTypes()); }
-//
-// /**
-// * <p>getPreferredNamedAreaTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<NamedAreaLevel> getPreferredNamedAreaLevels() { return getFilteredTerms(TermStore.getNamedAreaLevels()); }
-//
-// /**
-// * <p>getPreferredAnnotationTypes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<AnnotationType> getPreferredAnnotationTypes() { return getFilteredTerms(TermStore.getAnnotationTypes()); }
-//
-// /**
-// * <p>getPreferredStages</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Stage> getPreferredStages() { return getFilteredTerms(TermStore.getStages()); }
-//
-// /**
-// * <p>getPreferredPreservationMethods</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<PreservationMethod> getPreferredPreservationMethods() { return getFilteredTerms(TermStore.getPreservationMethods()); }
-//
-// /**
-// * <p>getPreferredMeasurementUnits</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<MeasurementUnit> getPreferredMeasurementUnits() { return getFilteredTerms(TermStore.getMeasurementUnits()); }
-//
-// /**
-// * <p>getPreferredStates</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<State> getPreferredStates() { return getFilteredTerms(TermStore.getStates()); }
-//
-// /**
-// * <p>getPreferredModifiers</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Modifier> getPreferredModifiers() { return getFilteredTerms(TermStore.getModifiers()); }
-//
-// /**
-// * <p>getPreferredStatisticalMeasures</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<StatisticalMeasure> getPreferredStatisticalMeasures() { return getFilteredTerms(TermStore.getStatisticalMeasures()); }
-//
-// /**
-// * <p>getPreferredScopes</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<Scope> getPreferredScopes() { return getFilteredTerms(TermStore.getScopes()); }
-//
-// /**
-// * <p>getPreferredDeterminationModifiers</p>
-// *
-// * @return a {@link java.util.List} object.
-// */
-// public List<DeterminationModifier> getPreferredDeterminationModifiers() { return getFilteredTerms(TermStore.getDeterminationModifiers()); }
-//
/**
* Generic method to set term preferences
*
* @param <T> a T object.
*/
public <T extends DefinedTermBase> void setPreferredTerms(Collection<T> preferredTerms, Collection<T> initialTerms){
- String typeName = getTermClass(initialTerms);
+ String typeName = getTermClass(initialTerms);
Collection<UUID> undesiredTermUuids = new ArrayList<UUID>();
for(TermBase term : initialTerms){
if(! preferredTerms.contains(term)){
undesiredTermUuids.add(term.getUuid());
+ PreferencesUtil.getPreferenceStore().setValue(getPrefName(term), true);
+ }else{
+ PreferencesUtil.getPreferenceStore().setValue(getPrefName(term), false);
}
- }
- hiddenTermsMap.put(typeName, undesiredTermUuids);
+
+ }
}
}
--- /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.ui;
+
+import javax.inject.Inject;
+
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+
+/**
+ * @author pplitzner
+ * @since Oct 15, 2017
+ *
+ */
+public abstract class EditViewerDropAdapter extends ViewerDropAdapter {
+
+ @Inject
+ protected UISynchronize sync;
+
+ public EditViewerDropAdapter(Viewer viewer) {
+ super(viewer);
+ }
+
+}
*/
package eu.etaxonomy.taxeditor.ui.combo;
-import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.forms.widgets.TableWrapData;
protected Label label;
- protected final Combo combo;
+ protected final CCombo combo;
public AbstractComboElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
addControl(label);
// create combo
- ComboViewer viewer = new ComboViewer(getLayoutComposite(), SWT.BORDER | SWT.READ_ONLY );
- combo = viewer.getCombo();
+ combo = new CCombo(getLayoutComposite(), SWT.READ_ONLY|SWT.BORDER);
+
addControl(combo);
TableWrapData fill_HORIZONTALLY = LayoutConstants.FILL_HORIZONTALLY();
combo.setLayoutData(fill_HORIZONTALLY);
fill_HORIZONTALLY.maxWidth = 50;
combo.setVisibleItemCount(DEFAULT_VISIBLE_ITEMS);
+
+ //disable mouse-wheel selection
+ combo.addListener(SWT.MouseWheel, e->e.doit=false);
}
/** {@inheritDoc} */
if (label != null) {
label.setBackground(color);
}
- colorId = !irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT
- : Resources.COLOR_COMPOSITE_BACKGROUND;
- color = AbstractUtility.getColor(colorId);
- combo.setForeground(color);
}
public void setTermComparator(Comparator<T> termComparator) {
this.termComparator = termComparator;
List<T> termsWithoutNull = terms.subList(1, terms.size());
-
+
populateTerms(termsWithoutNull);
-
+
}
private final TermType termType;
}
}
- if (selection != null && index == 0) {
+ if (selection != null && index == 0) {
createTermNotInPreferredTerms(selection);
}
combo.select(index);
+
}
protected List<T> getPreferredTerms(){
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
private void refreshCdmServer() {
- txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
- clearOnServerChange();
- emptyCredentials();
- updateSelectedCdmServer();
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- checkSelectedCdmServer();
- }
- });
-
+ try{
+ txtCdmServerStatus.setText(STATUS_CHECKING_AVAILABILITY);
+ clearOnServerChange();
+ emptyCredentials();
+ updateSelectedCdmServer();
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ checkSelectedCdmServer();
+ }
+ });
+ }
+ catch(SWTException e){
+ //catch widget is disposed exception which may occurr if
+ //dialog is closed but the runnable tries to update
+ }
}
private void updateSelectedCdmServer() {
--- /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.ui.dialog.configurator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.PojoProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
+/**
+ * @author k.luther
+ * @date 10.10.2017
+ *
+ */
+public class PublishSubTreeConfiguratorWizardPage extends WizardPage implements Listener, SelectionListener {
+
+ private DataBindingContext m_bindingContext;
+
+ private final static CdmFormFactory toolkit = new CdmFormFactory(Display.getCurrent());
+ private final PublishForSubtreeConfigurator configurator;
+
+ private Button btnIncludeAcceptedTaxa;
+ private Button btnIncludeSynonyms;
+ private Button btnIncludeSharedTaxa;
+
+ private Combo btnPublish;
+
+
+ /**
+ * @param string
+ */
+ public PublishSubTreeConfiguratorWizardPage(PublishForSubtreeConfigurator configurator) {
+ super("Set Publish Flag Configuration");
+ this.configurator = configurator;
+
+ this.setDescription(Messages.SetPublishConfiguration_Description_Configurator);
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+
+ final Composite composite = new Composite(parent, SWT.NULL);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+
+ composite.setLayout(gridLayout);
+ final Composite control = new Composite(composite, SWT.NULL);
+ GridLayout gridLayoutControl = new GridLayout();
+
+ control.setLayout(gridLayoutControl);
+ control.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
+
+ btnPublish = new Combo(control, SWT.BORDER| SWT.READ_ONLY);
+ btnPublish.setText(Messages.SetPublishConfiguration_Publish);
+ btnPublish.setToolTipText(Messages.SetPublishConfiguration_Publish_tooltip);
+ btnPublish.add(Messages.SetPublishConfiguration_publish, 0);
+ btnPublish.add(Messages.SetPublishConfiguration_dont_publish,1);
+ if (configurator.isPublish()){
+ btnPublish.select(0);
+ }else{
+ btnPublish.select(1);
+ }
+ btnPublish.addSelectionListener(this);
+
+
+ // Composite control = toolkit.createComposite(composite);
+ btnIncludeAcceptedTaxa = new Button(control, SWT.CHECK);
+ btnIncludeAcceptedTaxa.setText(Messages.SetPublishConfiguration_IncludeAcceptedTaxa);
+ btnIncludeAcceptedTaxa.setSelection(configurator.isIncludeAcceptedTaxa());
+ btnIncludeAcceptedTaxa.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) btnIncludeAcceptedTaxa.getLayoutData();
+ data.exclude = b.getSelection();
+
+ btnIncludeSharedTaxa.setVisible(data.exclude);
+ if (!btnIncludeSynonyms.getSelection() && !data.exclude){
+ setPageComplete(false);
+ }else{
+ setPageComplete(true);
+ }
+ }
+ });
+
+
+ btnIncludeSharedTaxa = new Button(control, SWT.CHECK);
+ GridData gd_btnIncludeSharedTaxa = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+ gd_btnIncludeSharedTaxa.horizontalIndent = 10;
+ btnIncludeSharedTaxa.setLayoutData(gd_btnIncludeSharedTaxa);
+ btnIncludeSharedTaxa.setText(Messages.SetPublishConfiguration_IncludeSharedtaxa);
+ btnIncludeSharedTaxa.setSelection(configurator.isIncludeSharedTaxa());
+
+ btnIncludeSynonyms = new Button(control, SWT.CHECK);
+ btnIncludeSynonyms.setText(Messages.SetPublishConfiguration_IncludeSynonyms);
+ btnIncludeSynonyms.setSelection(configurator.isIncludeSynonyms());
+ btnIncludeSynonyms.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event e) {
+ Button b = (Button) e.widget;
+ GridData data = (GridData) btnIncludeSynonyms.getLayoutData();
+ data.exclude = b.getSelection();
+
+ if (!btnIncludeAcceptedTaxa.getSelection() && !data.exclude){
+ setPageComplete(false);
+ }else{
+ setPageComplete(true);
+ }
+
+ }
+ });
+
+
+ m_bindingContext = initDataBindings();
+ setControl(composite);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
+ */
+ @Override
+ public void handleEvent(Event event) {
+ // TODO Auto-generated method stub
+
+ }
+
+ protected DataBindingContext initDataBindings() {
+ DataBindingContext bindingContext = new DataBindingContext();
+
+ IObservableValue observeSelectionBtnIncludeAcceptedTaxa = WidgetProperties.selection().observe(btnIncludeAcceptedTaxa);
+ IObservableValue includeAcceptedTaxaConfiguratorObserveValue = PojoProperties.value("includeAcceptedTaxa").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIncludeAcceptedTaxa, includeAcceptedTaxaConfiguratorObserveValue, null, null);
+
+ IObservableValue observeSelectionBtnIncludeSynonyms = WidgetProperties.selection().observe(btnIncludeSynonyms);
+ IObservableValue includeSynonymsConfiguratorObserveValue = PojoProperties.value("includeSynonyms").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIncludeSynonyms, includeSynonymsConfiguratorObserveValue, null, null);
+
+
+ IObservableValue observeSelectionBtnIncludeSharedTaxal = WidgetProperties.selection().observe(btnIncludeSharedTaxa);
+ IObservableValue includeSharedTaxaConfiguratorObserveValue = PojoProperties.value("includeSharedTaxa").observe(configurator);
+ bindingContext.bindValue(observeSelectionBtnIncludeSharedTaxal, includeSharedTaxaConfiguratorObserveValue, null, null);
+
+// IObservableValue observeSelectionBtnPublish = WidgetProperties.selection().observe(btnPublish);
+// IObservableValue publishConfiguratorObserveValue = PojoProperties.value("publish").observe(configurator);
+// bindingContext.bindValue(observeSelectionBtnPublish, publishConfiguratorObserveValue, null, null);
+ return bindingContext;
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (btnPublish.getSelectionIndex() > 0){
+ configurator.setPublish(false);
+ } else{
+ configurator.setPublish(true);
+ }
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+}
--- /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.ui.dialog.configurator;
+
+import org.eclipse.jface.wizard.Wizard;
+
+import eu.etaxonomy.cdm.api.service.config.PublishForSubtreeConfigurator;
+import eu.etaxonomy.taxeditor.l10n.Messages;
+
+/**
+ * @author k.luther
+ * @date 11.10.2017
+ *
+ */
+public class SetPublishForSubtreeWizard extends Wizard {
+
+ private final PublishForSubtreeConfigurator configurator;
+ private PublishSubTreeConfiguratorWizardPage page;
+
+
+ /**
+ * @param parentShell
+ * @param dialogTitle
+ * @param dialogTitleImage
+ * @param dialogMessage
+ * @param dialogImageType
+ * @param dialogButtonLabels
+ * @param defaultIndex
+ * @param config
+ */
+ public SetPublishForSubtreeWizard(PublishForSubtreeConfigurator config) {
+ super();
+ this.configurator = config;
+ setNeedsProgressMonitor(true);
+ this.setWindowTitle(Messages.SetPublishConfiguration_Title);
+
+ }
+
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performFinish() {
+ if (!(configurator.isIncludeAcceptedTaxa() || configurator.isIncludeSynonyms())){
+ return false;
+ }else{
+ return true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void addPages() {
+ page = new PublishSubTreeConfiguratorWizardPage(configurator);
+ addPage(page);
+ }
+
+
+
+}
import org.eclipse.core.databinding.beans.PojoProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.ResourceManager;
-import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
private DataBindingContext m_bindingContext;
private final static CdmFormFactory toolkit = new CdmFormFactory(Display.getCurrent());
- private final SetSecundumForSubtreeConfigurator configurator;
+ private final SecundumForSubtreeConfigurator configurator;
private Button btnBrowseReference = null;
-
+
private Text textReference = null;
private Button btnClear = null;
private EntitySelectionElement<Reference> selectReference;
* @param parent
* @param style
*/
- public SetSecundumConfiguratorWizardPage(SetSecundumForSubtreeConfigurator configurator, Wizard parent, int style ) {
+ public SetSecundumConfiguratorWizardPage(SecundumForSubtreeConfigurator configurator) {
super("Set Secundum Reference Configuration");
this.configurator = configurator;
this.setDescription(Messages.SetSecundumConfiguration_Description_Configurator);
+
// addDisposeListener(new DisposeListener() {
// @Override
// public void widgetDisposed(DisposeEvent e) {
compositeRef.setLayout(gridLayoutRef);
compositeRef.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
- Label label = new Label(compositeRef, SWT.NONE);
+ Label label = new Label(compositeRef, SWT.WRAP);
label.setText(Messages.SetSecundumConfiguration_NewSecundum_Label);
label.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false));
btnBrowseReference = new Button(compositeRef, SWT.NONE);
btnBrowseReference.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
btnBrowseReference.addListener(SWT.Selection, this);
-
+
btnClear = new Button(compositeRef, SWT.NONE);
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
btnClear.addListener(SWT.Selection, this);
- Label labelDescription = new Label(compositeRef, SWT.NONE);
+ Label labelDescription = new Label(compositeRef, SWT.WRAP);
labelDescription.setText(Messages.SetSecundumConfiguration_Description);
- GridData gd_labelDescription = new GridData(SWT.FILL, SWT.LEFT, true, false);
+ GridData gd_labelDescription = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
gd_labelDescription.horizontalSpan = 4;
labelDescription.setLayoutData(gd_labelDescription);
new Label(compositeRef, SWT.NONE);
new Label(compositeRef, SWT.NONE);
new Label(compositeRef, SWT.NONE);
-
+
// selectReference = toolkit.createSelectionElement(Rights.class, getConversationHolder(), composite, "Rights", null, EntitySelectionElement.SELECTABLE);
- final Composite control = new Composite(composite, SWT.NULL);
+ final Composite control = new Composite(composite, SWT.WRAP);
GridLayout gridLayoutControl = new GridLayout();
control.setLayout(gridLayoutControl);
gd_btnOverwriteExistingAccepted.horizontalIndent = 10;
btnOverwriteExistingAccepted.setLayoutData(gd_btnOverwriteExistingAccepted);
btnOverwriteExistingAccepted.setText(Messages.SetSecundumConfiguration_OverwriteExistingAccepted);
-
+
btnIncludeSharedTaxa = new Button(control, SWT.CHECK);
GridData gd_btnIncludeSharedTaxa = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_btnIncludeSharedTaxa.horizontalIndent = 10;
package eu.etaxonomy.taxeditor.ui.dialog.configurator;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import eu.etaxonomy.cdm.api.service.config.SetSecundumForSubtreeConfigurator;
+import eu.etaxonomy.cdm.api.service.config.SecundumForSubtreeConfigurator;
import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.l10n.Messages;
/**
* @author k.luther
public class SetSecundumForSubtreeConfigurationWizard extends Wizard {
Reference newSecRef;
- private final SetSecundumForSubtreeConfigurator configurator;
+ private final SecundumForSubtreeConfigurator configurator;
private SetSecundumConfiguratorWizardPage page;
* @param defaultIndex
* @param config
*/
- public SetSecundumForSubtreeConfigurationWizard(SetSecundumForSubtreeConfigurator config) {
+ public SetSecundumForSubtreeConfigurationWizard(SecundumForSubtreeConfigurator config) {
super();
// super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
this.configurator = config;
setNeedsProgressMonitor(true);
+ this.setWindowTitle(Messages.SetSecundumConfiguration_Title);
- /**
- * @param configurator
- * @param activeShell
- * @param setSecundumHandler_confirm
- * @param setSecundumHandler_configureSettings
- * @return
- */
- public static void openConfirmWithConfigurator(SetSecundumForSubtreeConfigurator configurator, Shell parent, String title, String message) {
-
- SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator);
- }
-
/** {@inheritDoc} */
@Override
public void addPages() {
- page = new SetSecundumConfiguratorWizardPage(configurator, this, SWT.NONE);
+ page = new SetSecundumConfiguratorWizardPage(configurator);
addPage(page);
}
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
}
}
- protected void reflowParentScrolledForm(boolean flushCashes){
- ScrolledForm scrolledForm = null;
- Composite parent = getLayoutComposite().getParent();
- while(parent!=null && !(parent instanceof ScrolledForm)){
- parent = parent.getParent();
- }
- scrolledForm = (ScrolledForm)parent;
- if(scrolledForm!=null){
- scrolledForm.reflow(flushCashes);
- }
- }
-
@Override
public void refresh() {
// empty default implementation
*/
@Override
public ConversationHolder getConversationHolder() {
- if(AbstractUtility.getActiveE4Part() instanceof IConversationEnabled){
- return ((IConversationEnabled) AbstractUtility.getActiveE4Part()).getConversationHolder();
+ if(AbstractUtility.getActivePart() instanceof IConversationEnabled){
+ return ((IConversationEnabled) AbstractUtility.getActivePart()).getConversationHolder();
}
if(getParentElement() instanceof RootElement || getParentElement() == null){
- Object activeEditor = AbstractUtility.getActiveE4Editor();
+ Object activeEditor = AbstractUtility.getActiveEditor();
if(activeEditor instanceof IConversationEnabled){
- ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveE4Editor()).getConversationHolder();
+ ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
return conversation;
}
}else if(getParentElement() instanceof IConversationEnabled){
package eu.etaxonomy.taxeditor.ui.element;
import java.net.URI;
-
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.eclipse.jface.layout.GridDataFactory;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.internal.forms.widgets.FormFonts;
import org.joda.time.DateTime;
-import org.joda.time.LocalDateTime;
-
import org.joda.time.Partial;
import org.springframework.security.core.GrantedAuthority;
import eu.etaxonomy.cdm.model.agent.Person;
import eu.etaxonomy.cdm.model.agent.Team;
import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.AnnotationType;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Credit;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.taxeditor.ui.dialog.CloneClassificationDetailElement;
import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection.UnitType;
import eu.etaxonomy.taxeditor.ui.mvc.element.DateElement;
-
import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
import eu.etaxonomy.taxeditor.ui.password.EditPasswordElement;
private MouseListener selectionMouseHandler;
private FocusListener selectionFocusHandler;
+ @Inject
+ private IEclipseContext context;
+
private final Set<SelectionListener> selectionListenerList = new HashSet<SelectionListener>();
private final List<IPropertyChangeListener> propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
}
}
- /**
- * <p>
- * Constructor for CdmFormFactory.
- * </p>
- *
- * @param display
- * a {@link org.eclipse.swt.widgets.Display} object.
- * @param selectionProvider
- * a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
- */
- public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
- super(display);
- this.selectionProvider = selectionProvider;
- init();
+ public CdmFormFactory(Display display) {
+ this(display, null);
}
- /**
- * <p>
- * Constructor for CdmFormFactory.
- * </p>
- *
- * @param display
- * a {@link org.eclipse.swt.widgets.Display} object.
- */
- public CdmFormFactory(Display display) {
+ public CdmFormFactory(Display display, ISelectionProvider selectionProvider) {
super(display);
+ this.selectionProvider = selectionProvider;
init();
}
- /**
- *
- */
private void init() {
boldFontHolder2 = new BoldFontHolder2();
selectionMouseHandler = new SelectionMouseHandler();
selectionFocusHandler = new SelectionFocusHandler();
}
+ public IEclipseContext getContext() {
+ return context;
+ }
+
/**
* Creates an instance initialized with the correct selectionProvider
*
@Override
public void adapt(Composite composite) {
composite.addMouseListener(selectionMouseHandler);
-
+
super.adapt(composite);
}
ICdmFormElement parentElement,
String labelString,
T selection,
- int style,
+ int style,
Comparator<T> comparator) {
return this.createDefinedTermComboElement(termType, null, parentElement, labelString, selection, true, style, false, comparator);
}
int style) {
return this.createDefinedTermComboElement(termType, null, parentElement, labelString, selection, addEmptyElement, style, false, null);
}
-
+
public <T extends DefinedTermBase> TermComboElement<T> createDefinedTermComboElement(
TermType termType,
ICdmFormElement parentElement,
String labelString,
- T selection,
+ T selection,
int style) {
return this.createDefinedTermComboElement(termType, null, parentElement, labelString, selection, true, style, false, null);
}
Comparator<T> comparator) {
if(termType!=null){
TermComboElement<T> element = new TermComboElement<T>(this, parentElement, termType, labelString, selection, addEmptyElement, style, useAbbrevLabel, comparator);
- if (comparator!= null){
- element.setTermComparator(comparator);
- }
adapt(element);
parentElement.addElement(element);
return element;
addAndAdaptElement(parentElement, element);
return element;
}
-
+
public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
NameDetailElement element = new NameDetailElement(this, parentElement, style);
addAndAdaptElement(parentElement, element);
// label.setText(labelText+" (yyyy-MM-dd)");
// DateElementFormElement dateElement = new DateElementFormElement(this, dateTime, style, formElement.getLayoutComposite());
// dateElement.initInternalController();
-//
+//
// return dateElement;
// }
-
+
public DateElement createDateElement(ICdmFormElement formElement, String labelText, DateTime dateTime, int style, boolean editableText){
Label label = new Label(formElement.getLayoutComposite(), style);
label.setText(labelText);
} else if (entity instanceof CommonTaxonName) {
detailedDescriptionElement = new CommonNameDetailElement(this, parentElement, (CommonTaxonName) entity,
style);
- } else if (entity instanceof Distribution) {
+ } else if (entity instanceof Distribution ) {
detailedDescriptionElement = new DistributionDetailElement(this, parentElement, (Distribution) entity,
style);
} else if (entity instanceof IndividualsAssociation) {
return section;
}
-
+
public TaxonOfRelationshipElement createTaxonOfRelationshipDetailElement(
ICdmFormElement parentElement, int style) {
TaxonOfRelationshipElement section = new TaxonOfRelationshipElement(this, parentElement, style);
// return element;
// }
-
+
/**
-* Copyright (C) 2007 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.
-*/
+ * Copyright (C) 2007 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.ui.element;
import org.eclipse.ui.forms.widgets.TableWrapData;
import eu.etaxonomy.cdm.common.UriUtils;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
*/
public class ImageElement extends AbstractCdmFormElement implements PaintListener{
- private URI imageUri;
- private Image image;
+ private URI imageUri;
+ private Image image;
- private Composite container;
+ private Composite container;
- private final Runnable postRunnable = new Runnable(){
+ private final Runnable postRunnable = new Runnable(){
@Override
public void run() {
- //FIXME E4 migrate
try{
- EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
- MPart detailsPart = partService.findPart("eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4");
- if(detailsPart!=null){
- ((AbstractCdmDataViewerE4) ((DetailsPartE4)detailsPart.getObject()).getViewer()).reflow();
- }
- MPart supplementalPart = partService.findPart("eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4");
- if(supplementalPart!=null){
- ((AbstractCdmDataViewerE4) ((SupplementalDataPartE4)supplementalPart.getObject()).getViewer()).reflow();
- }
+ EPartService partService = getFormFactory().getContext().get(EPartService.class);
+ DetailsPartE4 detailsView = AbstractUtility.getDetailsView(partService);
+ if(detailsView!=null){
+ AbstractCdmDataViewerE4 viewer = (AbstractCdmDataViewerE4) detailsView.getViewer();
+ if(viewer!=null){
+ viewer.reflow();
+ }
+ }
+
+ MPart mPartSupplemental = partService.findPart("eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4");
+ if(mPartSupplemental!=null){
+ SupplementalDataPartE4 supplementalPart = (SupplementalDataPartE4)mPartSupplemental.getObject();
+ if(supplementalPart!=null){
+ AbstractCdmDataViewerE4 viewer = (AbstractCdmDataViewerE4) (supplementalPart).getViewer();
+ if(viewer!=null){
+ viewer.refresh();
+ }
+ }
+ }
}
catch(IllegalStateException e){
//when migrating to E4 this execption should not be thrown anymore
}
};
- protected ImageElement(CdmFormFactory formFactory, ICdmFormElement parentElement, URI imageUri, int style) {
- super(formFactory, parentElement);
-
- container = new Composite(getLayoutComposite(), style);
- container.setLayoutData(LayoutConstants.FILL(2, 1));
-
- container.addPaintListener(this);
- }
-
- public void initImageUri(URI uri) throws IOException, HttpException {
- this.imageUri = uri;
- InputStream imageStream = UriUtils.getInputStream(imageUri);
- image = new Image(Display.getCurrent(), imageStream);
- }
-
-
- public URI getImageUri() {
- return imageUri;
- }
-
- public void loadImage(){
- if(getImageUri() != null){
- Job job = new Job("Loading image") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
- try {
- runnable.run(monitor);
- } catch (Exception e) {
- MessagingUtils.messageDialog("Could not load image", getClass(), e.getMessage() + ": " + getImageUri(), e);
- }
-
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
- }
-
- public void unloadImage() {
- Job job = new Job("Unloading image") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
- try {
- runnable.run(monitor);
- } catch (Exception e) {
- MessagingUtils.messageDialog("Could not unload image", getClass(), e.getMessage() + ": " + getImageUri(), e);
- }
-
- return Status.OK_STATUS;
- }
- };
- job.schedule();
-
- }
-
- public IRunnableWithProgress getLoadImageRunnable(final Runnable postRunnable){
-
- final Display display = getLayoutComposite().getDisplay();
-
- IRunnableWithProgress runnable = new IRunnableWithProgress(){
-
- @Override
- public void run(IProgressMonitor monitor) {
- monitor.beginTask("Loading: " + getImageUri(), IProgressMonitor.UNKNOWN);
-
- // redraw the image container
- display.asyncExec(new Runnable(){
- @Override
- public void run() {
- if(! getLayoutComposite().isDisposed() && container!=null){
- Event untypedEvent = new Event();
- untypedEvent.widget = container;
- PaintEvent event = new PaintEvent(untypedEvent);
- event.gc = new GC(container);
- paintControl(event);
- getLayoutComposite().layout();
- }
- }
- });
-
- // execute the external runnable
- if(postRunnable != null){
- display.asyncExec(postRunnable);
- }
- monitor.done();
- }
-
- };
-
- return runnable;
- }
-
- private Rectangle calculateImageBounds(Image image, Control control){
- Rectangle imageBounds = image.getBounds();
- Rectangle containerBounds = control.getBounds();
-
- Integer imgWidth = imageBounds.width;
- Integer imgHeight = imageBounds.height;
-
- Float ratio = imgHeight.floatValue()/imgWidth.floatValue();
- Integer width = containerBounds.width;
- Integer height = ((Float) (width * ratio)).intValue();
-
- return new Rectangle(containerBounds.x, containerBounds.y, width, height);
- }
-
- public void dispose(){
- if(image!=null){
- image.dispose();
- image = null;
- }
- imageUri = null;
- if(container!=null){
- container.dispose();
- container = null;
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void paintControl(PaintEvent e) {
- TableWrapData layoutData = LayoutConstants.FILL(2, 1);
- Control control = (Control) e.widget;
- if(image != null){
- Rectangle imageMaxBounds = calculateImageBounds(image, control);
- layoutData.heightHint = imageMaxBounds.height;
- e.gc.drawImage(image, 0, 0, image.getBounds().width, image.getBounds().height, 0, 0, imageMaxBounds.width, imageMaxBounds.height);
- }else{
- layoutData.heightHint = 10;
- e.gc.drawRectangle(0, 0, 0, 10);
- }
- control.setLayoutData(layoutData);
- e.gc.dispose();
- }
+ protected ImageElement(CdmFormFactory formFactory, ICdmFormElement parentElement, URI imageUri, int style) {
+ super(formFactory, parentElement);
+
+ container = new Composite(getLayoutComposite(), style);
+ container.setLayoutData(LayoutConstants.FILL(2, 1));
+
+ container.addPaintListener(this);
+ }
+
+ public void initImageUri(URI uri) throws IOException, HttpException {
+ this.imageUri = uri;
+ InputStream imageStream = UriUtils.getInputStream(imageUri);
+ image = new Image(Display.getCurrent(), imageStream);
+ }
+
+
+ public URI getImageUri() {
+ return imageUri;
+ }
+
+ public void loadImage(){
+ if(getImageUri() != null){
+ Job job = new Job("Loading image") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
+ try {
+ runnable.run(monitor);
+ } catch (Exception e) {
+ MessagingUtils.messageDialog("Could not load image", getClass(), e.getMessage() + ": " + getImageUri(), e);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ }
+
+ public void unloadImage() {
+ Job job = new Job("Unloading image") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IRunnableWithProgress runnable = getLoadImageRunnable(postRunnable);
+ try {
+ runnable.run(monitor);
+ } catch (Exception e) {
+ MessagingUtils.messageDialog("Could not unload image", getClass(), e.getMessage() + ": " + getImageUri(), e);
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+
+ }
+
+ public IRunnableWithProgress getLoadImageRunnable(final Runnable postRunnable){
+
+ final Display display = getLayoutComposite().getDisplay();
+
+ IRunnableWithProgress runnable = new IRunnableWithProgress(){
+
+ @Override
+ public void run(IProgressMonitor monitor) {
+ monitor.beginTask("Loading: " + getImageUri(), IProgressMonitor.UNKNOWN);
+
+ // redraw the image container
+ display.asyncExec(new Runnable(){
+ @Override
+ public void run() {
+ if(! getLayoutComposite().isDisposed() && container!=null){
+ Event untypedEvent = new Event();
+ untypedEvent.widget = container;
+ PaintEvent event = new PaintEvent(untypedEvent);
+ event.gc = new GC(container);
+ paintControl(event);
+ getLayoutComposite().layout();
+ }
+ }
+ });
+
+ // execute the external runnable
+ if(postRunnable != null){
+ display.asyncExec(postRunnable);
+ }
+ monitor.done();
+ }
+
+ };
+
+ return runnable;
+ }
+
+ private Rectangle calculateImageBounds(Image image, Control control){
+ Rectangle imageBounds = image.getBounds();
+ Rectangle containerBounds = control.getBounds();
+
+ Integer imgWidth = imageBounds.width;
+ Integer imgHeight = imageBounds.height;
+
+ Float ratio = imgHeight.floatValue()/imgWidth.floatValue();
+ Integer width = containerBounds.width;
+ Integer height = ((Float) (width * ratio)).intValue();
+
+ return new Rectangle(containerBounds.x, containerBounds.y, width, height);
+ }
+
+ public void dispose(){
+ if(image!=null){
+ image.dispose();
+ image = null;
+ }
+ imageUri = null;
+ if(container!=null){
+ container.dispose();
+ container = null;
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void paintControl(PaintEvent e) {
+ TableWrapData layoutData = LayoutConstants.FILL(2, 1);
+ Control control = (Control) e.widget;
+ if(image != null){
+ Rectangle imageMaxBounds = calculateImageBounds(image, control);
+ layoutData.heightHint = imageMaxBounds.height;
+ e.gc.drawImage(image, 0, 0, image.getBounds().width, image.getBounds().height, 0, 0, imageMaxBounds.width, imageMaxBounds.height);
+ }else{
+ layoutData.heightHint = 10;
+ e.gc.drawRectangle(0, 0, 0, 10);
+ }
+ control.setLayoutData(layoutData);
+ e.gc.dispose();
+ }
}
/**
* 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.
*/
package eu.etaxonomy.taxeditor.ui.group.grantedauthority;
+import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.nebula.widgets.compositetable.CompositeTable;
import org.eclipse.nebula.widgets.compositetable.IRowContentProvider;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.FormToolkit;
import eu.etaxonomy.taxeditor.dnd.CdmAuthorityTableDropTargetListener;
-import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
/**
* Composite class which consists of a {@link CompositeTable} built specifically
* for creating / editing CDM Authority objects
- *
+ *
* @author cmathew
* @created Mar 28, 2013
*
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private CompositeTable table;
-
+
private int numOfInitialCdmAuthorities;
-
+
private CdmAuthorityCompositeViewer viewer;
-
+
private CdmAuthorityTableHeader cdmAuthorityTableHeader;
-
+
/**
* Creates the composite using the given parent, style and associated viewer.
- *
+ *
* @param parent composite to use as parent of this composite
- * @param style
+ * @param style
* @param viewer viewer representing the model
*/
public CdmAuthorityComposite(Composite parent, int style, final CdmAuthorityCompositeViewer viewer) {
super(parent, SWT.NONE);
addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
toolkit.dispose();
}
});
-
+
this.viewer = viewer;
-
+
numOfInitialCdmAuthorities = viewer.getCdmAuthorities().size();
setLayout(new GridLayout(2, false));
setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- Transfer[] transfers = new Transfer[] { TaxonNodeTransfer.getInstance() };
-
+ Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
+
toolkit.adapt(this);
toolkit.paintBordersFor(this);
new Label(this, SWT.NONE);
-
+
final Button cbShowUUIDheader = new Button(this, SWT.CHECK);
cbShowUUIDheader.addSelectionListener(new SelectionAdapter() {
@Override
table.setLayoutData(gd_table);
cdmAuthorityTableHeader = new CdmAuthorityTableHeader(table, SWT.NULL);
CdmAuthorityRow cdmAuthorityRow = new CdmAuthorityRow(table, SWT.NULL);
-
+
table.setRunTime(true);
table.setNumRowsInCollection(numOfInitialCdmAuthorities);
- table.setLinesVisible(true);
-
+ table.setLinesVisible(true);
+
DropTarget dropTarget = new DropTarget(table, DND.DROP_MOVE);
dropTarget.setTransfer(transfers);
dropTarget.addDropListener(new CdmAuthorityTableDropTargetListener(viewer));
-
-
+
+
table.addRowContentProvider(new IRowContentProvider() {
- public void refresh(CompositeTable sender, int currentObjectOffset, Control rowControl) {
- CdmAuthorityRow row = (CdmAuthorityRow) rowControl;
+ @Override
+ public void refresh(CompositeTable sender, int currentObjectOffset, Control rowControl) {
+ CdmAuthorityRow row = (CdmAuthorityRow) rowControl;
// add the newly created authority objects first and then the already existing ones.
// this ensures the newly 'dragged' in objects always remain at the top
- if(currentObjectOffset < viewer.getNewCdmAuthorities().size()) {
- row.setRowCdmAuthority(viewer,
- viewer.getNewCdmAuthorities().get(currentObjectOffset),
+ if(currentObjectOffset < viewer.getNewCdmAuthorities().size()) {
+ row.setRowCdmAuthority(viewer,
+ viewer.getNewCdmAuthorities().get(currentObjectOffset),
true,
cbShowUUIDheader.getSelection());
} else {
- row.setRowCdmAuthority(viewer,
- viewer.getCdmAuthorities().get(currentObjectOffset - viewer.getNewCdmAuthorities().size()),
+ row.setRowCdmAuthority(viewer,
+ viewer.getCdmAuthorities().get(currentObjectOffset - viewer.getNewCdmAuthorities().size()),
false,
cbShowUUIDheader.getSelection());
- }
+ }
}
});
- }
+ }
/**
* Refreshes the table with underlying data
*/
- public void refresh() {
- numOfInitialCdmAuthorities = viewer.getNewCdmAuthorities().size() + viewer.getCdmAuthorities().size();
- table.setNumRowsInCollection(numOfInitialCdmAuthorities);
+ public void refresh() {
+ numOfInitialCdmAuthorities = viewer.getNewCdmAuthorities().size() + viewer.getCdmAuthorities().size();
+ table.setNumRowsInCollection(numOfInitialCdmAuthorities);
table.refreshAllRows();
}
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.springframework.security.core.GrantedAuthority;
/**
* Viewer class for the {@link CdmAuthorityComposite} used in the editing of CDM Authorities.
- *
+ *
* @author cmathew
* @created Mar 28, 2013
*
//FIXME:move warning dialogs to the table class
public class CdmAuthorityCompositeViewer extends ContentViewer {
-
- private IDirtyMarkable dirtyMarkerEditor;
+
+ private IDirtyMarkable dirtyMarkerEditor;
private CdmAuthorityComposite cdmAuthorityComposite;
private Group group;
private boolean isDirty = false;
private List<GrantedAuthorityImpl> cdmAuthorities;
/**
* List which contains newly added (unsaved) authority objects.
- * Used to make sure that new authority objects are always added
+ * Used to make sure that new authority objects are always added
* to the top of the table.
*/
private List<GrantedAuthorityImpl> newCdmAuthorities;
-
-
+
+
/**
- * Creates a viewer with a {@link CdmAuthorityComposite} table, {@link Group} object as input
- *
+ * Creates a viewer with a {@link CdmAuthorityComposite} table, {@link Group} object as input
+ *
* @param composite parent of generated {@link CdmAuthorityComposite}
* @param dirtyMarkerEditor provider to mark as dirty
* @param group input data object
*/
public CdmAuthorityCompositeViewer(Composite composite,
- IDirtyMarkable dirtyMarkerEditor,
+ IDirtyMarkable dirtyMarkerEditor,
Group group) {
this.dirtyMarkerEditor = dirtyMarkerEditor;
this.group = group;
- newCdmAuthorities = new ArrayList<GrantedAuthorityImpl>();
+ newCdmAuthorities = new ArrayList<GrantedAuthorityImpl>();
updateAuthorities();
-
+
ScrolledComposite sc = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
this.cdmAuthorityComposite = new CdmAuthorityComposite(sc, SWT.H_SCROLL | SWT.V_SCROLL, this);
sc.setContent(cdmAuthorityComposite);
/**
* Gets the {@link CdmAuthorityComposite}
- *
+ *
* @return {@link CdmAuthorityComposite} generated by this viewer
*/
public CdmAuthorityComposite getCdmAuthorityComposite() {
return cdmAuthorityComposite;
}
-
-
+
+
/**
* Retrieves the {@link GrantedAuthorityImpl} objects of the group attached to this viewer
* creates a sub-list of only {@link CdmAuthority} objects.
- *
+ *
* @return list of {@link CdmAuthority} objects belonging to the input group
*/
public List<GrantedAuthorityImpl> updateAuthorities() {
// get all granted authorities
Set<GrantedAuthority> grantedAuthorities = group.getGrantedAuthorities();
- cdmAuthorities = new ArrayList<GrantedAuthorityImpl>();
-
- Iterator<GrantedAuthority> itr = grantedAuthorities.iterator();
+ cdmAuthorities = new ArrayList<GrantedAuthorityImpl>();
+
+ Iterator<GrantedAuthority> itr = grantedAuthorities.iterator();
while (itr.hasNext()) {
GrantedAuthority grantedAuthority = itr.next();
try {
-
- if(grantedAuthority != null && grantedAuthority instanceof GrantedAuthorityImpl) {
+
+ if(grantedAuthority != null && grantedAuthority instanceof GrantedAuthorityImpl) {
// create a cdm authority from a granted authority
// this could fail in which case an exception is thrown
CdmAuthority cdmAuthority = CdmAuthority.fromGrantedAuthority(grantedAuthority);
- cdmAuthorities.add((GrantedAuthorityImpl)grantedAuthority);
+ cdmAuthorities.add((GrantedAuthorityImpl)grantedAuthority);
}
} catch (Exception e) {
- // not a CdmAuthority
+ // not a CdmAuthority
//e.printStackTrace();
- }
+ }
}
return cdmAuthorities;
}
-
+
public boolean isDirty() {
return isDirty;
}
/**
* Adds a new {@link CdmAuthority} to the group attached to this viewer
* based on the input {@link CdmBase} object.
- *
+ *
* @param cb {@link CdmBase} object used to construct the cdm authority
*/
public void addCdmAuthority(CdmBase cb) {
// Default permission is to READ
EnumSet<CRUD> defaultOperation = EnumSet.noneOf(CRUD.class);
defaultOperation.add(CRUD.READ);
- CdmAuthority cdma = new CdmAuthority(cb, defaultOperation, cb.getUuid());
+ CdmAuthority cdma = new CdmAuthority(cb, defaultOperation);
GrantedAuthorityImpl gai;
-
+
try {
- // create a granted authrity from a cdm authority
+ // create a granted authrity from a cdm authority
gai = cdma.asNewGrantedAuthority();
- } catch (Exception e) {
+ } catch (Exception e) {
MessagingUtils.warningDialog("Parsing Error", this, "Could not parse authority string");
return;
}
// need to have a comparator which only checks permission class and uuid
if(cdmAuthorities.contains(gai) || newCdmAuthorities.contains(gai)) {
MessagingUtils.warningDialog("Duplicate CDM Authority", this, "Chosen CDM Authority is already attached to current group");
- } else {
+ } else {
group.addGrantedAuthority(gai);
newCdmAuthorities.add(gai);
isDirty = true;
- dirtyMarkerEditor.changed(group);
+ dirtyMarkerEditor.changed(group);
cdmAuthorityComposite.refresh();
}
}
-
+
/**
* Removes the given {@link GrantedAuthorityImpl} object from the list of
* granted authorities belonging to the group attached to this viewer.
- *
+ *
* @param gai {@link GrantedAuthorityImpl} object to remove
*/
public void removeCdmAuthority(GrantedAuthorityImpl gai) {
-
- if(cdmAuthorities.contains(gai)) {
- cdmAuthorities.remove(gai);
+
+ if(cdmAuthorities.contains(gai)) {
+ cdmAuthorities.remove(gai);
isDirty = true;
- } else {
+ } else {
newCdmAuthorities.remove(gai);
if(newCdmAuthorities.isEmpty() && !isDirty) {
isDirty = false;
}
}
- group.removeGrantedAuthority(gai);
- dirtyMarkerEditor.changed(group);
+ group.removeGrantedAuthority(gai);
+ dirtyMarkerEditor.changed(group);
cdmAuthorityComposite.refresh();
}
-
+
/**
* Updates an existing {@link GrantedAuthorityImpl} object using a {@link CdmAuthority} object.
- *
+ *
* @param grantedAuthorityI to update.
* @param cdmAuthority to use in updating the granted authority object.
*/
public GrantedAuthorityImpl updateGrantedAuthority(GrantedAuthorityImpl grantedAuthorityI, CdmAuthority cdmAuthority) {
if(grantedAuthorityI.getAuthority().equals(cdmAuthority.getAuthority())) {
-
+
} else {
try {
// since granted authority is just a wrapper object around a string
}
return grantedAuthorityI;
}
-
+
/**
* @return list of existing cdm authority objects
*/
public List<GrantedAuthorityImpl> getCdmAuthorities() {
return cdmAuthorities;
}
-
+
/**
* @return list of newly added cdm authority objects
*/
public List<GrantedAuthorityImpl> getNewCdmAuthorities() {
return newCdmAuthorities;
}
-
+
/**
* Empty the list of newly create autrity objects
newCdmAuthorities.clear();
}
-
+
/**
- *
- *
+ *
+ *
*/
public void save() {
- clearNewCdmAuthorities();
+ clearNewCdmAuthorities();
refresh();
-
- }
-
+
+ }
+
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.Viewer#getControl()
*/
public void refresh() {
updateAuthorities();
cdmAuthorityComposite.refresh();
-
+
}
/* (non-Javadoc)
@Override
public void setSelection(ISelection selection, boolean reveal) {
// TODO Auto-generated method stub
-
+
}
}
private boolean irrelevant;
private boolean enabled;
-
+
private LabelElement warnForReferencedObjects;
private EnumSet<CRUD> requiredCrud = null;
protected void updateContent() {
removeElements();
createControls(this, entity, SWT.WRAP);
- reflowParentScrolledForm(true);
+ StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
updateControlStates();
}
if (getParentElement() instanceof AbstractCdmDetailSection) {
((AbstractCdmDetailSection) getParentElement()).updateTitle();
}
- reflowParentScrolledForm(true);
+ StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
}
/**
public void setWarnForReferencedObjects(LabelElement warnForReferencedObjects) {
this.warnForReferencedObjects = warnForReferencedObjects;
}
-
+
public void setWarnForReferencingObjects(ICdmFormElement formElement){
if (getEntity() instanceof CdmBase){
CdmBase cdmBase = (CdmBase) getEntity();
if (cdmBase.getId() != 0){
Integer referencingObjectsCount = CdmStore.getCommonService().getReferencingObjectsCount(cdmBase);
-
+
if (referencingObjectsCount > 1){
setWarnForReferencedObjects(formFactory.createLabel(formElement, CdmUtils.Nz("The reference is referenced by " + referencingObjectsCount+ " objects, if you change it, it is changed for all these objects")));
getWarnForReferencedObjects().setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
getWarnForReferencedObjects().setLayout(LayoutConstants.FILL(2, 3));
getWarnForReferencedObjects().setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-
+
}
}
}
getWarnForReferencedObjects().setVisible(isVisible);
}
}
-
+
}
/**
-* Copyright (C) 2016 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.
-*/
+ * Copyright (C) 2016 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.ui.section.classification;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
/**
private T entity;
- private IWorkbench workbench;
-
-
-
- /**
- * <p>Constructor for AbstractNewEntityWizard.</p>
- *
- * @param <T> a T object.
- */
- public AbstractEditWizard(){
- setWindowTitle(String.format("New %s", getEntityName()));
- }
-
- /**
- * FIXME there might be a smarter way to do this,
- *
- * @return
- */
- protected abstract String getEntityName();
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- /** {@inheritDoc} */
- @Override
- public boolean performFinish() {
- saveEntity();
-
- conversation.commit();
- conversation.close();
- return true;
- }
-
- /**
- * <p>Getter for the field <code>entity</code>.</p>
- *
- * @return a T object.
- */
- public T getEntity() {
- return entity;
- }
-
- /**
- * <p>Setter for the field <code>entity</code>.</p>
- *
- * @param entity a T object.
- */
- public void setEntity(T entity){
- this.entity = entity;
- }
-
- /**
- * Adds the entity to the current persistence context
- */
- protected abstract void saveEntity();
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
- */
- /** {@inheritDoc} */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench != null ? workbench : AbstractUtility.getWorkbench();
-
-
- formFactory = new CdmFormFactory(Display.getCurrent(), null);
- conversation = CdmStore.createConversation();
-
-
- }
-
-
-
- /**
- * <p>getConversationHolder</p>
- *
- * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
- */
- @Override
- public ConversationHolder getConversationHolder() {
- return conversation;
- }
-
- /** {@inheritDoc} */
- @Override
- public void update(CdmDataChangeMap changeEvents) {}
-
- /**
- * @return the workbench
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
-
-
+ @Inject
+ private IEclipseContext context;
+
+ /**
+ * <p>Constructor for AbstractNewEntityWizard.</p>
+ *
+ * @param <T> a T object.
+ */
+ @Inject
+ public AbstractEditWizard(){
+ setWindowTitle(String.format("New %s", getEntityName()));
+ }
+
+ /**
+ * FIXME there might be a smarter way to do this,
+ *
+ * @return
+ */
+ protected abstract String getEntityName();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ /** {@inheritDoc} */
+ @Override
+ public boolean performFinish() {
+ saveEntity();
+
+ conversation.commit();
+ conversation.close();
+ return true;
+ }
+
+ /**
+ * <p>Getter for the field <code>entity</code>.</p>
+ *
+ * @return a T object.
+ */
+ public T getEntity() {
+ return entity;
+ }
+
+ /**
+ * <p>Setter for the field <code>entity</code>.</p>
+ *
+ * @param entity a T object.
+ */
+ public void setEntity(T entity){
+ this.entity = entity;
+ }
+
+ /**
+ * Adds the entity to the current persistence context
+ */
+ protected abstract void saveEntity();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
+ conversation = CdmStore.createConversation();
+ }
+
+
+
+ /**
+ * <p>getConversationHolder</p>
+ *
+ * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
+ */
+ @Override
+ public ConversationHolder getConversationHolder() {
+ return conversation;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void update(CdmDataChangeMap changeEvents) {}
}
package eu.etaxonomy.taxeditor.ui.section.classification;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.model.reference.Reference;
private Reference reference;
- public CloneClassificationWizard(Classification classification) {
+ @Inject
+ private IEclipseContext context;
+
+ @Inject
+ public CloneClassificationWizard() {
super();
conversationHolder = CdmStore.createConversation();
- formFactory = new CdmFormFactory(Display.getCurrent(), null);
+
+ }
+
+ public void init(Classification classification){
+ formFactory = new CdmFormFactory(context.get(Shell.class).getDisplay());
cloneClassificationWizardPage = new CloneClassificationWizardPage(formFactory, conversationHolder, classification);
addPage(cloneClassificationWizardPage);
}
package eu.etaxonomy.taxeditor.ui.section.description;
+import org.eclipse.e4.ui.di.UISynchronize;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.SWT;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.Feature;
import eu.etaxonomy.cdm.model.description.TextData;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
/**
* <p>DescriptionElementDetailSection class.</p>
final String label = "Change to " + destinationString;
- Action addAction = new Action("Change Type", Action.AS_PUSH_BUTTON) {
+ Action addAction = new Action("Change Type", IAction.AS_PUSH_BUTTON) {
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
boolean confirmed = MessagingUtils.confirmDialog("Confirmation", "Do you really want to change to "
+ destinationString + "? Current data will be lost.");
if (confirmed) {
- // FIXME
- ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
- getEntity(), StoreUtil.getDetailsView(), StoreUtil.getUndoContext());
- StoreUtil.executeOperation(operation);
+ EPartService partService = formFactory.getContext().get(EPartService.class);
+ DetailsPartE4 detailsView = AbstractUtility.getDetailsView(partService);
+ ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
+ getEntity(), detailsView, StoreUtil.getUndoContext());
+ AbstractUtility.executeOperation(operation, formFactory.getContext().get(UISynchronize.class));
}
}
};
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.api.service.NaturalLanguageGenerator;
import eu.etaxonomy.cdm.model.description.FeatureTree;
import eu.etaxonomy.cdm.model.description.TaxonDescription;
import eu.etaxonomy.cdm.model.description.TextData;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.LabelElement;
* @version 1.0
*/
public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<TaxonDescription> {
-
+
private static final Logger logger = Logger
.getLogger(NaturalLanguageDetailElement.class);
ICdmFormElement formElement) {
super(formFactory, formElement);
}
-
+
/** {@inheritDoc} */
@Override
protected void createControls(ICdmFormElement formElement,
TaxonDescription entity, int style) {
label = formFactory.createLabel(formElement, "Generating Natural Language Description ...");
-
+
if(entity.hasStructuredData()){
FetchNaturalLanguageDescriptionJob job = new FetchNaturalLanguageDescriptionJob("Retrieving Natural Language Description", entity);
job.schedule();
label.setText("Taxon Description does not contain structured data.");
}
}
-
+
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
*/
public void handleEvent(Object eventSource) {
// nothing gets edited, nothing gets updated
}
-
+
private class FetchNaturalLanguageDescriptionJob extends Job {
private TaxonDescription entity;
private NaturalLanguageGenerator generator = new NaturalLanguageGenerator();
private FeatureTree featureTree = PreferencesUtil.getDefaultFeatureTreeForStructuredDescription();
private Display display = Display.getCurrent();
-
+
public FetchNaturalLanguageDescriptionJob(String jobName, TaxonDescription entity){
super(jobName);
this.entity = entity;
}
-
+
@Override
protected IStatus run(IProgressMonitor monitor) {
String text = "";
-
+
if(featureTree != null){
CdmStore.createConversation();
try{
List<TextData> naturalLanguageDescription = generator.generateNaturalLanguageDescription(featureTree, entity, CdmStore.getDefaultLanguage());
-
+
for(TextData element : naturalLanguageDescription){
text += element.getText(CdmStore.getDefaultLanguage()) + " ";
}
else{
text = "Could not generate natural language description, because no Feature Tree was set.";
}
-
+
final String aggregatedText = text;
-
+
display.asyncExec(new Runnable(){
@Override
public void run() {
label.setText(aggregatedText);
- StoreUtil.reflowDetailsViewer();
+ AbstractUtility.reflowDetailsViewer(formFactory.getContext().get(EPartService.class));
}
-
+
});
-
+
return Status.OK_STATUS;
}
-
+
}
}
private EntitySelectionElement<NamedArea> selection_namedArea;
private TermComboElement<PresenceAbsenceTerm> combo_presenceAbsence;
+ private boolean namedAreaEditable = true;
/**
public DistributionDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement, Distribution entity, int style) {
super(formFactory, formElement, entity, style);
+
}
/** {@inheritDoc} */
selection_namedArea = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
formElement, "Area",
entity.getArea(), EntitySelectionElement.NOTHING, style);
+ ICdmFormElement parent = this.getParentElement();
+
combo_presenceAbsence = formFactory.createTermComboElement(PresenceAbsenceTerm.class, this, "Distribution Status", entity.getStatus(), style);
}
EntitySelectionElement.ALL, style);
text_description = formFactory.createMultiLineTextWithLabel(
- formElement, "Relationship to the unit:", 200, style);
+ formElement, "Relationship to the unit:", 80, style);
Map<Language, LanguageString> descriptions = entity.getDescription();
if (descriptions.get(CdmStore.getDefaultLanguage()) != null) {
/**
* Copyright (C) 2009 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.TextData;
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
/**
* <p>ChangeDescriptionElementType class.</p>
private DescriptionElementBase sourceElement;
private DescriptionElementBase destinationElement;
-
+ private Viewer viewer;
+
/**
* <p>Constructor for ChangeDescriptionElementType.</p>
*
* @param sourceType a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
* @param postOperation a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
*/
- public ChangeDescriptionElementType(String label, DescriptionElementBase sourceType, IPostOperationEnabled postOperation,
+ public ChangeDescriptionElementType(String label, DescriptionElementBase sourceType, IPostOperationEnabled postOperation,
IUndoContext undoContext) {
super(label, undoContext, postOperation);
this.sourceElement = sourceType;
+ if(postOperation instanceof DetailsPartE4){
+ this.viewer = ((DetailsPartE4) postOperation).getViewer();
+ }
}
/* (non-Javadoc)
throws ExecutionException {
DescriptionBase inDescription = sourceElement.getInDescription();
Feature feature = sourceElement.getFeature();
-
+
if(sourceElement instanceof TextData){
// FIXME I guess there are features that support more that one of these
// and that case is not handled correctly at the moment
destinationElement.setFeature(feature);
inDescription.addElement(destinationElement);
inDescription.removeElement(sourceElement);
+
+ viewer.setInput(destinationElement);
return postExecute(destinationElement);
}
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.api.service.IDescriptionService;
import eu.etaxonomy.cdm.api.service.INameService;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.api.service.IReferenceService;
+import eu.etaxonomy.cdm.api.service.IRegistrationService;
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
import eu.etaxonomy.cdm.api.service.ITaxonService;
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.taxeditor.store.CdmStore;
public class GrantedAuthorityLabelTextProvider {
-
+
public static final Logger logger = Logger.getLogger(CdmAuthority.class);
-
-
+
+
public static String getText(GrantedAuthority grantedAuthority){
String labelText = grantedAuthority.getAuthority();
try {
if(targetLabelText.length() > 0){
labelText = grantedAuthority.getAuthority().replace(cdmAuthority.getTargetUUID().toString(), targetLabelText);
}
- } catch (Exception e) {
- /* will in most cases catch a ParsingException
+ } catch (Exception e) {
+ /* will in most cases catch a ParsingException
* this is ignored
*/
if(!e.getClass().getSimpleName().equals("ParsingException")){
}
return labelText;
}
-
+
public static String getTargetText(GrantedAuthority grantedAuthority){
if(grantedAuthority instanceof CdmAuthority){
return getCdmAuthorityTargetText((CdmAuthority)grantedAuthority);
-
+
}
return "";
}
private static String getCdmAuthorityTargetText(CdmAuthority cdmAuthority) {
-
+
UUID uuid = cdmAuthority.getTargetUUID();
String targetText = "";
-
+
if(uuid != null){
targetText = uuid.toString();
if(cdmAuthority.getPermissionClass() != null){
case CLASSIFICATION:
targetText = CdmStore.getService(IClassificationService.class).load(uuid).getTitleCache();
break;
- case REFERENCE:
+ case REFERENCE:
targetText = CdmStore.getService(IReferenceService.class).load(uuid).getTitleCache();
break;
case TAXONNAME:
case TEAMORPERSONBASE:
targetText = CdmStore.getService(IAgentService.class).load(uuid).getTitleCache();
break;
-
+ case REGISTRATION:
+ targetText = CdmStore.getService(IRegistrationService.class).load(uuid).getIdentifier();
+ break;
+ case SPECIMENOROBSERVATIONBASE:
+ targetText = CdmStore.getService(IOccurrenceService.class).load(uuid).getTitleCache();
+ break;
+ default:
+ break;
+
}
} catch (NullPointerException e){
logger.warn("Either no service found for " + cdmAuthority.getPermissionClass() + " or entitiy not found" , e);
}
}
}
-
+
return targetText;
}
-
+
}
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.ImageElement;
}
isAdvancedMediaView = !isAdvancedMediaView;
showAdvancedView();
- reflowParentScrolledForm(true);
+ StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
}
private void showAdvancedView() {
import java.util.Arrays;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
-import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.INonViralName;
-import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
import eu.etaxonomy.cdm.model.name.IZoologicalName;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.model.name.IBacterialName;
-import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.taxeditor.l10n.Messages;
* @author n.hoffmann
* @created May 20, 2010
*/
-public class NonViralNameDetailElement
+public class NonViralNameDetailElement
extends AbstractIdentifiableEntityDetailElement<TaxonName> {
private NameDetailSection section_name;
text_nameApprobation = formFactory.createTextWithLabelElement(formElement, "Name Approbation", entity.getNameApprobation(),style);
}
textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
-
+
}else{
if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){
textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
}
-
+
}
section_name.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_name);
addElement(section_name);
- if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
+// if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
section_author = formFactory.createAuthorshipDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
section_author.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(section_author);
addElement(section_author);
- }
+// }
//TODO RL
if (isAdvancedView || PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){
section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
// if(combo_nomenclaturalCode!=null){
// combo_nomenclaturalCode.setEnabled(false);
// }
-
+
if(toggleable_cache!=null){
toggleable_cache.setEnabled(getEntity().isProtectedTitleCache() || getEntity().isProtectedFullTitleCache());
setIrrelevant(toggleable_cache.getState(),
boolean change = checkForDeletableParts(combo_nomenclaturalCode.getSelection());
if (change){
getEntity().setNameType(combo_nomenclaturalCode.getSelection());
-
+
this.updateContent();
section_hybrid.setEntity(getEntity());
section_author.setEntity(getEntity());
}else {
return true;
}
-
+
}
if (actualCode.equals(NomenclaturalCode.ICNB)){
if (getEntity().getNameApprobation() != null || getEntity().getSubGenusAuthorship() != null){
}else{
return true;
}
-
+
}
if (actualCode.equals(NomenclaturalCode.Fungi)){
if (getEntity().isAnamorphic() ){
}else{
return true;
}
-
+
}
if (actualCode.equals(NomenclaturalCode.ICNAFP)){
return true;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@Override
public DeterminationEvent createNewElement() {
DeterminationEvent instance = DeterminationEvent.NewInstance();
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
+ if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
instance.setIdentifiedUnit(getEntity().innerFieldUnit());
}
else{
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
import eu.etaxonomy.taxeditor.ui.element.OriginalLabelDataElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
/**
private SourceCollectionDetailSection section_source;
private OriginalLabelDataElement textOriginalLabel;
-
+
/**
textOriginalLabel = formFactory.createOriginalLabelDataElement(formElement);
textOriginalLabel.setEntity(getEntity());
-
+
super.createControls(formElement, entity, style);
section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_source.setEntity(entity);
+
}
/** {@inheritDoc} */
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.Collection;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
formElement, "Country",
entity.getCountry(), EntitySelectionElement.NOTHING, style);
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+ if(PreferencesUtil.isCollectingAreaInGeneralSection()){
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
package eu.etaxonomy.taxeditor.ui.section.occurrence;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.TermType;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
/**
* <p>FieldUnitDetailElement class.</p>
private TextWithLabelElement text_fieldObjectDefinition;
private TextWithLabelElement text_fieldNotes;
-
+
private TextWithLabelElement text_lifeForm;
private NumberWithLabelElement number_individualCount;
// Disable for now
// text_fieldObjectDefinition = formFactory.createTextWithLabelElement(formElement, "Field Object Definition", entity.getFieldObjectDefinition(CdmStore.getDefaultLanguage()), style);
text_fieldNotes = formFactory.createTextWithLabelElement(formElement, "Field Notes", entity.getFieldNotes(), style);
- if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM)){
+ if (PreferencesUtil.isShowLifeForm()){
text_lifeForm = formFactory.createTextWithLabelElement(formElement, "Life Form", entity.getLifeform(PreferencesUtil.getGlobalLanguage()), style);
}
-
+
number_individualCount = formFactory.createNumberTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style);
super.createControls(formElement, entity, style);
}
else if(eventSource == number_individualCount){
getEntity().setIndividualCount(number_individualCount.getInteger());
}
-
+
}
}
import eu.etaxonomy.cdm.model.common.LanguageString;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
combo_specorobstype.setSelection(entity.getType());
selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
"Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+ if(PreferencesUtil.isCollectingAreaInGeneralSection()){
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style);
- if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+ if(!PreferencesUtil.isCollectingAreaInGeneralSection()){
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
section_collectingAreas.setEntity(entity);
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
}
for (SpecimenTypeDesignation specimenTypeDesignation : toRemove) {
specimenTypeDesignation.removeType();
- Set<TaxonName> names = specimenTypeDesignation.getTypifiedNames();
+ Set<TaxonName> names;
+ names = new HashSet();
+ names.addAll(specimenTypeDesignation.getTypifiedNames());
for (TaxonName taxonNameBase : names) {
taxonNameBase.removeTypeDesignation(specimenTypeDesignation);
}
package eu.etaxonomy.taxeditor.ui.section.reference;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.ISelectionProvider;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
@Override
public void refresh() {
super.refresh();
- AbstractUtility.refreshDetailsViewer();
+ AbstractUtility.refreshDetailsViewer(formFactory.getContext().get(EPartService.class));
}
@Override
import eu.etaxonomy.cdm.model.taxon.SynonymType;
import eu.etaxonomy.cdm.model.taxon.Taxon;
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.permission.Role;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
* @version 1.0
*/
public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElement<TaxonBase> {
-
+
private CheckboxElement checkbox_doubtful;
private CheckboxElement checkbox_useNameCache;
"Title Cache", entity.getTitleCache(),
entity.isProtectedTitleCache(), style);
-
+
text_appendedPhrase = formFactory.createTextWithLabelElement(
formElement, "Appended Phrase", entity.getAppendedPhrase(),
SWT.WRAP);
entity.getClass().getSimpleName() + " is doubtful", entity.isDoubtful(), style);
- if (entity instanceof Taxon) {
- checkbox_published = formFactory.createCheckbox(formElement,
- "Taxon is published", ((Taxon) entity).isPublish(), style);
- }
+
+ checkbox_published = formFactory.createCheckbox(formElement,
+ entity.getClass().getSimpleName()+" is published", entity.isPublish(), style);
+
if(entity instanceof Synonym){
//#6198 removed type as it is currently not handled correctly in the editor
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.ui.IEditorInput;
import eu.etaxonomy.cdm.model.reference.Reference;
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.event.EventUtility;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
private TextWithLabelElement text_secundum_microreference;
private TextWithLabelElement text_appendedPhrase;
- private TaxonDetailSection taxonElement;
-
-
private Taxon taxon;
+ private TaxonDetailSection taxonElement;
+
public TaxonRelationshipDetailElement(CdmFormFactory formFactory,
ICdmFormElement formElement) {
super(formFactory, formElement);
-
-
}
@Override
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);
+
+
taxonElement = formFactory.createTaxonDetailSection(getConversationHolder(), formElement, null, style);
taxonElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
addControl(taxonElement);
taxon.getSecMicroReference(),null,
SWT.WRAP);
-
-
-
-
-
secReference = formFactory.createSelectionElement(Reference.class,
getConversationHolder(), formElement, "Misappl. Sec.",
entity.getCitation(), EntitySelectionElement.ALL,
formElement, "Detail",
entity.getCitationMicroReference(),null,
SWT.WRAP);
-
}
-
}
private Taxon getRelatedTaxon() {
}
private Taxon getSourceTaxon(){
- IEditorInput editorInput = StoreUtil.getActiveEditorInput();
- if(editorInput!=null){
- return editorInput.getAdapter(Taxon.class);
- }
- return null;
+ return EventUtility.getCurrentTaxon();
}
@Override
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
}
-
-
-
@Override
protected void updateControlStates() {
super.updateControlStates();
TaxonRelationship rel = getEntity();
rel.setFromTaxon(taxon);
setEntity(rel);
- // taxonBase.getTitleCache();
-
+ setTaxonBase(taxon);
+
firePropertyChangeEvent(TaxonRelationshipDetailSection.this);
}
}
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.IFormPart;
import org.eclipse.ui.forms.ManagedForm;
import org.eclipse.ui.forms.widgets.ScrolledForm;
formFactory.dispose();
formFactory = null;
}
- formFactory = new CdmFormFactory(Display.getCurrent(), this);
+// formFactory = new CdmFormFactory(Display.getCurrent(), this);
}
protected void markViewPartDirty(){
return body;
}
-
+
/** {@inheritDoc} */
@Override
public void setInput(Object input) {
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
-import eu.etaxonomy.taxeditor.editor.ISecuredEditor;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
isInDelay = false;
}
- /**
- * <p>
- * getEditor
- * </p>
- *
- * @return the currently active editor
- */
- public IEditorPart getEditor() {
- return AbstractUtility.getActiveEditor();
- }
+// /**
+// * <p>
+// * getEditor
+// * </p>
+// *
+// * @return the currently active editor
+// */
+// public IEditorPart getEditor() {
+//// return AbstractUtility.getActiveEditor();
+// }
/**
* {@inheritDoc}
public void setFocus() {
super.setFocus();
- if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){
- boolean doEnable = ((ISecuredEditor)getEditor()).permissionsSatisfied();
- setEnabled(doEnable);
- }
+// if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){
+// boolean doEnable = ((ISecuredEditor)getEditor()).permissionsSatisfied();
+// setEnabled(doEnable);
+// }
}
/**
((IDirtyMarkable) part).changed(object);
}
else {
- IEditorPart editor = getEditor();
- if (editor != null && editor instanceof IDirtyMarkable) {
- ((IDirtyMarkable) editor).changed(object);
- }
+// IEditorPart editor = getEditor();
+// if (editor != null && editor instanceof IDirtyMarkable) {
+// ((IDirtyMarkable) editor).changed(object);
+// }
}
}
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
}
private void setInitialSelection() {
- selectionChanged(AbstractUtility.getActiveWorkbenchPart(), getInitialSelection());
+// selectionChanged(AbstractUtility.getActiveWorkbenchPart(), getInitialSelection());
}
/**
});
}
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getName()
- */
- @Override
- public String getName() {
- return "[BioCASE] " + query.toString();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IEditorInput#getToolTipText()
- */
- @Override
- public String getToolTipText() {
- return "[BioCASE] " + query.toString();
- }
-
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public void fill(Menu menu, int index) {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- final Object activeEditor = AbstractUtility.getActiveE4Editor();
+ final Object activeEditor = AbstractUtility.getActiveEditor();
final ISelection selection = window.getActivePage().getSelection();
if(selection instanceof StructuredSelection){
final StructuredSelection structuredSelection = (StructuredSelection)selection;
import java.util.Collection;
import org.apache.log4j.Logger;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
* @date 25.02.2014
*
*/
-public abstract class DataImportEditorInput<T> implements IEditorInput {
+public abstract class DataImportEditorInput<T> {
protected static Logger logger = Logger.getLogger(DataImportEditorInput.class);
this.conversationHolder = CdmStore.createConversation();
}
- @Override
- public Object getAdapter(Class adapter) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean exists() {
- return false;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IPersistableElement getPersistable() {
- return null;
- }
-
public Collection<T> getResults() {
return results;
}
}
- @Override
- public String getName() {
- return "[GBIF] " + query.toString();
- }
-
- @Override
- public String getToolTipText() {
- return "[GBIF] " + query.toString();
- }
-
@Override
public int hashCode() {
final int prime = 31;
private SpecimenSearchController specimenSearchController;
- protected SpecimenSearchWizardPage(String pageName) {
+ public SpecimenSearchWizardPage(String pageName) {
super(pageName);
setDescription("Specify search parameters for external search query.");
setTitle("Search Specimens");
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
@Override
public void createControl(Composite parent) {
specimenSearchController = SpecimenSearchController.getInstance(parent);
String accessionNumber = specimenSearchController.getAccessionNumber();
String collector = specimenSearchController.getCollector();
String collectorsNumber = specimenSearchController.getCollectorNumber();
- String country = specimenSearchController.getCountry();
+ String country = specimenSearchController.getCountry(false);
Calendar dateFrom = specimenSearchController.getDateFrom();
Calendar dateTo = specimenSearchController.getDateTo();
String herbarium = specimenSearchController.getHerbarium();
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.e4.ui.di.Focus;
-import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.wb.swt.ResourceManager;
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
-import eu.etaxonomy.taxeditor.view.dataimport.SaveImportedSpecimenAction;
/**
* View which shows a list of "data" that can be imported into the CDM
protected final Logger logger = Logger.getLogger(DataImportViewE4.class);
- @Inject
- private Shell shell;
-
protected Collection<T> results = new ArrayList<T>();
protected boolean updated = false;
private static ConversationHolder conversationHolder;
- private SaveImportedSpecimenAction saveImportedSpecimenAction;
+ private SaveImportedSpecimenActionE4 saveImportedSpecimenAction;
private Text textClassification;
private Button toggleButton;
+ private Button importButton;
+
private boolean state;
private Button openConfigurator;
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
private Table table;
+ private Composite composite_3;
/**
* Constructs a new DataImportEditor and registers it to listen to context changes
*/
public DataImportViewE4() {
CdmStore.getContextManager().addContextListener(this);
- if(CdmStore.isActive()){
- initConversation();
- }
}
/**
* @param parent
*/
@PostConstruct
- public void createPartControl(Composite parent, @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
- this.shell = shell;
+ public void createPartControl(Composite parent) {
+ if(CdmStore.isActive()){
+ initConversation();
+ }
+ else{
+ return;
+ }
+ parent.setLayout(new GridLayout(1, false));
Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+// composite.setBounds(0, 0, 0, 298);
composite.setLayout(new GridLayout(2, false));
Composite composite_1 = new Composite(composite, SWT.NONE);
- GridData gd_composite_1 = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1);
- gd_composite_1.widthHint = 280;
- composite_1.setLayoutData(gd_composite_1);
+// gd_composite_1.widthHint = 280;
+ composite_1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1));
composite_1.setLayout(new GridLayout(3, false));
- Label label = new Label(composite_1, SWT.TOP);
- label.setText("Classification");
- label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
- textClassification = new Text(composite_1, SWT.BORDER);
- textClassification.setEnabled(false);
- GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
- gd_textClassification.widthHint = 118;
- textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
- btnBrowseClassification = new Button(composite_1, SWT.NONE);
- btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
- btnBrowseClassification.addListener(SWT.Selection, this);
- btnClear = new Button(composite_1, SWT.NONE);
- btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
- btnClear.addListener(SWT.Selection, this);
- //source reference
+ Label label = new Label(composite_1, SWT.TOP);
+ label.setText("Classification");
+ label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+ textClassification = new Text(composite_1, SWT.BORDER);
+ textClassification.setEnabled(false);
+ GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+// gd_textClassification.widthHint = 118;
+ textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
+ btnBrowseClassification = new Button(composite_1, SWT.NONE);
+ btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+ btnBrowseClassification.addListener(SWT.Selection, this);
+ btnClear = new Button(composite_1, SWT.NONE);
+ btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+ btnClear.addListener(SWT.Selection, this);
+ //source reference
Label labelRef = new Label(composite_1, SWT.NONE);
labelRef.setText("Default import souce reference");
public void widgetSelected(SelectionEvent e) {
IWizard wizard = new ImportPreferencesWizard();
- WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ WizardDialog dialog = new WizardDialog(e.display.getActiveShell(), wizard);
dialog.open();
}
});
- //checkbox table for result
+ //checkbox table for result
Composite composite_2 = new Composite(composite, SWT.NONE);
- GridData gd_composite_2 = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1);
- gd_composite_2.heightHint = 454;
- gd_composite_2.widthHint = 403;
- composite_2.setLayoutData(gd_composite_2);
- composite_2.setLayout(new GridLayout(2, false));
-
-
- CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite_2, SWT.BORDER | SWT.FULL_SELECTION);
-
-
- table = checkboxTableViewer.getTable();
- GridData gd_table = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1);
- gd_table.heightHint = 444;
- gd_table.widthHint = 312;
- table.setLayoutData(gd_table);
- toolkit.paintBordersFor(table);
- //toggle button
- toggleButton = new Button(composite_2, SWT.PUSH);
- GridData gd_toggleButton = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1);
- gd_toggleButton.widthHint = 56;
- toggleButton.setLayoutData(gd_toggleButton);
- toggleButton.setText("Toggle");
- toggleButton.addSelectionListener(new SelectionAdapter(){
- @Override
- public void widgetSelected(SelectionEvent e) {
- state = state ? false : true;
- for (TableItem item: getTable().getItems()){
- item.setChecked(state);
- }
-
- }
- });
- createActions();
- initializeToolBar();
- }
+ composite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite_2.setLayout(new GridLayout(2, false));
- /**
- * Create the actions.
- */
- private void createActions() {
- saveImportedSpecimenAction = new SaveImportedSpecimenAction();
+
+ CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite_2, SWT.BORDER | SWT.FULL_SELECTION);
+
+
+ table = checkboxTableViewer.getTable();
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ toolkit.paintBordersFor(table);
+
+ composite_3 = new Composite(composite_2, SWT.NONE);
+// gd_composite_3.heightHint = 48;
+ composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+ toolkit.paintBordersFor(composite_3);
+ composite_3.setLayout(new GridLayout(1, false));
+ //toggle button
+ toggleButton = new Button(composite_3, SWT.PUSH);
+ toggleButton.setText("Toggle");
+ new Label(composite_2, SWT.NONE);
+
+ Composite composite_4 = new Composite(composite_2, SWT.NONE);
+ composite_4.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+ toolkit.adapt(composite_4);
+ toolkit.paintBordersFor(composite_4);
+
+ importButton = new Button(composite_4, SWT.PUSH);
+ importButton.setSize(48, 25);
+ importButton.setText("Import");
+ importButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ saveImportedSpecimenAction.run();
+ }
+ });
+ new Label(composite_2, SWT.NONE);
+ new Label(composite_2, SWT.NONE);
+ new Label(composite_2, SWT.NONE);
+ new Label(composite_2, SWT.NONE);
+ new Label(composite_2, SWT.NONE);
+ new Label(composite_2, SWT.NONE);
+ toggleButton.addSelectionListener(new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ state = state ? false : true;
+ for (TableItem item: getTable().getItems()){
+ item.setChecked(state);
+ }
+
+ }
+ });
+ //import button
+ saveImportedSpecimenAction = new SaveImportedSpecimenActionE4(this);
+ initializeToolBar();
}
/**
if (getTable() != null){
getTable().removeAll();
}
- for(T item:results){
- TableItem tableItem = new TableItem(getTable(), SWT.NONE);
- tableItem.setText(getTextForTableItem(item));
- tableItem.setData(item);
+ if(results!=null){
+ for(T item:results){
+ TableItem tableItem = new TableItem(getTable(), SWT.NONE);
+ tableItem.setText(getTextForTableItem(item));
+ tableItem.setData(item);
+ }
}
updated = true;
}
@Focus
public void setFocus() {
- getTable().setFocus();
+ if(getTable()!=null){
+ getTable().setFocus();
+ }
//make sure to bind again if maybe in another view the conversation was unbound
if(getConversationHolder()!=null && !getConversationHolder().isBound()){
getConversationHolder().bind();
@Override
public void handleEvent(Event event) {
if(event.widget==btnBrowseClassification){
- classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, shell, null, null);
+ classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, event.widget.getDisplay().getActiveShell(), null, null);
if(classification!=null){
textClassification.setText(classification.getTitleCache());
}
--- /dev/null
+package eu.etaxonomy.taxeditor.view.dataimport.e4;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
+import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseResponse;
+import eu.etaxonomy.cdm.ext.occurrence.gbif.DataSetResponse;
+import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol;
+import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.io.specimen.gbif.in.GbifImportConfigurator;
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.dataimport.GbifResponseComparator;
+
+/**
+ *
+ * @author pplitzner
+ * @since Oct 4, 2017
+ *
+ */
+public class SaveImportedSpecimenActionE4 extends Action {
+
+ private Comparator<GbifResponse> comparator;
+
+ private DataImportViewE4<?> dataImportView;
+
+ public SaveImportedSpecimenActionE4(DataImportViewE4<?> dataImportView) {
+ super();
+ this.dataImportView = dataImportView;
+ }
+
+ @Override
+ public void run() {
+ Table table = dataImportView.getTable();
+ Collection<GbifResponse> checkedResults = new HashSet<GbifResponse>();
+ Collection<BioCaseResponse> checkedAbcdResults = new HashSet<BioCaseResponse>();
+ Object data;
+ Set<String[]> unitIdsGbif = new HashSet<String[]>();
+ Set<String[]> unitIdsBioCase = new HashSet<String[]>();
+ List<GbifResponse> biocaseResponses = new ArrayList<GbifResponse>();
+
+ for(TableItem item:table.getItems()){
+ if(item.getChecked()){
+ //Save Specimen
+ data = item.getData();
+ if(data instanceof GbifResponse){
+ checkedResults.add((GbifResponse)item.getData());
+ }
+ if(data instanceof BioCaseResponse){
+ checkedAbcdResults.add((BioCaseResponse)data);
+ }
+ }
+ }
+ String[] tripleId ;
+ for (GbifResponse response:checkedResults){
+ if (response != null){
+ tripleId = response.getTripleID();
+
+ if (response.getDataSetProtocol()!=null && response.getDataSetProtocol().equals(GbifDataSetProtocol.BIOCASE)){
+ biocaseResponses.add(response);
+
+ }else{
+ unitIdsGbif.add(tripleId);
+ }
+
+
+ }
+ }
+ Collections.sort(biocaseResponses, getComparator());
+
+ Abcd206ImportConfigurator configuratorAbcd;
+ List<Abcd206ImportConfigurator> abcdConfigurators = new ArrayList<Abcd206ImportConfigurator>();
+ DataSetResponse dataSetResponse;
+ OccurenceQuery bioCaseOccurrenceQuery = null;
+ URI dataSetUri = null;
+ for (BioCaseResponse response:checkedAbcdResults){
+
+ if (!response.getDataSetUri().equals(dataSetUri)){
+ dataSetUri = response.getDataSetUri();
+
+ configuratorAbcd = PreferencesUtil.getAbcdImportConfigurationPreference(true);
+ configuratorAbcd.setSourceUri(dataSetUri);
+ // configuratorAbcd.addMediaAsMediaSpecimen(true);
+ // configuratorAbcd.setIgnoreAuthorship(true);
+ // configuratorAbcd.setMoveNewTaxaToDefaultClassification(false);
+
+ unitIdsBioCase = new HashSet<String[]>();
+ bioCaseOccurrenceQuery = new OccurenceQuery(unitIdsBioCase);
+ configuratorAbcd.setOccurenceQuery(bioCaseOccurrenceQuery);
+ // configuratorAbcd.setGetSiblings(true);
+ if (dataImportView.getClassification() != null){
+ configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid());
+ }
+ if (dataImportView.getReferenceString() != null){
+ configuratorAbcd.setSourceReferenceTitle(dataImportView.getReferenceString());
+ }
+ abcdConfigurators.add(configuratorAbcd);
+
+ }
+ tripleId = response.getTripleID();
+ unitIdsBioCase.add(tripleId);
+
+ }
+
+
+ // if (!unitIdsBioCase.isEmpty()){
+ // configuratorAbcd = Abcd206ImportConfigurator.NewInstance(dataSetUri, null, false);
+ // configuratorAbcd.addMediaAsMediaSpecimen(true);
+ // configuratorAbcd.setIgnoreAuthorship(true);
+ // configuratorAbcd.setMoveNewTaxaToDefaultClassification(false);
+ // if (configuratorAbcd != null){
+ // abcdConfigurators.add(configuratorAbcd);
+ // }
+ //// unitIdsBioCase = new HashSet<String[]>();
+ // bioCaseOccurrenceQuery = new OccurenceQuery(unitIdsBioCase);
+ // configuratorAbcd.setOccurenceQuery(bioCaseOccurrenceQuery);
+ // configuratorAbcd.setGetSiblings(true);
+ // if (dataImportView.getClassification() != null){
+ // configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid());
+ // }
+ // }
+
+ // for (GbifResponse response: biocaseResponses){
+ // try {
+ // dataSetResponse = new GbifQueryServiceWrapper().queryOriginalDataSet(response);
+ // dataSetUri = dataSetResponse.getEndpoint();
+ // } catch (ClientProtocolException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // } catch (IOException e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ // if (!response.getDataSetUri().equals(dataSetUri)){
+ // configuratorAbcd = Abcd206ImportConfigurator.NewInstance(dataSetUri, null, false);
+ // configuratorAbcd.addMediaAsMediaSpecimen(true);
+ // configuratorAbcd.setIgnoreAuthorship(true);
+ // configuratorAbcd.setMoveNewTaxaToDefaultClassification(false);
+ // if (configuratorAbcd != null){
+ // abcdConfigurators.add(configuratorAbcd);
+ // }
+ // unitIdsBioCase = new HashSet<String[]>();
+ // bioCaseOccurrenceQuery = new OccurenceQuery(unitIdsBioCase);
+ // configuratorAbcd.setOccurenceQuery(bioCaseOccurrenceQuery);
+ // configuratorAbcd.setGetSiblings(true);
+ // if (dataImportView.getClassification() != null){
+ // configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid());
+ // }
+ //
+ // }
+ // tripleId = response.getTripleID();
+ // unitIdsBioCase.add(tripleId);
+ // }
+
+
+ // configurator.setQuery(query);
+ if (!checkedAbcdResults.isEmpty()){
+ Job bioCaseJob = CdmStore.getImportManager().createIOServiceJob(abcdConfigurators);
+ CdmStore.getImportManager().run(bioCaseJob);
+ }
+
+ if (!unitIdsGbif.isEmpty()){
+ OccurenceQuery query = new OccurenceQuery(unitIdsGbif);
+ GbifImportConfigurator configurator = GbifImportConfigurator.newInstance(query);
+ configurator.setSourceReferenceTitle("Import Gbif data");
+
+ Job gbifJob = CdmStore.getImportManager().createIOServiceJob(configurator);
+ CdmStore.getImportManager().run(gbifJob);
+ }
+
+ }
+
+ private void persistTerm(DefinedTermBase<?> term, ITermService termService, ConversationHolder conversation){
+ if(term!=null){
+ //if the term does not exist in the DB save it
+ if(termService.find(term.getUuid())==null){
+ termService.saveOrUpdate(term);
+ }
+ }
+ }
+
+ @Override
+ public String getText() {
+ return "Import";
+ }
+
+ private Comparator<GbifResponse> getComparator(){
+ if (comparator == null){
+ comparator = new GbifResponseComparator();
+ }
+ return comparator;
+ }
+
+}
--- /dev/null
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.view.dataimport.e4;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.ext.common.ServiceWrapperBase;
+import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
+import eu.etaxonomy.taxeditor.view.dataimport.QueryType;
+import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenProviderSelectionController;
+
+
+/**
+ * Wizard page for selecting the specimen provider
+ * @author pplitzner
+ * @date 12.09.2013
+ *
+ */
+public class SpecimenProviderSelectionWizardPageE4 extends WizardPage{
+
+ private SpecimenProviderSelectionController specimenProviderSelectionController;
+ private URI endPoint;
+ private ServiceWrapperBase serviceWrapper;
+
+ @Inject
+ public SpecimenProviderSelectionWizardPageE4() {
+ super("Select specimen provider");
+ setTitle("Select Specimen Provider");
+ setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
+ "provider the access point URL must be entered.");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ specimenProviderSelectionController = SpecimenProviderSelectionController.getInstance(parent, getWizard());
+ setControl(specimenProviderSelectionController.getComposite());
+ //serviceWrapper = new BioCaseQueryServiceWrapper();
+
+ }
+
+ public QueryType getQueryType(){
+ if(specimenProviderSelectionController.getComposite().getBtnBioCaseProvider().getSelection()){
+ return QueryType.BIOCASE;
+ }
+ else {// if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
+ return QueryType.GBIF;
+ }
+ }
+
+ /**
+ * @return
+ * @throws URISyntaxException
+ */
+ public URI getEndPoint() {
+ return endPoint;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
+ */
+ @Override
+ public boolean isPageComplete() {
+ if(specimenProviderSelectionController.getComposite().getBtnBioCaseProvider().getSelection()){
+ endPoint = null;
+ try {
+ endPoint = new URL(specimenProviderSelectionController.getComposite().getTxtAccessPoint().getText()).toURI();
+ serviceWrapper = new BioCaseQueryServiceWrapper();
+ serviceWrapper.setBaseUrl(specimenProviderSelectionController.getComposite().getTxtAccessPoint().getText());
+ this.setErrorMessage(null);
+ return true;
+ } catch (MalformedURLException e) {
+ setErrorMessage("A valid URL has to be entered.");
+ return false;
+ } catch (URISyntaxException e) {
+ setErrorMessage("A valid URL has to be entered.");
+ return false;
+ }
+ }
+ else if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
+ this.setErrorMessage(null);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return the bioCaseQueryServiceWrapper
+ */
+ public ServiceWrapperBase getQueryServiceWrapper() {
+ return serviceWrapper;
+ }
+
+ /**
+ * @param bioCaseQueryServiceWrapper the bioCaseQueryServiceWrapper to set
+ */
+ public void setQueryServiceWrapper(ServiceWrapperBase queryServiceWrapper) {
+ this.serviceWrapper = queryServiceWrapper;
+ }
+
+ /**
+ * @return
+ */
+ public SpecimenProviderSelectionController getController() {
+ return specimenProviderSelectionController;
+ }
+
+
+
+
+}
--- /dev/null
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.view.dataimport.e4;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
+import org.w3c.dom.NodeList;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.ext.common.ServiceWrapperBase;
+import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
+import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.AbcdParseUtility;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.SpecimenImportReport;
+import eu.etaxonomy.cdm.io.specimen.abcd206.in.UnitAssociationWrapper;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.dataimport.QueryType;
+
+/**
+ * Wizard for querying specimen provider.
+ * @author pplitzner
+ * @date 11.09.2013
+ *
+ */
+public class SpecimenSearchWizardE4 extends Wizard {
+
+ private OccurenceQuery query = null;
+ private SpecimenProviderSelectionWizardPageE4 providerSelectionPage;
+ private SpecimenSearchWizardPageE4 searchPage;
+
+ @Inject
+ private EPartService partService;
+
+ private IEclipseContext context;
+
+ /**
+ * Creates a new SpecimenSearchWizard
+ */
+ @Inject
+ public SpecimenSearchWizardE4(IEclipseContext context) {
+ this.context = context;
+ //default constructor needed for RCP extension points
+
+ //check if connected to a data source. If not this will open an error dialog
+ CdmStore.getCurrentApplicationConfiguration();
+ this.setWindowTitle("Search Specimens");
+ }
+
+ @Override
+ public boolean performFinish() {
+ searchPage.getController().saveLastSate();
+ providerSelectionPage.getController().saveLastState();
+ ServiceWrapperBase serviceWrapper;
+ DataImportViewE4<?> dataImportView = null;
+ boolean biocase = providerSelectionPage.getQueryType().equals(QueryType.BIOCASE);
+ query = searchPage.getQuery(biocase);
+ Abcd206ImportConfigurator configurator = CdmStore.getImportManager().AbcdConfigurator();
+ configurator.setOccurenceQuery(query);
+ configurator.setSourceUri(providerSelectionPage.getEndPoint());
+ configurator.setAddMediaAsMediaSpecimen(true);
+ configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+ configurator.setIgnoreAuthorship(true);
+ configurator.setMoveNewTaxaToDefaultClassification(false);
+
+ try {
+ serviceWrapper = providerSelectionPage.getQueryServiceWrapper();
+ InputStream stream = null;
+
+ if (providerSelectionPage.getQueryType().equals(QueryType.BIOCASE)){
+ stream =((BioCaseQueryServiceWrapper) serviceWrapper).query(query, configurator.getSourceUri());
+ SpecimenImportReport report = new SpecimenImportReport();
+ UnitAssociationWrapper unitNodesList = AbcdParseUtility.parseUnitsNodeList(stream, report);
+ NodeList nodeList = unitNodesList.getAssociatedUnits();
+ String prefix = unitNodesList.getPrefix();
+ String associationType = unitNodesList.getAssociationType();
+ if (nodeList != null){
+ URI uri =AbcdParseUtility.parseFirstUri(nodeList, report);
+ String content = AbcdParseUtility.parseFirstTextContent(nodeList);
+ }
+
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenImportViewE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ SpecimenImportViewE4 specimenImportView = (SpecimenImportViewE4) part.getObject();
+ specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
+ specimenImportView.setQuery(query);
+
+ dataImportView = specimenImportView;
+
+ } else{
+ MPart part = partService.createPart("eu.etaxonomy.taxeditor.view.dataimport.e4.GbifResponseImportViewE4");
+ part = partService.showPart(part, PartState.ACTIVATE);
+ GbifResponseImportViewE4 gbifImportView = (GbifResponseImportViewE4) part.getObject();
+ gbifImportView.setQuery(query);
+
+ dataImportView = gbifImportView;
+
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // CdmStore.getImportManager().run(configurator);
+
+// try {
+// switch (providerSelectionPage.getQueryType()) {
+// case BIOCASE:
+// SpecimenImportView specimenImportView = (SpecimenImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
+// .showView(SpecimenImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
+// specimenImportView.setEndpoint(providerSelectionPage.getEndPoint());
+// dataImportView = specimenImportView;
+// break;
+// case GBIF:
+// dataImportView = (GbifResponseImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage()
+// .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE);
+// break;
+// }
+// } catch ( PartInitException e ) {
+// logger.error("Could not open import view for query: " + query.toString(), e);
+// }
+// if(dataImportView!=null){
+// dataImportView.setQuery(query);
+//// dataImportView.query();
+//// Display.getDefault().asyncExec(new Runnable() {
+////
+//// @Override
+//// public void run() {
+//// CdmStore.getContextManager().notifyContextRefresh();
+//// }
+//// });
+ Job queryJob = new QueryJob("Query specimen provider", dataImportView);
+ queryJob.schedule();
+
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ addPage(providerSelectionPage);
+ addPage(searchPage);
+ }
+
+ public void init() {
+ providerSelectionPage = ContextInjectionFactory.make(SpecimenProviderSelectionWizardPageE4.class, context);
+// new SpecimenProviderSelectionWizardPage("Select specimen provider");
+// searchPage = new SpecimenSearchWizardPage("Specimen Search");
+ searchPage = ContextInjectionFactory.make(SpecimenSearchWizardPageE4.class, context);
+ }
+
+ private class QueryJob extends Job{
+
+ private final DataImportViewE4<?> view;
+
+ public QueryJob(String name, DataImportViewE4<?> view) {
+ super(name);
+ this.view = view;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ view.getConversationHolder().bind();
+ view.query();
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ CdmStore.getContextManager().notifyContextRefresh();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+
+ }
+}
--- /dev/null
+/**
+* Copyright (C) 2013 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.view.dataimport.e4;
+
+import java.util.Calendar;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
+import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchController;
+
+
+/**
+ * Wizard page for entering search parameters
+ * @author pplitzner
+ * @date 12.09.2013
+ *
+ */
+public class SpecimenSearchWizardPageE4 extends WizardPage{
+
+ private SpecimenSearchController specimenSearchController;
+
+ @Inject
+ public SpecimenSearchWizardPageE4() {
+ super("Specimen Search");
+ setDescription("Specify search parameters for external search query.");
+ setTitle("Search Specimens");
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ specimenSearchController = SpecimenSearchController.getInstance(parent);
+ setControl(specimenSearchController.getComposite());
+ }
+
+ /**
+ * Returns an {@link OccurenceQuery} filled with the parameters defined in this wizard page
+ * @return
+ */
+ public OccurenceQuery getQuery(boolean biocase) {
+ String accessionNumber = specimenSearchController.getAccessionNumber();
+ String collector = specimenSearchController.getCollector();
+ String collectorsNumber = specimenSearchController.getCollectorNumber();
+ String country = specimenSearchController.getCountry(biocase);
+ Calendar dateFrom = specimenSearchController.getDateFrom();
+ Calendar dateTo = specimenSearchController.getDateTo();
+ String herbarium = specimenSearchController.getHerbarium();
+ String locality = specimenSearchController.getLocality();
+ String taxonName = specimenSearchController.getTaxonName();
+ return new OccurenceQuery(taxonName, collector, collectorsNumber, accessionNumber, herbarium, country, locality, dateFrom, dateTo);
+ }
+
+ /**
+ * @return the specimenSearchController
+ */
+ public SpecimenSearchController getController() {
+ return specimenSearchController;
+ }
+
+
+
+}
--- /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.view.dataimport.e4.handler;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+
+import eu.etaxonomy.taxeditor.view.dataimport.e4.SpecimenSearchWizardE4;
+
+/**
+ * @author pplitzner
+ * @since Oct 4, 2017
+ *
+ */
+public class OpenSpecimenImportWizard {
+
+ @Execute
+ public void execute(IEclipseContext ctx, Shell s)
+ {
+ SpecimenSearchWizardE4 wizard = ContextInjectionFactory.make(SpecimenSearchWizardE4.class, ctx);
+ wizard.init();
+ WizardDialog dialog = new WizardDialog(s, wizard);
+ dialog.open();
+ }
+}
* @date 22.08.2017
*
*/
-abstract class AbstractDataSourceHandlerE4 {
+public abstract class AbstractDataSourceHandlerE4 {
@Execute
public void execute(EPartService partService,
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
- @Named(IServiceConstants.ACTIVE_SELECTION)CdmMetaDataAwareDataSourceContainer container,
- MPart dataSourcePart) {
-
- boolean refresh = specificExecute((CdmDataSourceViewPartE4) dataSourcePart.getObject(), container, shell);
+ @Named(IServiceConstants.ACTIVE_SELECTION)CdmMetaDataAwareDataSourceContainer container) {
MPart dataSourceView = partService.showPart(
"eu.etaxonomy.taxeditor.view.datasource",
PartState.ACTIVATE);
CdmDataSourceViewPartE4 view = (CdmDataSourceViewPartE4) dataSourceView.getObject();
+
+ boolean refresh = specificExecute(view, container, shell);
+
if(refresh) {
view.refresh();
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- boolean refresh = specificExecute(event);
-
- CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.showView(CdmDataSourceViewPart.ID);
- if(refresh) view.refresh();
-
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+// boolean refresh = specificExecute(event);
+
+// CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.showView(CdmDataSourceViewPart.ID);
+// if(refresh) {
+// view.refresh();
+// }
+
return null;
}
-
+
/**
* <p>getSelectedDataSourceContainer</p>
*
CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) ((StructuredSelection) menuSelection).getFirstElement();
return container;
}
-
+
/**
* <p>specificExecute</p>
*
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
int result = dialog.open();
if(result == IStatus.OK){
- CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
- if(view != null){
- container.getMetaDataFromDataSource();
- view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
-
- }
+// CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
+// if(view != null){
+// container.getMetaDataFromDataSource();
+// view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
+//
+// }
}
}
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
-*
+*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
import eu.etaxonomy.cdm.config.ICdmSource;
import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceWizard;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
int result = dialog.open();
if(result == IStatus.OK){
- CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
- if(view != null){
- container.getMetaDataFromDataSource();
- view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
-
- }
+// CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
+// if(view != null){
+// container.getMetaDataFromDataSource();
+// view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
+//
+// }
}
}
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.progress.IProgressConstants;
-import eu.etaxonomy.cdm.config.ICdmSource;
-import eu.etaxonomy.cdm.database.ICdmDataSource;
-import eu.etaxonomy.cdm.database.update.CdmUpdater;
-import eu.etaxonomy.cdm.database.update.SchemaUpdateResult;
-import eu.etaxonomy.taxeditor.model.CdmProgressMonitorAdapter;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
-import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
import eu.etaxonomy.taxeditor.view.datasource.CdmMetaDataAwareDataSourceContainer;
/**
@Override
protected IStatus run(IProgressMonitor monitor) {
- CdmUpdater updater = new CdmUpdater();
+// CdmUpdater updater = new CdmUpdater();
IStatus status = null;
- ICdmSource cdmSource = container.getCdmSource();
- //FIXME:Remoting we need another updater for ICdmRemoteSource
- if(cdmSource instanceof ICdmDataSource) {
- try{
- SchemaUpdateResult result = updater.updateToCurrentVersion(
- (ICdmDataSource)cdmSource, CdmProgressMonitorAdapter.CreateMonitor(monitor));
- if(result.isSuccess()){
- display.asyncExec(new Runnable(){
-
- @Override
- public void run() {
-
- CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
- if(view != null){
- container.getMetaDataFromDataSource();
- view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
- }
-
- }
- });
- status = Status.OK_STATUS;
- }else{
- throw new RuntimeException("An error occurred during the update.");
- }
- }catch(Exception e){
- status = new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, e.getMessage(), e);
- MessagingUtils.errorDialog("Could not complete updater", updater, status.getMessage(), status.getPlugin(), e, true);
- }
- }
+// ICdmSource cdmSource = container.getCdmSource();
+// //FIXME:Remoting we need another updater for ICdmRemoteSource
+// if(cdmSource instanceof ICdmDataSource) {
+// try{
+// SchemaUpdateResult result = updater.updateToCurrentVersion(
+// (ICdmDataSource)cdmSource, CdmProgressMonitorAdapter.CreateMonitor(monitor));
+// if(result.isSuccess()){
+// display.asyncExec(new Runnable(){
+//
+// @Override
+// public void run() {
+//
+// CdmDataSourceViewPart view = (CdmDataSourceViewPart) StoreUtil.getView(CdmDataSourceViewPart.ID, false);
+// if(view != null){
+// container.getMetaDataFromDataSource();
+// view.getViewer().update(new CdmMetaDataAwareDataSourceContainer[]{container}, null);
+// }
+//
+// }
+// });
+// status = Status.OK_STATUS;
+// }else{
+// throw new RuntimeException("An error occurred during the update.");
+// }
+// }catch(Exception e){
+// status = new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, e.getMessage(), e);
+// MessagingUtils.errorDialog("Could not complete updater", updater, status.getMessage(), status.getPlugin(), e, true);
+// }
+// }
return status;
}
import eu.etaxonomy.taxeditor.ui.section.occurrence.GeoScopeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
/**
formSection instanceof TaxonomicScopeSection)) {
input = ((PolytomousKeyNode)input).getKey();
} else if ((input instanceof TaxonRelationship)
+ && (formSection instanceof TaxonDetailSection)) {
+ ((TaxonDetailSection) formSection)
+ .setTaxon( ((TaxonRelationship)input).getFromTaxon());
+ return true;
+ }else if ((input instanceof TaxonRelationship)
&& (formSection instanceof NonViralNameDetailSection)) {
((NonViralNameDetailSection) formSection)
.setTaxonBase( ((TaxonRelationship)input).getFromTaxon());
public static String ID = "eu.etaxonomy.taxeditor.view.detail"; //$NON-NLS-1$
private DetailsViewer viewer;
-
+
private CdmBase lastObject;
private Object lastPart;
if(wrappedPart!=null){
partObject = wrappedPart;
}
- if(AbstractUtility.getActiveE4Editor() == null && !(AbstractUtility.getActiveE4Part() instanceof IConversationEnabled)){
+ if(AbstractUtility.getActiveEditor() == null && !(AbstractUtility.getActivePart() instanceof IConversationEnabled)){
showEmptyPage();
return;
}
try{
boolean isSelectionProvidingPartStillActive = false;
if(selectionProvidingPart!=null){
- EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class);
+ EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
Collection<MPart> parts = partService.getParts();
for (MPart mPart : parts) {
Object object = mPart.getObject();
@Override
public void showEmptyPage() {
viewer.setSelection(null);
-
+
super.showEmptyPage();
}
}
@Override
public void showViewer(Object part, IStructuredSelection selection){
-
-
-
+
+
+
this.part = part;
Object element = selection.getFirstElement();
-
+
// if (part == lastPart && element == lastObject ){
// getViewer().setInput(element);
// return;
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;
@Override
public void setInput(Object input) {
-
+
if(input instanceof TreeNode){
input = ((TreeNode) input).getValue();
}
// 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();
createEmptySection(rootElement);
}
layout();
-
+
}
/** {@inheritDoc} */
@Override
public void setSelection(ISelection selection, boolean reveal) {
-
+
this.selection = selection;
-
+
if(this.selection!=null){
SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
fireSelectionChanged(selectionChangedEvent);
}
-
+
}
private void createTaxonSections(RootElement parent) {
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);
DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
- if(!(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart)){
- derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
- }
+// if(!(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart)){
+// derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
+// }
addPart(derivedUnitGeneralDetailSection);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(derivedUnitBaseDetailSection);
//for editors working with facades
- if(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart){
+ if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(gatheringEventDetailSection);
// ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(taxonRelationshipDetailSection);
//addPart(referencedEntityBaseDetailSection);
-
+
NonViralNameDetailSection nonViralNameSection = formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(nameRelationshipSection);
//}
-
+
//}
}
package eu.etaxonomy.taxeditor.view.e4;
-import org.eclipse.jface.viewers.StructuredSelection;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
protected ScrolledForm scrolledForm;
- private final Composite body;
+ private Composite body;
protected RootElement rootElement;
+ @Inject
+ protected IEclipseContext context;
+
//TODO: create a super class for this?
private Object input;
- protected final IDirtyMarkable part;
+ protected IDirtyMarkable part;
+ @Inject
+ public AbstractCdmDataViewerE4() {
+
+ }
- public AbstractCdmDataViewerE4(Composite parent, IDirtyMarkable part) {
+ public void init(Composite parent, IDirtyMarkable part) {
this.part = part;
managedForm = new ManagedForm(parent){
formFactory.dispose();
formFactory = null;
}
- formFactory = new CdmFormFactory(Display.getCurrent(), this);
+ formFactory = new CdmFormFactory(Display.getCurrent(), this);
+ ContextInjectionFactory.inject(formFactory, context);
}
/** {@inheritDoc} */
@Override
public Control getControl() {
- if(body.isDisposed()){
- return null;
- }
- for(Control child : body.getChildren()){
- return child;
- }
+ if(body!=null){
+ if(body.isDisposed()){
+ return null;
+ }
+ for(Control child : body.getChildren()){
+ return child;
+ }
+ }
return body;
}
public void setInput(Object input) {
this.input = input;
if(input!=null){
- // reset selection
- setSelection(new StructuredSelection(input));
refresh();
}
}
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.PersistState;
+import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
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.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.taxon.Taxon;
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.editor.IDistributionEditor;
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsViewerE4;
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
}
- protected abstract void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart);
-
- @Inject
- @Optional
- public void selectionChanged(
- @Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
- @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
- MPart thisPart){
- Object savablePart = WorkbenchUtility.findSavablePart(this);
- if(savablePart==null){
- showEmptyPage();
- }
- if(delaySelection==null){
- delaySelection = new DelaySelection(selection, activePart, thisPart);
- }
- delaySelection.setSelection(selection);
- delaySelection.setActivePart(activePart);
- delaySelection.setThisPart(thisPart);
- if(!isInDelay){
- isInDelay = true;
- Display.getCurrent().asyncExec(delaySelection);
- }
- }
-
protected Viewer viewer;
+ protected MPart thisPart;
+
protected MPart selectionProvidingPart;
+ protected Object previousSelection;
+
protected ISelectionChangedListener selectionChangedListener;
+ public ISelectionChangedListener getSelectionChangedListener() {
+ return selectionChangedListener;
+ }
+
@Inject
protected ESelectionService selService;
+ protected abstract void selectionChanged_internal(Object selection, MPart activePart, MPart thisPart);
+
+ @Inject
+ public void selectionChanged(
+ @Optional@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
+ @Optional@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+ MPart thisPart, UISynchronize sync, EPartService partService){
+ if(activePart==thisPart && EventUtility.getActiveEditorPart(partService)==null){
+ showEmptyPage();
+ return;
+ }
+ if(previousSelection==null ||
+ previousSelection!=selection){//skip redundant rendering of details view
+ if(delaySelection==null){
+ delaySelection = new DelaySelection(selection, activePart, thisPart);
+ }
+ delaySelection.setSelection(selection);
+ delaySelection.setActivePart(activePart);
+ delaySelection.setThisPart(thisPart);
+ if(!isInDelay){
+ isInDelay = true;
+ sync.asyncExec(delaySelection);
+ previousSelection = selection;
+ }
+ }
+ }
+
/** {@inheritDoc} */
@Override
public void changed(Object object) {
if(part instanceof IDirtyMarkable){
((IDirtyMarkable) part).changed(object);
}
- else {
- IEditorPart editor = AbstractUtility.getActiveEditor();
- if (editor != null && editor instanceof IDirtyMarkable) {
- ((IDirtyMarkable) editor).changed(object);
- }
- }
}
}
protected void showViewer(IStructuredSelection selection, MPart activePart, Viewer viewer){
if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
Object element = selection.getFirstElement();
+ Object part = createPartObject(activePart);
if(selection.getFirstElement()!=null){
- if (element instanceof Taxon){
- Taxon taxon = HibernateProxyHelper.deproxy(element, Taxon.class);
- if (taxon.isMisapplication()){
- Object part = createPartObject(activePart);
- if(part instanceof ITaxonEditor){
- Taxon accepted = ((ITaxonEditor) part).getTaxon();
-
-// Taxon accepted= ((ITaxonEditor)activePart).getTaxon();
- Set<TaxonRelationship> rels = taxon.getTaxonRelations(accepted);
+ if (element instanceof Taxon){
+ Taxon taxon = HibernateProxyHelper.deproxy(element, Taxon.class);
+ if (taxon.isMisapplication()){
- if (rels.iterator().hasNext()){
- TaxonRelationship rel = rels.iterator().next();
- if (rel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) && !rel.getFromTaxon().equals(((ITaxonEditor) part).getTaxon())){
- viewer.setInput(rel);
+ if(part instanceof ITaxonEditor){
+ Taxon accepted = ((ITaxonEditor) part).getTaxon();
- return;
- }
- }
- }
+ // Taxon accepted= ((ITaxonEditor)activePart).getTaxon();
+ Set<TaxonRelationship> rels = taxon.getTaxonRelations(accepted);
+ if (rels.iterator().hasNext()){
+ TaxonRelationship rel = rels.iterator().next();
+ if (rel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR()) && !rel.getFromTaxon().equals(((ITaxonEditor) part).getTaxon())){
+ viewer.setInput(rel);
- }
- }
- viewer.setInput(element);
+ return;
+ }
+ }
+ }
+ }
+ }
+ if (element instanceof Distribution && part instanceof IDistributionEditor){
+ ((DetailsViewerE4)viewer).setInput(element, part);
+ }else{
+ viewer.setInput(element);
+ }
+ selectionProvidingPart = activePart;
}
- selectionProvidingPart = activePart;
}
}
viewer.setInput(null);
}
selectionProvidingPart = null;
+ if(thisPart!=null){
+ thisPart.setLabel(getViewName());
+ }
}
protected IStructuredSelection createSelection(Object selection) {
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
}
@PostConstruct
- public void create(Composite parent) {
- viewer = new DetailsViewerE4(parent, this);
+ public void create(Composite parent, MPart thisPart, IEclipseContext context) {
+
+ this.thisPart = thisPart;
+
+ viewer = ContextInjectionFactory.make(DetailsViewerE4.class, context);
+ ((DetailsViewerE4)viewer).init(parent, this);
// Propagate selection from viewer
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
return;
}
}
+// if (partObject instanceof IDistributionEditor){
+//
+// showViewer(structuredSelection, activePart, viewer);
+// return;
+//
+// }
showViewer(structuredSelection, activePart, viewer);
return;
}
@Override
protected void showEmptyPage() {
super.showEmptyPage();
- if(viewer!=null && !viewer.getControl().isDisposed()){
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
((DetailsViewerE4)viewer).destroySections();
}
}
package eu.etaxonomy.taxeditor.view.e4.details;
+import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeNode;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
import eu.etaxonomy.cdm.model.description.CategoricalData;
import eu.etaxonomy.cdm.model.description.DescriptionBase;
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.cdm.model.description.Distribution;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
import eu.etaxonomy.cdm.model.media.Media;
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.editor.IDistributionEditor;
import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
private ISelection selection;
+ private boolean detailsEnabled = true;
- public DetailsViewerE4(Composite parent, IDirtyMarkable part) {
- super(parent, part);
- }
+ public void setInput(Object input, Object activePart) {
+ if (activePart instanceof IDistributionEditor){
+ detailsEnabled = false;
+ }else{
+ detailsEnabled = true;
+ }
+ setInput(input);
+ detailsEnabled = true;
+ }
// START HACK TO MAKE THE DERIVED UNIT FACADE WORK
// since we are getting implementations of DerivedUnitBase from the bulk
// editor
input = DerivedUnitFacade.NewInstance(derivedUnit,
PreferencesUtil.getDerivedUnitConfigurator());
} catch (DerivedUnitFacadeNotSupportedException e) {
-// MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
+ // MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
}
}
else if(input instanceof FieldUnit){
}
}
- } else if (input instanceof DescriptionElementBase) {
- Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
+ } else if (input instanceof DescriptionElementBase){
+ Set<Marker> descriptionMarkers = new HashSet<>();
+ if(((DescriptionElementBase) input).getInDescription()!=null) {
+ descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
+ }
Boolean isUseDescription = false;
for (Marker marker : descriptionMarkers) {
createUserSection(rootElement);
} else if (input instanceof Group) {
createGroupSection(rootElement);
- } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
+ } else if (input instanceof TaxonRelationship && ((TaxonRelationship)input).getType()!=null
+ && ((TaxonRelationship)input).getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
createMisappliedNameSection(rootElement);
}else if (input instanceof TaxonRelationship ) {
createTaxonRelationshipSection(rootElement);
createTermVocabularySection(rootElement);
} else if (input instanceof DefinedTermBase) {
createDefinedTermSection(rootElement);
- }
- else {
+
+ } else if (input instanceof SelectionChangedEvent ) {
+ IStructuredSelection sel =(IStructuredSelection) ((SelectionChangedEvent)input).getSelection();
+ if (sel.getFirstElement()instanceof Distribution){
+ createDescriptionElementSection(rootElement);
+ }
+
+// createDescriptionElementSection(rootElement);
+
+ }else {
createEmptySection(rootElement);
}
layout();
@Override
public void setSelection(ISelection selection, boolean reveal) {
- this.selection = selection;
+ this.selection = selection;
- if(this.selection!=null){
- SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
- fireSelectionChanged(selectionChangedEvent);
- }
+ if(this.selection!=null){
+ SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
+ fireSelectionChanged(selectionChangedEvent);
+ }
}
ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
- TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(taxonBaseDetailSection);
+ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(taxonBaseDetailSection);
}else{
- if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
- TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
+ TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(taxonBaseDetailSection);
- }
+ addPart(taxonBaseDetailSection);
+ }
}
NonViralNameDetailSection nonViralNameSection = formFactory
.createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){
- NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(referenceDetailSection);
+ NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(referenceDetailSection);
}
if ( !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(nomenclaturalStatusSection);
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(nomenclaturalStatusSection);
}
- if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
- ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(protologSection);
- }
+ if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
+ ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(protologSection);
+ }
- if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
- TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(typeDesignationSection);
- }
+ if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
+ TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(typeDesignationSection);
+ }
- if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
- NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(nameRelationshipSection);
- }
+ if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
+ NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(nameRelationshipSection);
+ }
addPart(parsingMessagesSection);
destroySections();
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
- | ExpandableComposite.EXPANDED);
+ | ExpandableComposite.EXPANDED);
+
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nonViralNameSection);
addPart(nomenclaturalStatusSection);
addPart(referenceDetailSection);
- ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
destroySections();
ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(referenceDetailSection);
}
}
private void createDescriptionElementSection(RootElement parent) {
- destroySections();
+ destroySections();
DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ descriptionElementDetailSection.setEnabled(this.detailsEnabled);
- // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ // IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-//
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ // DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+ //
+ // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
// DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
// .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
addPart(descriptionDetailSection);
addPart(naturalLanguageSection);
-// addPart(describedSpecimenSection);
+ // addPart(describedSpecimenSection);
// addPart(descriptionSourceSection);
addPart(scopeSection);
}
DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
//TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
- if(!(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart)){
+ if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
}
addPart(derivedUnitGeneralDetailSection);
addPart(derivedUnitBaseDetailSection);
//for editors working with facades
- if(AbstractUtility.getActiveE4Part() instanceof IDerivedUnitFacadePart){
+ if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(gatheringEventDetailSection);
}
else{
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+ if(PreferencesUtil.isShowTaxonAssociations()){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(taxonAssociationDetailSection);
DerivedUnitFacadeIdentifierSection identifierDetailSection = formFactory.createDerivedUnitFacadeIdentifierSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
addPart(identifierDetailSection);
}
- if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
+ if(!PreferencesUtil.isDeterminationOnlyForFieldUnits()){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(determinationDetailSection);
addPart(gatheringEventDetailSection);
addPart(fieldUnitDetailSection);
- if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
+ if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
addPart(determinationDetailSection);
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);
NonViralNameDetailSection nonViralNameSection = formFactory
- .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
+ .createNonViralNameDetailSection(getConversationHolder(), parent, this, false,
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(nonViralNameSection);
+
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- //if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){
+
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(referenceDetailSection);
- //if ( !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){
- NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
+
+ NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
- formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- addPart(nomenclaturalStatusSection);
- //}
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ addPart(nomenclaturalStatusSection);
- //if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(protologSection);
- //}
- //if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(typeDesignationSection);
- //}
- //if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
addPart(nameRelationshipSection);
- //}
-
- //}
}
private void createTaxonRelationshipSection(RootElement parent) {
- destroySections();
+ destroySections();
- TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ 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(definedTermDetailSection);
}
- @Override
- public void update(CdmDataChangeMap arg0) {
+ @Override
+ public void update(CdmDataChangeMap arg0) {
- }
+ }
}
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
}
@PostConstruct
- public void create(Composite parent) {
- viewer = new SupplementalDataViewerE4(parent, this);
+ public void create(Composite parent, MPart thisPart, IEclipseContext context) {
+
+ this.thisPart = thisPart;
+
+ viewer = ContextInjectionFactory.make(SupplementalDataViewerE4.class, context);
+ ((SupplementalDataViewerE4)viewer).init(parent, this);
}
@Override
@Override
protected void showEmptyPage() {
super.showEmptyPage();
- if(viewer!=null && !viewer.getControl().isDisposed()){
+ if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
((SupplementalDataViewerE4)viewer).destroySections();
}
}
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.VersionableEntity;
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
-import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
import eu.etaxonomy.taxeditor.model.IElementHasDetails;
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
private boolean showDebug;
- public SupplementalDataViewerE4(Composite parent, IDirtyMarkable viewPart) {
- super(parent, viewPart);
- }
-
/** {@inheritDoc} */
@Override
public ISelection getSelection() {
--- /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.view.sessions;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author pplitzner
+ * @since Nov 2, 2017
+ *
+ */
+public class InspectSessionHandler {
+
+ @Execute
+ public void canExecute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell){
+ InspectSessionsDialog dialog = new InspectSessionsDialog(shell, SWT.NONE);
+ dialog.open();
+ }
+}
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.e4.core.commands.ECommandService;
+import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.wb.swt.SWTResourceManager;
import eu.etaxonomy.cdm.api.cache.CdmCacher;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
private Text txtCdmModelOnDisk;
private Text txtDefaultOnDisk;
+ @Inject
+ private ECommandService commandService;
+
+ @Inject
+ private EHandlerService handlerService;
+
@Inject
public SessionsViewPart() {
this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
btnInspectActiveSession.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null);
+ Command command = commandService.getCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID);
+ handlerService.executeHandler(ParameterizedCommand.generateCommand(command, null));
}
});
btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
*/
package eu.etaxonomy.taxeditor.view.specimenSearch;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
+import eu.etaxonomy.cdm.model.location.Country;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
/**
* @author pplitzner
* @date 03.09.2013
private final Text textAccessionNumber;
private final Text textLocality;
private final Text textHerbarium;
- private final Text textCountry;
+ private final Combo textCountry;
private final DateTime dateFrom;
private final DateTime dateTo;
private final Button btnShowDate;
tableWrapLayout.numColumns = 2;
setLayout(tableWrapLayout);
}
-
+ CdmFormFactory formFactory = new CdmFormFactory(parent.getDisplay());
Label lblTaxonName = new Label(this, SWT.NONE);
lblTaxonName.setText("Taxon Name");
Label lblCountry = new Label(this, SWT.NONE);
lblCountry.setText("Country");
- textCountry = new Text(this, SWT.NONE);
+ textCountry = new Combo(this, SWT.NONE);
textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+ List<Country> items = CdmStore.getTermManager().getPreferredTerms(Country.class);
+ String[] itemsArray = new String[items.size()];
+ int i = 0;
+ for (Country country: items){
+ itemsArray[i]= country.getIso3166_A2() + " - " + country.getLabel();
+ i++;
+ }
+
+ textCountry.setItems(itemsArray);
+
+
Label lblLocality = new Label(this, SWT.NONE);
lblLocality.setText("Locality");
public Text getTextHerbarium() {
return textHerbarium;
}
- public Text getTextCountry() {
+ public Combo getTextCountry() {
return textCountry;
}
public Text getTextLocality() {
}
public void saveLastSate() {
- lastQuery = new OccurenceQuery(getTaxonName(), getCollector(), getCollectorNumber(), getAccessionNumber(), getHerbarium(), getCountry(), getLocality(), getDateFrom(), getDateTo());
+ lastQuery = new OccurenceQuery(getTaxonName(), getCollector(), getCollectorNumber(), getAccessionNumber(), getHerbarium(), getCountry(false), getLocality(), getDateFrom(), getDateTo());
}
/**
* @return the country as a {@link String}
* @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getComboCountry()
*/
- public String getCountry() {
- return specimenSearchComposite.getTextCountry().getText();
+ public String getCountry(boolean biocase) {
+
+ String result = specimenSearchComposite.getTextCountry().getText();
+ if (result.contains("-") && biocase){
+ result = result.substring(4).trim();
+ }else if (result.contains("-")){
+ result = result.substring(0,2).trim();
+ }
+ return result;
+
// return specimenSearchComposite.getComboCountry().getItem(specimenSearchComposite.getComboCountry().getSelectionIndex());
}
if(wrappedPart!=null){
partObject = wrappedPart;
}
- if(AbstractUtility.getActiveE4Editor() == null){
+ if(AbstractUtility.getActiveEditor() == null){
showEmptyPage();
return;
}
Bundle-ManifestVersion: 2
Bundle-Name: eu.etaxonomy.taxeditor.test
Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
Bundle-ActivationPolicy: lazy
Bundle-Vendor: EDIT
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</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.10.0
+Bundle-Version: 4.11.0
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.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eu.etaxonomy.taxeditor.webapp</artifactId>
Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Workbench Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.workbench;singleton:=true
-Bundle-Version: 4.10.0
-Bundle-Activator: eu.etaxonomy.taxeditor.workbench.Activator
-Bundle-Vendor: EDIT
+Export-Package: eu.etaxonomy.taxeditor.bulkeditor,
+ eu.etaxonomy.taxeditor.workbench,
+ eu.etaxonomy.taxeditor.workbench.part
+Bundle-Name: Workbench Bundle
+Bundle-Version: 4.11.0
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.e4.ui.workbench,
org.eclipse.equinox.p2.operations;bundle-version="2.4.200",
org.eclipse.e4.core.di,
org.eclipse.e4.ui.services,
- org.eclipse.e4.core.commands
+ org.eclipse.e4.core.commands,
+ org.eclipse.e4.core.contexts,
+ org.eclipse.e4.core.services
+Bundle-ManifestVersion: 2
+Bundle-Activator: eu.etaxonomy.taxeditor.workbench.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: javax.inject;version="1.0.0"
Bundle-ActivationPolicy: lazy
-Export-Package: eu.etaxonomy.taxeditor.bulkeditor,
- eu.etaxonomy.taxeditor.workbench,
- eu.etaxonomy.taxeditor.workbench.part
+Bundle-Vendor: EDIT
+Import-Package: javax.inject;version="1.0.0"
+
<?xml version="1.0" encoding="ASCII"?>
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_pdAMoB4DEeehWtOSgLepjA">
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_FaGnoCQNEeen_7LZsZSNoA" featurename="menuContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_FaGnoCQNEeen_7LZsZSNoA" featurename="menuContributions" parentElementId="xpath:/">
<elements xsi:type="menu:MenuContribution" xmi:id="_FaGnoSQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.workbench.menu" parentId="org.eclipse.ui.main.menu">
<children xsi:type="menu:Menu" xmi:id="_FaGnoiQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.workbench.menu.file" label="%menu.label" mnemonics="G">
<children xsi:type="menu:Menu" xmi:id="_FaGnoyQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.navigation.menu.new" label="%menu.label.3" mnemonics="N"/>
<command href="../eu.etaxonomy.taxeditor.application/fragment.e4xmi#_RWLmQB62EeePLJ5to5QrXQ"/>
</children>
<children xsi:type="menu:MenuSeparator" xmi:id="_FaGnriQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.menuseparator.1"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_FaGnqiQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.import" label="%command.label.3" mnemonics="I">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_FaGnqyQNEeen_7LZsZSNoA" coreExpressionId="isCdmStoreConnected"/>
- <command href="../eu.etaxonomy.taxeditor.application/fragment.e4xmi#_dlo3oB60EeePLJ5to5QrXQ"/>
- </children>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_FaGnrCQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.export" label="%command.label.4" mnemonics="E">
- <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_FaGnrSQNEeen_7LZsZSNoA" coreExpressionId="isCdmStoreConnected"/>
- <command href="../eu.etaxonomy.taxeditor.application/fragment.e4xmi#_CYHrgB62EeePLJ5to5QrXQ"/>
- </children>
<children xsi:type="menu:MenuSeparator" xmi:id="_FaGnsyQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.filemenu.io"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_FaGntCQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.handledmenuitem.exit" label="%command.label.5" mnemonics="x">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_FaGntSQNEeen_7LZsZSNoA" coreExpressionId="isCdmStoreConnected"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="__2Uf4FJ4EeeL4Lhic-6yjw" elementId="eu.etaxonomy.taxeditor.workbench.handledmenuitem.commandlabel11" label="%command.label.11" mnemonics="D" command="_WOTDYB7EEeeRW_RHu3JLqQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_FaGntyQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.workbench.menu.window" label="%menu.label.1" mnemonics="W">
- <children xsi:type="menu:Menu" xmi:id="_DH_m0CkKEeeCvszP-_feIA" elementId="eu.etaxonomy.taxeditor.menu.showView" label="Show View" mnemonics="V"/>
- <children xsi:type="menu:MenuSeparator" xmi:id="_FaGnuCQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.windowMenu.last"/>
- <children xsi:type="menu:HandledMenuItem" xmi:id="_FaGnuSQNEeen_7LZsZSNoA" elementId="org.eclipse.ui.main.menu.window.preferences" label="%command.label.12">
- <command href="../eu.etaxonomy.taxeditor.application/fragment.e4xmi#_l9kXoB7PEeeC-JvycL9ysA"/>
+ <children xsi:type="menu:Menu" xmi:id="_DH_m0CkKEeeCvszP-_feIA" elementId="eu.etaxonomy.taxeditor.menu.showView" label="Show View" mnemonics="V">
+ <children xsi:type="menu:MenuSeparator" xmi:id="_Nop28LMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.workbench.menuseparator.navigation"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_ZPNN4LMoEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.workbench.menuseparator.afterConcept" visible="false"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_OQi9YLMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.workbench.menuseparator.editing"/>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_OUNVYLMnEeeMU61m8yqdaA" elementId="eu.etaxonomy.taxeditor.workbench.menuseparator.referencing"/>
</children>
+ <children xsi:type="menu:MenuSeparator" xmi:id="_FaGnuCQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.application.windowMenu.last"/>
+ <children xsi:type="menu:HandledMenuItem" xmi:id="_FaGnuSQNEeen_7LZsZSNoA" elementId="org.eclipse.ui.main.menu.window.preferences" label="%command.label.12" command="_l9kXoB7PEeeC-JvycL9ysA"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_FaGnuiQNEeen_7LZsZSNoA" elementId="eu.etaxonomy.taxeditor.workbench.menu.admin" label="%menu.label.4" mnemonics="A">
<children xsi:type="menu:HandledMenuItem" xmi:id="_b4RFsCQsEeeq76l4saMAFQ" elementId="eu.etaxonomy.taxeditor.workbench.menu.admin.dbpreferences" label="%command.label.23" command="_VawPsCQsEeeq76l4saMAFQ">
</children>
</elements>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_nOhPoB9zEeeIA_2gwq7JKg" featurename="trimContributions" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_nOhPoB9zEeeIA_2gwq7JKg" featurename="trimContributions" parentElementId="xpath:/">
<elements xsi:type="menu:TrimContribution" xmi:id="_FIbzwB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.workbench.trimcontribution.mainToolbar" parentId="org.eclipse.ui.main.toolbar" positionInParent="after=additions">
<children xsi:type="menu:ToolBar" xmi:id="_KDVngB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.workbench.menu.toolbar.0">
<children xsi:type="menu:HandledToolItem" xmi:id="_KvxPsB92EeeIA_2gwq7JKg" elementId="eu.etaxonomy.taxeditor.workbench.menu.toolbar.new" label="%command.label.21" iconURI="platform:/plugin/org.eclipse.ui/icons/full/etool16/new_wiz.png" command="_hooiQB7QEeeC-JvycL9ysA"/>
</children>
</elements>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1jM6sB4JEeehWtOSgLepjA" featurename="commands" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1jM6sB4JEeehWtOSgLepjA" featurename="commands" parentElementId="xpath:/">
<elements xsi:type="commands:Command" xmi:id="_dlo3oB60EeePLJ5to5QrXQ" elementId="org.eclipse.ui.file.import" commandName="%command.label.3"/>
<elements xsi:type="commands:Command" xmi:id="_CYHrgB62EeePLJ5to5QrXQ" elementId="org.eclipse.ui.file.export" commandName="%command.label.4"/>
<elements xsi:type="commands:Command" xmi:id="_LVTo8B62EeePLJ5to5QrXQ" elementId="org.eclipse.ui.file.close" commandName="%command.label"/>
<elements xsi:type="commands:Command" xmi:id="_hMjgECZsEeer_rabtodzWA" elementId="eu.etaxonomy.taxeditor.command.openPart" commandName="Open Part">
<parameters xmi:id="_hMjgESZsEeer_rabtodzWA" elementId="eu.etaxonomy.taxeditor.workbench.commandparameter.partName" name="partName" optional="false"/>
</elements>
+ <elements xsi:type="commands:Command" xmi:id="_S00XkL2gEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.command.collapse" commandName="Collapse"/>
+ <elements xsi:type="commands:Command" xmi:id="_Z0st0L4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.workbench.command.expand" commandName="Expand"/>
</fragments>
- <fragments xsi:type="fragment:StringModelFragment" xmi:id="_WLNcQCQsEeeq76l4saMAFQ" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+ <fragments xsi:type="fragment:StringModelFragment" xmi:id="_WLNcQCQsEeeq76l4saMAFQ" featurename="handlers" parentElementId="xpath:/">
<elements xsi:type="commands:Handler" xmi:id="_WLNcQSQsEeeq76l4saMAFQ" elementId="eu.etaxonomy.taxeditor.OpenExternalAboutPlatformHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.OpenExternalAboutPlatformHandler" command="_UZ2zYCQsEeeq76l4saMAFQ"/>
<elements xsi:type="commands:Handler" xmi:id="_WLNcQiQsEeeq76l4saMAFQ" elementId="eu.etaxonomy.taxeditor.OpenExternalParserHelpHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.OpenExternalParserHelpHandler" command="_UZ_WQCQsEeeq76l4saMAFQ"/>
<elements xsi:type="commands:Handler" xmi:id="_WLNcQyQsEeeq76l4saMAFQ" elementId="eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" command="_Va29YCQsEeeq76l4saMAFQ"/>
<elements xsi:type="commands:Handler" xmi:id="_nSIiECUKEeeHw5lTgGMs1Q" elementId="eu.etaxonomy.taxeditor.handler.OpenImportPreferenceHandler" command="_fdEqUCUKEeeHw5lTgGMs1Q"/>
<elements xsi:type="commands:Handler" xmi:id="_2fnUYCZ0EeeQLpuomSmVoQ" elementId="eu.etaxonomy.taxeditor.workbench.OpenPartHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.OpenPartHandler" command="_hMjgECZsEeer_rabtodzWA"/>
<elements xsi:type="commands:Handler" xmi:id="_dBGosFp0Eee4PsIXei-TMg" elementId="eu.etaxonomy.taxeditor.workbench.SaveHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.SaveHandler" command="_X-56IFp0Eee4PsIXei-TMg"/>
+ <elements xsi:type="commands:Handler" xmi:id="_UvfiQL2lEeeyWfw0n8-ICQ" elementId="eu.etaxonomy.taxeditor.workbench.handler.CollapseHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.handler.CollapseHandler" command="_S00XkL2gEeeyWfw0n8-ICQ"/>
+ <elements xsi:type="commands:Handler" xmi:id="_bkScIL4vEeewU62zpvPllA" elementId="eu.etaxonomy.taxeditor.workbench.handler.ExpandHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.workbench/eu.etaxonomy.taxeditor.workbench.handler.ExpandHandler" command="_Z0st0L4vEeewU62zpvPllA"/>
</fragments>
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_Z4f0kFsaEeebk7BsM35KOg" featurename="children" parentElementId="org.eclipse.ui.contexts.dialogAndWindow">
<elements xsi:type="commands:BindingContext" xmi:id="_5pEDMFsaEeebk7BsM35KOg" elementId="eu.etaxonomy.taxeditor.workbench.bindingcontext" name="Taxonomic Editor Keybinding Context"/>
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="e4PreferencePages" name="e4PreferencePages" schema="schema/e4PreferencePages.exsd"/>
+ <extension-point id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider" schema="schema/e4PreferenceStoreProvider.exsd"/>
<extension
id="eu.etaxonomy.taxeditor.workbench.workbench.model"
name="Taxonomic Editor Application Model"
<parent>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
public class AppModelId {
public static final String COMMANDPARAMETER_TAXEDITOR_BULKEDITOR_COMMANDPARAMETER_INPUTTYPE = "taxeditor-bulkeditor.commandParameter.inputType";
+ public static final String COMMAND_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_OPENBULKEDITORFORTAXONNODE = "eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForTaxonNode";
public static final String COMMAND_TAXEDITOR_BULKEDITOR_DYNAMICOPENMENU = "taxeditor-bulkeditor.dynamicopenmenu";
+ public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_DYNAMICMENUCONTRIBUTION_0 = "eu.etaxonomy.taxeditor.bulkeditor.dynamicmenucontribution.0";
public static final String DYNAMICMENUCONTRIBUTION_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_DYNAMICMENUCONTRIBUTION_REFERENCING_OPENIN = "eu.etaxonomy.taxeditor.bulkeditor.dynamicmenucontribution.referencing.openIn";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_MENU_ADMIN_BULK_GROUPS = "eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_groups";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_MENU_ADMIN_BULK_USERS = "eu.etaxonomy.taxeditor.bulkeditor.menu.admin.bulk_users";
public static final String HANDLEDMENUITEM_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEWMENU_REFERENCINGOBJECTS = "eu.etaxonomy.taxeditor.store.showViewMenu.referencingobjects";
+ public static final String HANDLER_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_HANDLER_DEFAULTHANDLER_OPENBULKEDITORFORTAXONNODEHANDLER = "eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForTaxonNodeHandler";
public static final String MENUSEPARATOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_MENUSEPARATOR_0 = "eu.etaxonomy.taxeditor.bulkeditor.menuseparator.0";
public static final String MENU_BULKEDITOR_MENUS_OPENMENU = "bulkeditor.menus.openmenu";
public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_MENU_ADMIN_GROUPBULK_GROUPPARAM = "eu.etaxonomy.taxeditor.bulkeditor.menu.admin.groupBulk.groupParam";
public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_MENU_ADMIN_USERBULK_USERPARAM = "eu.etaxonomy.taxeditor.bulkeditor.menu.admin.userBulk.userParam";
public static final String PARAMETER_EU_ETAXONOMY_TAXEDITOR_STORE_SHOWVIEW_PARAMETER_DETAILSVIEW = "eu.etaxonomy.taxeditor.store.showView.parameter.detailsView";
+ public static final String PARTDESCRIPTOR_BULKEDITOR_EDITOR = "bulkeditor.editor";
public static final String PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_REFERENCINGOBJECTS_E4_REFERENCINGOBJECTSVIEWE4 = "eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.e4.ReferencingObjectsViewE4";
public static final String POPUPMENU_EU_ETAXONOMY_TAXEDITOR_BULKEDITOR_POPUPMENU_REFERENCINGOBJECTSVIEW = "eu.etaxonomy.taxeditor.bulkeditor.popupmenu.referencingobjectsview";
}
\ No newline at end of file
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
+
public class OpenPartHandler {
@Execute
- public void execute(ParameterizedCommand commandParameters, EPartService partService) {
+ public void execute(ParameterizedCommand commandParameters, EPartService partService, MApplication application, EModelService modelService) {
if (null == commandParameters) {
return;
Map parameterMap = commandParameters.getParameterMap();
String partId = parameterMap.get(AppModelId.COMMANDPARAMETER_EU_ETAXONOMY_TAXEDITOR_WORKBENCH_COMMANDPARAMETER_PARTNAME).toString();
MPart part = partService.createPart(partId);
- partService.showPart(part, PartState.ACTIVATE);
+ part = partService.showPart(part, PartState.ACTIVATE);
+ if(part.getObject() instanceof IE4SavablePart){
+ MPartStack editorAreaPartStack = WorkbenchUtility.getEditorAreaPartStack(application, modelService);
+ if(editorAreaPartStack!=null){
+ editorAreaPartStack.getChildren().add(part);
+ }
+ part = partService.showPart(part, PartState.VISIBLE);
+ }
}
@CanExecute
*/
package eu.etaxonomy.taxeditor.workbench;
-import java.lang.reflect.Field;
+import java.util.List;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
-import org.eclipse.ui.ISaveablePart;
-import org.eclipse.ui.internal.E4PartWrapper;
-import org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor;
-import org.eclipse.ui.internal.e4.compatibility.CompatibilityView;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
import eu.etaxonomy.taxeditor.workbench.part.ISelectionElementEditingPart;
if(object instanceof MPart){
object = ((MPart) activePart).getObject();
}
- try {
- if(object instanceof E4PartWrapper){
- Field field = object.getClass().getDeclaredField("wrappedPart");
- field.setAccessible(true);
- object = field.get(object);
- }
- else if(object instanceof CompatibilityView || object instanceof CompatibilityEditor){
- Field field = object.getClass().getSuperclass().getDeclaredField("wrapped");
- field.setAccessible(true);
- object = field.get(object);
- }
- } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- }
- //TODO can this still happen??
- if(object instanceof MPart){
- object =((MPart) object).getObject();
- }
return object;
}
if(selectionProvidingPart instanceof ISelectionElementEditingPart){
return findSavablePart((ISelectionElementEditingPart) selectionProvidingPart);
}
- else if(selectionProvidingPart instanceof ISaveablePart || selectionProvidingPart instanceof IE4SavablePart || selectionProvidingPart instanceof MPart){
+ else if(selectionProvidingPart instanceof IE4SavablePart || selectionProvidingPart instanceof MPart){
return selectionProvidingPart;
}
return null;
}
+
+
+ public static MPartStack getPartStack(String stackId, MApplication application, EModelService modelService){
+ if(application!=null){
+ List<MPartStack> stacks = modelService.findElements(application, stackId, MPartStack.class, null);
+ if(!stacks.isEmpty()){
+ return stacks.iterator().next();
+ }
+ }
+ return null;
+ }
+
+ public static MPartStack getEditorAreaPartStack(MApplication application, EModelService modelService){
+ //FIXME E4 hack for opening in e3 editor area
+ if(application!=null){
+ //FIXME E4 hack for opening in e3 editor area
+ List<MArea> elements = modelService.findElements(application, "org.eclipse.ui.editorss", MArea.class, null);
+ for (MArea mArea : elements) {
+ List<MPartSashContainerElement> children = mArea.getChildren();
+ for (MPartSashContainerElement mPartSashContainerElement : children) {
+ if(mPartSashContainerElement instanceof MPartStack){
+ return (MPartStack) mPartSashContainerElement;
+ }
+ }
+ }
+ }
+ return null;
+ }
}
--- /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.workbench.handler;
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
+
+/**
+ * @author pplitzner
+ * @since Oct 30, 2017
+ *
+ */
+public class CollapseHandler {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ Object object = activePart.getObject();
+ if(object instanceof ICollapsableExpandable){
+ ((ICollapsableExpandable) object).collapse();
+ }
+ }
+
+}
--- /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.workbench.handler;
+
+import javax.inject.Named;
+
+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 eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
+
+/**
+ * @author pplitzner
+ * @since Oct 30, 2017
+ *
+ */
+public class ExpandHandler {
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+ Object object = activePart.getObject();
+ if(object instanceof ICollapsableExpandable){
+ ((ICollapsableExpandable) object).expand();
+ }
+ }
+
+}
--- /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.workbench.part;
+
+/**
+ * Implementing classes should provide a tree viewer (or something alike)
+ * which can be collapsed and expanded)
+ * @author pplitzner
+ * @since Oct 30, 2017
+ *
+ */
+public interface ICollapsableExpandable {
+
+ /**
+ * Collapse all tree items
+ */
+ public void collapse();
+
+ /**
+ * Expand all tree items
+ */
+ public void expand();
+
+}
--- /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.workbench.wizard;
+
+/**
+ * @author pplitzner
+ * @since Oct 4, 2017
+ *
+ */
+public class WizardChooser {
+
+}
<?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.10.0">
+<?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.11.0">
<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.10.0" 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.11.0" 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.10.0</version>
+ <version>4.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
</prerequisites>
<groupId>eu.etaxonomy</groupId>
<artifactId>taxeditor-parent</artifactId>
- <version>4.10.0</version>
+ <version>4.11.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.10.0</cdmlib.version>
+ <cdmlib.version>4.11.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.10.0</taxeditor.version>
+ <taxeditor.version>4.11.0</taxeditor.version>
<update.dir>snapshot</update.dir>
<unitils.version>3.4.2</unitils.version>
<log4j.version>1.2.17</log4j.version>