Merge branch 'release/4.11.0' 4.11.0
authorjenkins <jenkins-int@bgbm.org>
Wed, 8 Nov 2017 11:20:15 +0000 (12:20 +0100)
committerjenkins <jenkins-int@bgbm.org>
Wed, 8 Nov 2017 11:20:15 +0000 (12:20 +0100)
586 files changed:
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/fragment.e4xmi
eu.etaxonomy.taxeditor.application/pom.xml
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/LifeCycleManager.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ModelResourceHandler.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/ChecklistPerspective.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Default.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/DerivatePerspective.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/PolytomousKey.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Taxonomic.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Uses.java
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.bulkeditor/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.bulkeditor/fragment.e4xmi
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/pom.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineDocumentProvider.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/AnnotatedLineEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/DeleteObjectHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/NewObjectHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorLineDisplay.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorSearch.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorUtil.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorLabelProvider.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorSearchE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicMarkerTypeEditingMenuE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicNewObjectMenuE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/OpenBulkEditorContributionItemE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertPerson2TeamHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertTeam2PersonHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/MergeGroupHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/OpenBulkEditorHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/RemoveMergeCandidateHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMarkerFlagHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeCandidateHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeTargetHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/OpenBulkEditorHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/SetMarkerFlagHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForIdentifiableEntity.java [deleted file]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForIdentifiableEntityE4.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForTaxonNodeHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AgentEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/GroupEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/MediaEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameRelationshipEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/OccurrenceEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/ReferenceEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/TaxonEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/UserEditorInput.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/preference/BulkEditorMarkerPreferencePage.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/e4/ReferencingObjectsViewE4.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/build.properties
eu.etaxonomy.taxeditor.cdmlib/pom.xml
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CachedCommonServiceImpl.java
eu.etaxonomy.taxeditor.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.editor/fragment.e4xmi
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/pom.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IDropTargetable.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IMultiPageTaxonEditorPage.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorAdapterFactory.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputDataChangeBehaviourE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/CdmAuthorityEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/handler/EditCdmAuthoritiesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/handler/EditCdmAuthoritiesHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditNewTaxonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewNameHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewPersonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewReferenceHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewTeamHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenSpecimenEditorForTypeSpecimenHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonBaseHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonNodeHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/internal/TaxeditorEditorPlugin.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractGraphKeyEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractIdentificationEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/AbstractGraphKeyEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/KeyEditorDataChangeBehaviourE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/handler/ApplyLayoutHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListItem.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyGraphEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateChildNodeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateSiblingNodeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/DeleteNodeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/InsertNewNodeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/OpenPolytomousGraphEditorHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/RefreshNodeNumberingHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateChildNodeHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateSiblingNodeHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/RefreshNodeNumberingHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/l10n/Messages.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/l10n/messages.properties
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedGroup.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedNameContainer.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptGroup.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ContainerFactory.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/HomotypicalSynonymGroup.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisappliedGroup.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/NameViewer.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetEffect.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/IDropTargetableE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AbstractGroupE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroup.java with 52% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AbstractGroupedContainerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java with 71% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AbstractHomotypicalGroupContainerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractHomotypicalGroupContainer.java with 71% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedGroupE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedNameContainerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ContainerFactoryE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/HomotypicalSynonymGroupE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/MisapplicationContainerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java with 76% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/MisappliedGroupE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/NameViewerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/SynonymContainerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/SynonymContainer.java with 82% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDragListenerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDragListener.java with 53% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDragSourceEffect.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDragSourceEffect.java with 64% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDropTargetEffect.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDropTargetListenerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetListener.java with 64% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHeterotypicSynonymHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHomotypicSynonymHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateMisapplicationHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateSynonymInHomotypicalGroupHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteAllEmptyNamesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteTaxonBaseHandlerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteTaxonBaseHandler.java with 59% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SetBasionymHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/operation/MoveSynonymToAnotherAcceptedTaxonOperationE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/MoveSynonymToAnotherAcceptedTaxonOperation.java with 54% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateNameRelationOperation.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteNameRelationOperation.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonBaseOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/RemoveHomotypicalGroupBasionymOperation.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistDropdownSelectionListenerE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorHelper.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/handler/OpenChecklistEditorHandlerE4.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java with 52% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/CdmComboBoxViewerCellEditor.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/DistributionEditingSupport.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/OpenDistributionHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/ConceptViewPartE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/CreateConceptRelationHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/DeleteConceptRelationHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/e4/handler/OpenRelatedConceptInBulkEditorHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/e4/ConceptGraphViewE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForDescriptionElement.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForSpecimenOrOBservationBase.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivativeEditorForTaxonNode.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenSpecimenEditorFromMenu.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/FactualDataPartE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/CreateDescriptionElementHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/CreateDescriptionHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DescriptionsMenuPropertyTesterE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonHandlerE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionElementHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/ToggleShowOnlyIndividualAssociationsHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaLabelProvider.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewLabelProvider.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/e4/MediaViewPartE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddExistingMediaHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/AddImageGalleryHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/CreateMediaHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/DeleteMediaHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageDownInListHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/handler/MoveImageUpInListHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/operation/DeleteMediaOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/UsesViewPartE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseRecordHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseSummaryHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/operation/CreateUseRecordOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/CharacterEditor.java
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteMisapplicationOperationTest.java
eu.etaxonomy.taxeditor.editor/src/test/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteSynonymOperationTest.java
eu.etaxonomy.taxeditor.feature.platform/feature.xml
eu.etaxonomy.taxeditor.feature.platform/pom.xml
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.feature/pom.xml
eu.etaxonomy.taxeditor.help/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.help/pom.xml
eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.molecular.lib/pom.xml
eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.molecular/fragment.e4xmi
eu.etaxonomy.taxeditor.molecular/plugin.xml
eu.etaxonomy.taxeditor.molecular/pom.xml
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCopyHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCutHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorPasteHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ChangePherogramQualityOutputTypeE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CreateConsensusSequenceHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramLeftHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramRightHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/EditSequenceHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ExportSequenceToFileHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/LoadPherogramHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ReverseComplementHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ShowPherogramHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleInsertOverwriteHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleLeftRightInsertionHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramBaseCallLinesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramProbabilitiesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/UpdateConsensusSequenceHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/package-info.java
eu.etaxonomy.taxeditor.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/pom.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/AppModelId.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigatorStateManager.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/RecentNamesContributionItem.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/WorkbenchUndoContextAdapterFactory.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartDataChangeBehaviorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/NewPolytomousKeyHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyListHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyNodesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingDeletePolytomousKeyHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingUpdatePolytomousKeyAllNodesHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/EditPolytomousKeyNodesHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/NewPolytomousKeyHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyListHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RefreshPolytomousKeyNodesHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingDeletePolytomousKeyHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/handler/RemotingEditPolytomousKeyNodesHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/Messages.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages.properties
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/l10n/messages_de.properties
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/Root.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeNavigatorComparator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorContentProviderE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorDataChangeBehaviorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorLabelProviderE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDragListenerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDropAdapterE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/ChangeAcceptedTaxonToSynonymHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CloneClassificationHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CopyHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CreateClassificationHierarchyHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/DeleteHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java with 63% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/LinkWithTaxonHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveFactualDataHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveTaxonHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveTaxonHandler.java with 53% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewClassificationHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RefreshTreeHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingChangeAcceptedTaxonToSynonymHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingChangeAcceptedTaxonToSynonymHandler.java with 66% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingDeleteTaxonNodeHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingDeleteTaxonNodeHandler.java with 64% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveFactualDataHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveFactualDataHandler.java with 54% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveTaxonNodeHandlerE4.java [moved from eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RemotingMoveTaxonNodeHandler.java with 71% similarity]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetSecReferenceForSubtreeHandlerE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NavigatorHandlerUtils.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewClassificationHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewTaxonNodeHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RefreshTreeHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperation.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetPublishForSubtreeOperation.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetSecundumForSubtreeOperation.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchOption.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/e4/SearchResultViewE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/test/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/MoveTaxonOperationTest.java
eu.etaxonomy.taxeditor.printpublisher/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.printpublisher/pom.xml
eu.etaxonomy.taxeditor.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
eu.etaxonomy.taxeditor.store/fragment.e4xmi
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/pom.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/ListComponent.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/CdmAuthorityTableDropTargetListener.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/dnd/transfer/TaxonNodeTransfer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/IDistributionEditor.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermDropAdapterE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermEditorE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/DefinedTermMenuE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateDefinedTermHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/CreateTermVocabularyHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/DeleteTermBaseHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/e4/handler/OpenDefinedTermEditorHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateTermVocabularyHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/DeleteTermBaseHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/AbstractDefinedTermEditorInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/TermEditorInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/EventUtility.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/WorkbenchEventConstants.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditorComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ReconnectHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowRemotingLoginWindowHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/SwitchUserHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenHandlerBase.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsViewHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenClassificationWizardHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenHandlerBaseE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenTaxonNodeWizardHandlerE4.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenTaxonNodeWizardHandler.java with 55% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerE4.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenDistributionEditorWizardHandler.java with 55% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenPasswordWizzardHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ReconnectHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowLoginWindowHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowRemotingLoginWindowHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/SwitchUserHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractOpenImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/GenericConfiguratorWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileAndChooseVocIdWizardPageE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileDataSourceWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/NomenclaturalCodeWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportConfiguratorWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/ClassificationChooserWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/OpenAbcdImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/ExcelDistributionUpdateWizardE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/OpenExcelDistributionImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/OpenExcelSpecimenImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/SpecimenCdmExcelImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/ExcelNormalExplicitTaxaImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/OpenExcelTaxaImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/OpenRisImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/RISImportWizardE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/OpenSddImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/SddImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/OpenTcsImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/TcsImportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractOpenExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/OpenCdmLightExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/CsvExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/OpenCsvExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/CsvNameExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/OpenCsvNameExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/OpenCsvPrintExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/DarwinCoreArchiveExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/OpenDwcaExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/JaxbExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/OpenJaxbExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/OpenSddExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/SddExportWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java [changed mode: 0755->0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ColorResources.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FontResources.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AbstractNewEntityWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/RemotingCdmUpdateOperation.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/e4/RemotingCdmHandlerE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultFeatureTreePreferenecs.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/MediaPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/matching/NonViralNameMatchingPreference.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/AbstractMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalStatusTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/AppModelId.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/LoginManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/EditViewerDropAdapter.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/PublishSubTreeConfiguratorWizardPage.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetPublishForSubtreeWizard.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumConfiguratorWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetSecundumForSubtreeConfigurationWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmFormElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractFormSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ImageElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grantedauthority/CdmAuthorityComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grantedauthority/CdmAuthorityCompositeViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/AbstractEditWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/CloneClassificationWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/NaturalLanguageDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/DistributionDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/IndividualsAssociationDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/operation/ChangeDescriptionElementType.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/grantedAuthority/GrantedAuthorityLabelTextProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractDeterminationEventDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/DerivedUnitTypeDesignationSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/BioCaseEditorInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/GbifImportEditorInput.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/DataImportViewE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SaveImportedSpecimenActionE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/handler/OpenSpecimenImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/e4/handler/AbstractDataSourceHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/AbstractDataSourceHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/CloneDataSourceHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/EditDataSourceHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/datasource/handler/UpdateDataSourceHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/CdmSectionPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmDataViewerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmEditorPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataViewerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchController.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/supplementaldata/SupplementalDataViewPart.java
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.test/pom.xml
eu.etaxonomy.taxeditor.webapp/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.webapp/pom.xml
eu.etaxonomy.taxeditor.workbench/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.workbench/fragment.e4xmi
eu.etaxonomy.taxeditor.workbench/plugin.xml
eu.etaxonomy.taxeditor.workbench/pom.xml
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/AppModelId.java
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/OpenPartHandler.java
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/WorkbenchUtility.java
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/CollapseHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/ExpandHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/ICollapsableExpandable.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/wizard/WizardChooser.java [new file with mode: 0644]
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre
eu.etaxonomy.taxeditor/pom.xml
pom.xml

index 4c7be8d024619ea601efb60176f5af1be83a540e..77c6c0cca72b1195cff48ac8c50c64dacc85fa6f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Application
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.application;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-Activator: eu.etaxonomy.taxeditor.TaxonomicEditorPlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/plugin
index 1e9ad5b620dac87383779195031a18543f21c334..e20f173a94278a0df9532c87824ca293d02a84fd 100644 (file)
@@ -1,7 +1,7 @@
 <?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"/>
@@ -80,7 +80,7 @@
     <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">
index 9d1a3ddb0840cebad87ff7e6583c0506d2c8f87f..084f12b6fee69b654bd9c552ff70dad46f3055f4 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index 6c86f22371e71adb69a263265e207de0af0da3e4..af9b282ef304c08a366a542bd0d12df30ce7eca7 100644 (file)
@@ -12,29 +12,50 @@ package eu.etaxonomy.taxeditor;
 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
@@ -42,11 +63,58 @@ public class LifeCycleManager {
     }
 
     @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) {
+    }
+
 }
index 5067af229b28205f631632346c24fc2974bcbe8e..d8c56e1fcc873c3d8bfa443d4ba06eba29286c13 100644 (file)
@@ -54,8 +54,7 @@ import org.osgi.framework.Bundle;
  * 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
@@ -94,7 +93,9 @@ public class ModelResourceHandler implements IModelResourceHandler {
     @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;
     }
 
index 752a45a4f97c4e4aa1b498ffb6e704b8007a3c10..42e48b8cb09769eae8cf9b5cc40435bc67848120 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -12,14 +12,6 @@ package eu.etaxonomy.taxeditor.perspective;
 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
@@ -29,7 +21,7 @@ public class ChecklistPerspective extends Default {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
         * .IPageLayout)
@@ -39,14 +31,12 @@ public class ChecklistPerspective extends Default {
                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());
index 8e008436ebabc7a13ef0ffe48e97dfd32e9d7864..d116d80d79165e78d0f28fa6475871802509d272 100644 (file)
@@ -1,14 +1,13 @@
 /**
- * 
+ *
  */
 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
@@ -17,19 +16,23 @@ import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
 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);
        }
 
 }
index d62253534ec5211dc98ed760de23db016ed2e952..37bb8e5cb6de37f9838a8701751508a79c84adee 100644 (file)
@@ -9,12 +9,6 @@
 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
@@ -25,16 +19,12 @@ public class DerivatePerspective extends Default {
 
     @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);
     }
 
 }
index 92564c1ac56c07d8f13d11c1a8a97d434bf4d356..5b5bf8ae05b3744548fe545292891677b9ea325f 100644 (file)
@@ -1,13 +1,11 @@
 /**
- * 
+ *
  */
 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
@@ -20,12 +18,12 @@ public class PolytomousKey extends Default {
         */
        @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());
        }
 
index f16a8164bf313504148d93b983fd2c49c80b8a37..787aff78ce680aa14a3c05d496923c90187e3ec6 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -12,12 +12,7 @@ package eu.etaxonomy.taxeditor.perspective;
 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
@@ -26,22 +21,20 @@ import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
  */
 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());
        }
 }
index 7f7216cf93a6c6e42742f676abaf0b21581fe60a..92ffa76d4e850bbea57d72bf8ebe0b27adabf8ef 100644 (file)
@@ -1,16 +1,15 @@
 /**\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
@@ -22,13 +21,13 @@ public class Uses extends Default {
        /** {@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
index 70417efe9f0263fe144a011465651ab1f256d01e..df022e25aa6bff9fd1a4317eb8739a990aef0b11 100644 (file)
@@ -2,13 +2,14 @@ Manifest-Version: 1.0
 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,
@@ -23,7 +24,9 @@ Require-Bundle: eu.etaxonomy.taxeditor.workbench,
  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,
index 45e622ab14bb8b413123c6679e7c88b233660d6d..68d4e2a3af222f0f13dd1ed161b39fac81f2722a 100644 (file)
@@ -31,10 +31,16 @@ command.name.9 = convert to Team
 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
index 5c0c9847fb5ad313a5376d0e0852fb0131c2d2cf..460ffac5c2dc19832089df1635ad411441839729 100644 (file)
@@ -31,10 +31,16 @@ command.name.9 = In Team umwandeln
 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
index 6ad9b40365821754c74539c49544b00fefbe6f91..fef500f18df5b666210baf6fa6f341ca90c8721e 100644 (file)
@@ -1,17 +1,29 @@
 <?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>
index 5ea516688106c5fa85f5ff5196519855abc0efb6..7ff8ad34c686a37460fb49d7f9266a53873f42de 100644 (file)
          </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>
index 1496fb306f9b947a1106d2b5a26663615e4c7c85..1ac9549e46a33b488d1a52ce58b4aa846ce7e67e 100644 (file)
@@ -3,7 +3,7 @@
        <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>
index 13c3affd2d9149d7aae811c3bb3e6044671e83fe..e8bbbe9cb2dad5a0cbeb547cd52c70e4747814c6 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.ui.IEditorInput;
 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;
@@ -149,7 +148,7 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
         * @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);
@@ -253,14 +252,14 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                        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);
@@ -275,7 +274,7 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                                }
                                if (annotation.isMarkedAsMerged()) {
                                        persistenceService.merge(annotation.getEntity(), annotation.getMergeTarget()); //  merge
-                               } 
+                               }
                                if (annotation.isMarkedAsDeleted()) {
                                        try {
                                                persistenceService.delete(annotation.getEntity(), annotation.getDeleteConfigurator());
@@ -284,7 +283,7 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                                                e.printStackTrace();
                                        } //  merge
                                }
-                               
+
                                else {
                                        // TODO clarify w AM whether this needs to be executed on merged objects
                                        //persistenceService.delete(annotation.getEntity()); // delete
@@ -391,7 +390,7 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                        Object entity = annotation.getEntity();
                        //annotation.markAsDeleted(configurator);
                        model.removeAnnotation(annotation);
-                       
+
                        // Immediately followed by a delimiter?
                        int annotationEnd = offset + length;
                        try {
@@ -403,9 +402,9 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                        }
 
                        try {
-                               
+
                                document.replace(offset, length, "");
-                               
+
                        } catch (BadLocationException e) {
                                MessagingUtils.error(getClass(), "Problems removing annotated line", e);
                        }
@@ -424,6 +423,6 @@ public class AnnotatedLineDocumentProvider extends AbstractDocumentProvider {
                        updateLineFromAnnotation(annotation);
                }
        }
-       
-       
+
+
 }
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/AnnotatedLineEditorE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/AnnotatedLineEditorE4.java
new file mode 100644 (file)
index 0000000..9e1ac8e
--- /dev/null
@@ -0,0 +1,351 @@
+/**
+ * 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;
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/DeleteObjectHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/DeleteObjectHandlerE4.java
new file mode 100644 (file)
index 0000000..814c4d3
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+* 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;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/NewObjectHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/e4/handler/NewObjectHandlerE4.java
new file mode 100644 (file)
index 0000000..d585ed6
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * 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();
+            }
+        }
+    }
+}
index 20eb0d1467c5a28f93229ccdbbb55a32dc612f8e..c9f149c949ec2122b9dd6fac1ff0e6e7e5359163 100644 (file)
@@ -103,9 +103,9 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
     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;
        }
 
@@ -308,9 +308,9 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
                        //conversation.clear();
                        //conversation.commit(true);
 
-                       getEditorInput().dispose();
-                       getEditorInput().bind();
-                       getEditorInput().performSearch(query);
+//                     getEditorInput().dispose();
+//                     getEditorInput().bind();
+//                     getEditorInput().performSearch(query);
 
                        refresh();
 
@@ -333,11 +333,11 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
                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) {
index b48bdc0604c4cf3af0779c8a5a9e3bd67fe8f247..32b914058e897eb83c49ca4448dcad57ffd3325f 100644 (file)
@@ -9,26 +9,17 @@
 
 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>
@@ -64,7 +55,7 @@ public class BulkEditorLineDisplay implements ILineDisplayStrategy {
        /** {@inheritDoc} */
        @Override
     public String getText(Object entity) {
-               return editor.getEditorInput().getText((ICdmBase) entity);
+               return "";//editor.getEditorInput().getText((CdmBase) entity);
        }
 
        /** {@inheritDoc} */
@@ -73,26 +64,26 @@ public class BulkEditorLineDisplay implements ILineDisplayStrategy {
 
                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;
        }
index f1e7a0e43aa94eede09892bff204f92da6212dda..66359b6e9470a76f59f6a26fbae0d046e134d96b 100644 (file)
@@ -87,7 +87,7 @@ public class BulkEditorSearch {
        }
 
        private void createSortCombo(Composite parent, int style) {
-               sortCombo = new BulkEditorSortCombo(parent, editor.getEditorInput().getSortProviders());
+//             sortCombo = new BulkEditorSortCombo(parent, editor.getEditorInput().getSortProviders());
 
        }
 
index 5af7744eff322b7aedbbb88dc9c542f5837ac0f3..b1d8f21f9116471bb7241889f768f3c4b94c215b 100644 (file)
@@ -11,16 +11,18 @@ package eu.etaxonomy.taxeditor.bulkeditor;
 
 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>
@@ -31,44 +33,6 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
  */
 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>
@@ -79,6 +43,18 @@ public class BulkEditorUtil extends AbstractUtility{
                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>
         *
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
new file mode 100644 (file)
index 0000000..053e91d
--- /dev/null
@@ -0,0 +1,327 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorLabelProvider.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorLabelProvider.java
new file mode 100644 (file)
index 0000000..51f2f61
--- /dev/null
@@ -0,0 +1,83 @@
+// $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;
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorSearchE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorSearchE4.java
new file mode 100644 (file)
index 0000000..fd1de67
--- /dev/null
@@ -0,0 +1,186 @@
+/**
+* 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();
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicMarkerTypeEditingMenuE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicMarkerTypeEditingMenuE4.java
new file mode 100644 (file)
index 0000000..bbe0613
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+* 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);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicNewObjectMenuE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicNewObjectMenuE4.java
new file mode 100644 (file)
index 0000000..962da79
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+* 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;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/OpenBulkEditorContributionItemE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/OpenBulkEditorContributionItemE4.java
new file mode 100644 (file)
index 0000000..b1a1481
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ * 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()]);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertPerson2TeamHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertPerson2TeamHandlerE4.java
new file mode 100644 (file)
index 0000000..651327c
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertTeam2PersonHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertTeam2PersonHandlerE4.java
new file mode 100644 (file)
index 0000000..3952f00
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java
new file mode 100644 (file)
index 0000000..5b6f6e7
--- /dev/null
@@ -0,0 +1,265 @@
+/**
+ * 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;
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/MergeGroupHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/MergeGroupHandlerE4.java
new file mode 100644 (file)
index 0000000..b4a8168
--- /dev/null
@@ -0,0 +1,126 @@
+/**
+ * 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/OpenBulkEditorHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/OpenBulkEditorHandlerE4.java
new file mode 100644 (file)
index 0000000..0cf9b16
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+* 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);
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/RemoveMergeCandidateHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/RemoveMergeCandidateHandlerE4.java
new file mode 100644 (file)
index 0000000..082c4ea
--- /dev/null
@@ -0,0 +1,50 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMarkerFlagHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMarkerFlagHandlerE4.java
new file mode 100644 (file)
index 0000000..08a304d
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeCandidateHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeCandidateHandlerE4.java
new file mode 100644 (file)
index 0000000..bc7d81f
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeTargetHandlerE4.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMergeTargetHandlerE4.java
new file mode 100644 (file)
index 0000000..f4197b9
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+* 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;
+    }
+}
index bdf6ecdcde7ab53f96ab9f37a950771179b38a96..7f2c48a63e4dd75363b2137f55af62a45fd9711a 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -11,14 +11,9 @@ 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.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>
@@ -28,22 +23,23 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @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;
        }
 }
index 1eee0f1b75dd55c92eb8ebbe4a7e51d3397edef5..84829d86bb8fb535c074dff44229073877f4aeb9 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -44,37 +44,37 @@ public class SetMarkerFlagHandler extends AbstractHandler {
         * @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;
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForIdentifiableEntity.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/defaultHandler/OpenBulkEditorForIdentifiableEntity.java
deleted file mode 100644 (file)
index 6910f3d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-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);
-               }
-       }
-
-
-}
index c21063f64c74b155b4a076ba29558c5c91ded57c..4d492c32182b86787607512d270af5f7786c2ead 100644 (file)
@@ -2,27 +2,52 @@ package eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler;
 
 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
+                ;
+    }
 
 }
index 8307781b14ade0829ede480496225ae37d16232f..8b9975b410e486d1da8d3f972f66175cff3beac9 100644 (file)
@@ -2,17 +2,17 @@ package eu.etaxonomy.taxeditor.bulkeditor.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.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) {
@@ -20,12 +20,17 @@ public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<Ta
     }
 
     @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;
     }
 
 }
index c87a2a01e6230a9c5017db21ebc6b8b122279cf5..388f1aafddaa6a4e65fc86b66a5ed768a383f767 100644 (file)
@@ -11,19 +11,18 @@ package eu.etaxonomy.taxeditor.bulkeditor.input;
 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;
@@ -45,12 +44,17 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @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;
@@ -76,40 +80,46 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEnt
                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) {
@@ -168,6 +178,30 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEnt
                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
index 51806e3cb97197c4b41b53a9df5ccf0ee484b070..1c5f1405631755baca8d7eedd7970c8d1f55980c 100644 (file)
@@ -51,18 +51,12 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
                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();
@@ -114,25 +108,11 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
                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();
@@ -142,7 +122,6 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
                return sortProviders;
        }
 
-
        @Override
        protected IEntityCreator<TeamOrPersonBase> createEntityCreator() {
                return new AgentCreator();
@@ -164,21 +143,15 @@ public class AgentEditorInput extends AbstractBulkEditorInput<TeamOrPersonBase>
            }
        }
 
-    /* (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);
        }
 
-
-
 }
index 5363498db438c75b5fd30c8d6abe3a9d26cbfb3f..b12f1153f354fb2869aeb876074ac26145f70c02 100644 (file)
@@ -45,29 +45,18 @@ public class GroupEditorInput extends AbstractBulkEditorInput<Group> {
                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)
index 62b7d78131fc2c5519cddde7bfb8196f1d61f720..94d1e030a7c4c65d3601706cd3922ecfa94b7738 100644 (file)
@@ -18,7 +18,6 @@ import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurato
 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;
@@ -51,15 +50,10 @@ public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
         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
@@ -68,7 +62,7 @@ public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
        if (config instanceof MediaDeletionConfigurator){
                mediaConfig = (MediaDeletionConfigurator) config;
        } else{
-               
+
        }
         return CdmStore.getService(IMediaService.class).delete(entity.getUuid(), mediaConfig) != null;
     }
@@ -97,7 +91,7 @@ public class MediaEditorInput extends AbstractBulkEditorInput<Media> {
 
         return sortProviders;
     }
-    
+
        @Override
        protected Media loadEntity(UUID entityUuid) {
                List<String> propertyPaths = Arrays.asList(new String[]{});
index dae27fec0019bacae52cc9ea96121a9f05bbe6b8..2fe85c18ae8c6c069ba8f02b237e1629d9abf568 100644 (file)
@@ -50,26 +50,11 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonName> {
                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>
         *
@@ -91,7 +76,7 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonName> {
        /** {@inheritDoc} */
        @Override
        public List listEntities(IIdentifiableEntityServiceConfigurator configurator) {
-               
+
                configurator.setPropertyPaths(getPropertyPaths());
                return CdmStore.getSearchManager().findNames(configurator, this.getConversation());
        }
@@ -109,18 +94,18 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonName> {
                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
@@ -173,7 +158,7 @@ public class NameEditorInput extends AbstractBulkEditorInput<TaxonName> {
          "name.relationsToThisName",
          "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status",
          "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName"});
-        
+
         return nameBasePropertyPaths;
     }
 
index 1262bdc8147e70a746da1d15af6de776ce885a0d..258568831107b2505d4475661d67049e817ab0db 100644 (file)
@@ -51,24 +51,11 @@ public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRel
                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)
         */
index 6d00f417120ce8a733e919f39724338acfb37280..94b66d0f757a7a34a1adf9836d2552cac9b2bd3f 100644 (file)
@@ -71,26 +71,11 @@ public class OccurrenceEditorInput extends AbstractBulkEditorInput<SpecimenOrObs
                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)){
index a5c8687490a06559bd4662827f4d0e3bdffdd80b..56068596699c0595c58ad144b1caea6a5128d398 100644 (file)
@@ -53,32 +53,11 @@ public class ReferenceEditorInput extends AbstractBulkEditorInput<Reference> {
                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>
         *
index 4d2a7257cdc53a00fefc590180671e14b13b04c7..c8f402abb3e0fd52673e7af1979053607182609f 100644 (file)
@@ -7,8 +7,6 @@ import java.util.UUID;
 \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
@@ -17,9 +15,10 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 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
@@ -43,18 +42,11 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
                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
@@ -64,6 +56,15 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
                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
@@ -85,7 +86,7 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
 //             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
@@ -117,18 +118,18 @@ public class TaxonEditorInput extends AbstractBulkEditorInput<TaxonBase>{
                        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
index c4730a7de3fec95040330d885afb31dcd4a8c217..fa45be18ebd1f56812bea6ec7d9ade4195f2d272 100644 (file)
@@ -43,22 +43,11 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
                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)
         */
@@ -117,7 +106,7 @@ public class UserEditorInput extends AbstractBulkEditorInput<User> {
     public void merge() {
 
     }
-    
+
 
        @Override
        protected User loadEntity(UUID entityUuid) {
index c6d286321ca7f06d0d58d31231f5c6c602e5d577..de3c8a327fb2babd3311761531a7ec9552e93548 100644 (file)
@@ -15,7 +15,6 @@ import org.eclipse.ui.IWorkbench;
 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;
@@ -32,9 +31,6 @@ public class BulkEditorMarkerPreferencePage extends FieldEditorPreferencePage im
        @Override
        public void init(IWorkbench workbench) {
                setPreferenceStore(PreferencesUtil.getPreferenceStore());
-               if(!CdmStore.isActive()) {
-            MessagingUtils.noDataSourceWarningDialog(null);
-               }
        }
 
     @Override
index 81e2c0ca6993e785a83d4b6215a7816dcbcd9ebf..79c7a2a2d80e689a8c8c301b6883d677853e1d44 100644 (file)
@@ -459,7 +459,9 @@ public class ReferencingObjectsViewE4 extends AbstractCdmEditorPartE4 {
        /** {@inheritDoc} */
        @PreDestroy
        public void dispose() {
-               conversation.close();
+           if(conversation!=null){
+               conversation.close();
+           }
        }
 
        /** {@inheritDoc} */
index efc35c5dc507fd6b69f354e92e77330ec806067c..0113ac44a862dbc4a357f97e23f46fad7e0dd4b1 100644 (file)
@@ -6,7 +6,12 @@ public class Messages extends NLS {
     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;
@@ -15,6 +20,9 @@ public class Messages extends NLS {
        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;
@@ -38,6 +46,11 @@ public class Messages extends NLS {
     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);
index 1972e26f9edc58eca31776429d6ab52cb2345fec..32020f6670bdb2714bd5a199fbfcc717b2061438 100644 (file)
@@ -1,3 +1,8 @@
+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
@@ -7,6 +12,9 @@ BulkEditorInputType_5=Users
 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
@@ -32,4 +40,9 @@ DeleteHandler_SYNONYM=synonym
 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
index 289fc5eb7904fec6f2c6c2f4719b5cfed3c4af4b..2c3547e1819e48f58024d9c7ac6716c8f7890437 100644 (file)
@@ -1,3 +1,8 @@
+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
@@ -7,6 +12,9 @@ BulkEditorInputType_5=Nutzer
 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.
@@ -33,3 +41,8 @@ DeleteHandler_TAXON=Taxon
 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
index 8411b11c6603ef6eb016bbee12c368aae062482e..04ac2850d54dbce5b14c89dbc38c6ad9fbde6361 100644 (file)
        <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.8.8.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.8.8.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.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"/>
index 83d447f62e73c35665970657ea8cb4d76a18aae4..d2ac3e702f207636fdd83b894cb70d606a8e570f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: CDM Library Dependencies Plugin
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.cdmlib;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Eclipse-BundleShape: dir
 Export-Package: com.google.api,
  com.google.api.detect,
@@ -34,7 +34,6 @@ Export-Package: com.google.api,
  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,
@@ -647,15 +646,15 @@ Bundle-ClassPath: .,
  lib/aspectjrt-1.8.8.jar,
  lib/aspectjweaver-1.8.8.jar,
  lib/batik-xml-1.7.jar,
- lib/cdmlib-commons-4.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,
index bc8cf0e92b8a8fd637ac56af5337d4bd3df9034f..630253ccae9fca7ac9fe22f0940bf571f3004ca7 100644 (file)
@@ -6,15 +6,15 @@ bin.includes = META-INF/,\
                lib/aspectjrt-1.8.8.jar,\
                lib/aspectjweaver-1.8.8.jar,\
                lib/batik-xml-1.7.jar,\
-               lib/cdmlib-commons-4.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,\
index a92229f4b7f5b4a2cf902c9e8e7ef9cbb9380f9e..40786bfa07760de5399d3055ec629652eb51e5bf 100644 (file)
@@ -4,7 +4,7 @@
   <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
index 74290439910aec699031b520c59a9a9506c850bf..7947a8768184f5a4a8e60eadcd089e2a4039a8f9 100644 (file)
@@ -21,7 +21,6 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 /**
  * @author cmathew
  * @date 14 Oct 2014
- *
  */
 @Component
 public class CachedCommonServiceImpl implements ICachedCommonService {
@@ -37,9 +36,6 @@ 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));
@@ -47,7 +43,6 @@ public class CachedCommonServiceImpl implements ICachedCommonService {
             throw new NullPointerException("CDM Entity of type " + clazz.getName() + " with id " + id  + " is null.");
         }
         return cdmEntity;
-
     }
 
 
@@ -61,64 +56,34 @@ public class CachedCommonServiceImpl implements ICachedCommonService {
         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);
     }
 
-
-
-
-
-
 }
index 93130c6e7943feec4ed04493787269758fed2ad8..413ad46749ef584411fd6de86d0edb590ed7795c 100644 (file)
@@ -2,16 +2,18 @@ Manifest-Version: 1.0
 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,
@@ -35,6 +37,7 @@ Require-Bundle: org.eclipse.ui,
  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
index 597303c58c2ce7547bad6933540aa8bac1aef20b..f5c02e2ce1030b050a44c659a0a085606d70a5b2 100644 (file)
@@ -114,7 +114,7 @@ category.name.6 = -- Concept Relations
 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
index 5874ddf2c4eb8dbe2dc5eb309e7df3b64506a935..ee706cc4c0cbd94a61e4b20429f11e6ba1096051 100644 (file)
@@ -113,7 +113,7 @@ category.name.6 = -- Konzeptbeziehungen
 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
index 1726e9b47355bd20997f0e5f775cfba43e2effad..0eeb9c512c8a9da3d8570dd72897b01a319abaae 100644 (file)
@@ -4,6 +4,8 @@
   <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>
@@ -96,6 +98,8 @@
       <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>
index 9e38d50c715a890d3933a2741047f4c5b5418524..43aa6449fa5a2c65aca4df3c130af42134a104de 100644 (file)
             </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"
index 6f525221298cc3cd5049c58ebcf56a41368cc160..33a6dbf2a9aa5d0901ea23c878d65983a09ed9a1 100644 (file)
@@ -4,7 +4,7 @@
   <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>
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java
new file mode 100644 (file)
index 0000000..4a16214
--- /dev/null
@@ -0,0 +1,250 @@
+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
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorStateManager.java
deleted file mode 100644 (file)
index 1939f83..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
-* 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);
-                       }
-               }
-       }
-}
index 4b24599c6c8e2aa7811c704901e8b2f17b00b944..3eee87cc7ded7d814d887dba4838ddc6bc3196de 100644 (file)
@@ -9,44 +9,42 @@
 
 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
@@ -57,61 +55,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 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
@@ -128,84 +73,91 @@ public class EditorUtil extends AbstractUtility {
 //         }
 //     }
 
-       /**
-        * 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);
        }
 
        /**
@@ -231,86 +183,6 @@ public class EditorUtil extends AbstractUtility {
                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
@@ -350,6 +222,22 @@ public class EditorUtil extends AbstractUtility {
                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
@@ -377,25 +265,6 @@ public class EditorUtil extends AbstractUtility {
                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
@@ -435,38 +304,18 @@ public class EditorUtil extends AbstractUtility {
         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;
     }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IDropTargetable.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IDropTargetable.java
deleted file mode 100644 (file)
index fbec6c6..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 
- */
-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();
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IMultiPageTaxonEditorPage.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/IMultiPageTaxonEditorPage.java
deleted file mode 100644 (file)
index ce93845..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
-* 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();
-       
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditor.java
deleted file mode 100644 (file)
index 35fa77a..0000000
+++ /dev/null
@@ -1,596 +0,0 @@
-/**
- * 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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorAdapterFactory.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorAdapterFactory.java
deleted file mode 100644 (file)
index 1caeb17..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 
- */
-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
-               };
-       }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/MultiPageTaxonEditorDataChangeBehaviour.java
deleted file mode 100644 (file)
index d14036d..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
-* 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);
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/Page.java
deleted file mode 100644 (file)
index ae645c4..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputDataChangeBehaviourE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputDataChangeBehaviourE4.java
new file mode 100644 (file)
index 0000000..5f20427
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+* 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);
+
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputE4.java
new file mode 100644 (file)
index 0000000..2483c0c
--- /dev/null
@@ -0,0 +1,330 @@
+/**
+ * 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;
+    }
+
+}
index f4979367750683a514ae5263b75b6940999b7d34..1e52926c7127002969f92b9e723292750571c617 100644 (file)
@@ -12,10 +12,6 @@ import java.util.Arrays;
 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;
@@ -33,7 +29,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  *
  */
 
-public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
+public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IConversationEnabled {
        private ConversationHolder conversation;
        private Group group;
 
@@ -57,10 +53,6 @@ public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IE
                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;
@@ -83,43 +75,9 @@ public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IE
        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)
@@ -158,6 +116,6 @@ public class CdmAuthorityEditorInput extends CdmEntitySessionInput implements IE
     @Override
     public void merge() {
         group = CdmStore.getService(IGroupService.class).merge(group, true).getMergedEntity();
-       
+
     }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/CdmAuthorityEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/CdmAuthorityEditorE4.java
new file mode 100644 (file)
index 0000000..1da16a4
--- /dev/null
@@ -0,0 +1,145 @@
+/**
+* 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();
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/handler/EditCdmAuthoritiesHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/e4/handler/EditCdmAuthoritiesHandlerE4.java
new file mode 100644 (file)
index 0000000..0e3cc8e
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+* 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;
+
+    }
+}
index bd046f63fdddac859239eed1b4f2e63300397310..977404c441f68724f9090c0b7e8b422c7d63e173 100644 (file)
@@ -23,6 +23,7 @@ import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 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;
 
@@ -44,7 +45,7 @@ public class EditCdmAuthoritiesHandler  extends AbstractHandler {
         */
        @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){
@@ -65,7 +66,7 @@ public class EditCdmAuthoritiesHandler  extends AbstractHandler {
                                                                @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());
                                                                        }
index 181a00cb041ffeae5189254e2dc8f5dde31266ee..7e309a40be1a05b760233567320a941d2bd244e1 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -14,8 +14,6 @@ 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.widgets.Display;
-import org.eclipse.ui.PartInitException;
 
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 
@@ -34,15 +32,12 @@ public class EditNewTaxonHandler extends AbstractHandler implements IHandler {
         * @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;
        }
index ed764a4d635b9bcdb7db483707375887efa6aff5..380bec0088cf0645aab1ebd6f49895c4a9062875 100644 (file)
@@ -16,9 +16,9 @@ public class OpenDerivateViewHandler extends AbstractHandler {
 
     @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;
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java
deleted file mode 100644 (file)
index d10d684..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java
deleted file mode 100644 (file)
index fd9c52f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java
deleted file mode 100644 (file)
index f35bf96..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
-* 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);
-               
-       }
-}
index 58107b5c25ecc07fb6fe7ea6d72598141bc02ce3..60a45f7b906df5c4682808ced640dacfb30085b3 100644 (file)
@@ -1,44 +1,37 @@
 /**
 * 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;
+
        }
 }
index 457e0fb8cc3bf97d5d9a5a50b1193e8322cf2da2..8b65d169d92d5345211b88465af36b50d2454de5 100644 (file)
@@ -1,45 +1,36 @@
 /**
 * 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;
        }
 }
index 96c1c93505da682ff4e77c26eb66c2994d128d95..72dff1118bc9c882e4e83bf910fc4130f52109bf 100644 (file)
@@ -1,43 +1,36 @@
 /**
 * 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;
        }
-
 }
index d496af05b7771b3b2d1c209377c85ff090ec4bb5..2927c33357ed9391414f5684801f7d91ce03b70f 100644 (file)
@@ -1,44 +1,36 @@
 /**
 * 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;
        }
 }
index 1c9fa15c9e7439cf52cfc9f735ffcc996ff247d9..6b9291f5c70690dfd7cda9cfe4cc12dbfce1bedc 100644 (file)
@@ -1,22 +1,22 @@
 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) {
@@ -24,12 +24,20 @@ public class DefaultOpenSpecimenEditorForTypeSpecimenHandler extends
        }
 
        @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;
+    }
+
 }
index 431a898cc644005da84819b7f121788be3a2f0b5..20abde6eaf078e8bbc8bb3b98279d8853aedd1f7 100644 (file)
@@ -1,19 +1,17 @@
 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) {
@@ -21,12 +19,16 @@ public class DefaultOpenTaxonEditorForTaxonBaseHandler extends DefaultOpenHandle
     }
 
     @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;
     }
 
 }
index b6c18e6ef5b791de2523708eb60861e340643df7..2d1011f05029607efa10fc31bcfa26016cbdf070 100644 (file)
@@ -1,20 +1,19 @@
 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) {
@@ -22,13 +21,20 @@ public class DefaultOpenTaxonEditorForTaxonNodeHandler extends DefaultOpenHandle
     }
 
     @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;
+    }
+
 }
index 0eaba0acc4b282be4902ece101cc62ad537f8053..9836d8d6e860d3704965baaa5093616d085a6986 100644 (file)
@@ -4,7 +4,6 @@ import org.apache.log4j.Logger;
 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;
@@ -19,14 +18,14 @@ public class TaxeditorEditorPlugin extends AbstractUIPlugin {
 
        /** 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
         */
@@ -34,25 +33,24 @@ public class TaxeditorEditorPlugin extends AbstractUIPlugin {
        }
 
        /** {@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$
index e328d488e20699b08d43c904841d1636e10ae09a..81d5fe5437ae365a21d5c81e0f360aaf3e63d749 100644 (file)
@@ -93,7 +93,7 @@ public abstract class AbstractGraphKeyEditor<T extends IIdentificationKey>
                        throws PartInitException {
                setSite(site);
                setInput(input);
-               formFactory = new CdmFormFactory(site.getShell().getDisplay());
+//             formFactory = new CdmFormFactory(site.getShell().getDisplay());
        }
 
        /*
index 15c75555946e302a0acfcbfec2ddb64a4c3d26b3..fa36d382f493269d7e55d4c3cfb0356fc9db42c9 100644 (file)
@@ -3,10 +3,6 @@
  */
 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;
@@ -18,7 +14,7 @@ import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
  *
  */
 public abstract class AbstractIdentificationEditorInput<T extends IIdentificationKey>
-               extends CdmEntitySessionInput implements IEditorInput, IConversationEnabled {
+               extends CdmEntitySessionInput implements IConversationEnabled {
 
        private final ConversationHolder conversation;
 
@@ -27,69 +23,6 @@ public abstract class AbstractIdentificationEditorInput<T extends IIdentificatio
                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;
index 1cd36d71140333db6215542671b71fa2194de4de..7d9d318411d3ad3d4a9148ab0bea5b7dc10e9c89 100644 (file)
@@ -25,13 +25,10 @@ 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.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
@@ -223,14 +220,14 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
                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);
+//             }
 
 
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/AbstractGraphKeyEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/AbstractGraphKeyEditorE4.java
new file mode 100644 (file)
index 0000000..a9ade8c
--- /dev/null
@@ -0,0 +1,205 @@
+/**
+ *
+ */
+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);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/KeyEditorDataChangeBehaviourE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/KeyEditorDataChangeBehaviourE4.java
new file mode 100644 (file)
index 0000000..d8791cd
--- /dev/null
@@ -0,0 +1,60 @@
+/**
+* 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();
+                               }
+                       }
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/handler/ApplyLayoutHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/e4/handler/ApplyLayoutHandlerE4.java
new file mode 100644 (file)
index 0000000..22abc7c
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+ *
+ */
+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;
+       }
+
+}
index 9029a237b554d83f302d9afc948233cf65fac820..8610264132be3f5e758686b67c72c2da6864428a 100644 (file)
@@ -23,14 +23,12 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 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.*");
@@ -55,14 +53,6 @@ public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#getName()
-     */
-    @Override
-    public String getName() {
-        return name;
-    }
-
     @Override
     public PolytomousKey getKey() {
         return key;
@@ -96,7 +86,7 @@ public class PolytomousKeyEditorInput extends AbstractIdentificationEditorInput<
     @Override
     public void merge() {
        key = CdmStore.getService(IPolytomousKeyService.class).merge(key,true).getMergedEntity();
-      
+
     }
 
     @Override
index f2ac1a9c3c08aa633b4d539f8a7852463376aebd..8fdae73ce74d023c4fc1dd2a268e04b8e0fceb14 100644 (file)
@@ -26,7 +26,7 @@ import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
  * @created Mar 30, 2011
  * @version 1.0
  */
-class PolytomousKeyGraphContentProvider implements IGraphContentProvider {
+public class PolytomousKeyGraphContentProvider implements IGraphContentProvider {
 
        private List<PolytomousKeyRelationship> relations;
 
index 506d2cec6d5aaf20099642fab1ce43e2566ab0a6..ec1704182b6146047602eb8870e5115a1656f653 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -24,12 +24,12 @@ import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
 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;
@@ -88,7 +88,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#fisheyeNode(java.lang
         * .Object)
@@ -101,7 +101,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getBackgroundColour
         * (java.lang.Object)
@@ -114,7 +114,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderColor(java
         * .lang.Object)
@@ -127,7 +127,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderHighlightColor
         * (java.lang.Object)
@@ -140,7 +140,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getBorderWidth(java
         * .lang.Object)
@@ -152,7 +152,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getForegroundColour
         * (java.lang.Object)
@@ -165,7 +165,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getNodeHighlightColor
         * (java.lang.Object)
@@ -178,7 +178,7 @@ class PolytomousKeyLabelProvider extends LabelProvider implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.zest.core.viewers.IEntityStyleProvider#getTooltip(java.lang
         * .Object)
index 61e859296a41a8aa836d08b9f602187deb2fb076..312d8bb265ee644c19c4c6bc1e5b3adda8419b4d 100644 (file)
@@ -47,7 +47,6 @@ import eu.etaxonomy.taxeditor.editor.EditorUtil;
 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
@@ -99,11 +98,7 @@ public class PolytomousKeyListEditor extends EditorPart implements
                        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());
                            }
                        }
                    }
index 187900a79d77e615ff01d9fab7634bd43f6dee19..63768132d731d56fe638ef8626450a922a78a270 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -16,7 +16,6 @@ import org.eclipse.swt.events.SelectionListener;
 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;
@@ -58,7 +57,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
                // 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());
@@ -88,7 +87,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
                        linkSelectionListener = new SelectionAdapter() {
                                /*
                                 * (non-Javadoc)
-                                * 
+                                *
                                 * @see
                                 * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org
                                 * .eclipse.swt.events.SelectionEvent)
@@ -98,12 +97,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
                                        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());
                                        }
                                }
                        };
@@ -172,7 +166,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
         * )
@@ -185,7 +179,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#isDirty()
         */
        @Override
@@ -195,7 +189,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
         */
        @Override
@@ -206,7 +200,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
         */
        @Override
@@ -217,7 +211,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFocus()
         */
        @Override
@@ -228,7 +222,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#isStale()
         */
        @Override
@@ -239,7 +233,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#refresh()
         */
        @Override
@@ -250,7 +244,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#dispose()
         */
        @Override
@@ -265,7 +259,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
        public PolytomousKeyNode getEntity() {
                return entity;
        }
-       
+
        @Override
        public void setSelected(boolean selected) {
                setBackground(selected ? SELECTED : getPersistentBackground());
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyGraphEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyGraphEditorE4.java
new file mode 100644 (file)
index 0000000..e87e339
--- /dev/null
@@ -0,0 +1,111 @@
+/**
+ *
+ */
+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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/PolytomousKeyListEditorE4.java
new file mode 100644 (file)
index 0000000..ff51281
--- /dev/null
@@ -0,0 +1,327 @@
+/**
+ * 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());
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateChildNodeHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateChildNodeHandlerE4.java
new file mode 100644 (file)
index 0000000..cbdd8d2
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+ *
+ */
+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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateSiblingNodeHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/CreateSiblingNodeHandlerE4.java
new file mode 100644 (file)
index 0000000..9fcdb65
--- /dev/null
@@ -0,0 +1,57 @@
+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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/DeleteNodeHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/DeleteNodeHandlerE4.java
new file mode 100644 (file)
index 0000000..b6cb05a
--- /dev/null
@@ -0,0 +1,156 @@
+/**
+ * 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
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/InsertNewNodeHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/InsertNewNodeHandlerE4.java
new file mode 100644 (file)
index 0000000..30278e3
--- /dev/null
@@ -0,0 +1,96 @@
+/**
+ * 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/OpenPolytomousGraphEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/OpenPolytomousGraphEditorHandler.java
new file mode 100644 (file)
index 0000000..c202fc4
--- /dev/null
@@ -0,0 +1,26 @@
+
+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
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/RefreshNodeNumberingHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/e4/handler/RefreshNodeNumberingHandlerE4.java
new file mode 100644 (file)
index 0000000..259bb6b
--- /dev/null
@@ -0,0 +1,43 @@
+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);
+        }
+    }
+
+}
index 7df790d0a9ff1210bf046f7a509493f6c1c56509..6f86250498993e62d42e1e02629c923ada124e03 100644 (file)
@@ -58,7 +58,6 @@ public class CreateChildNodeHandler extends AbstractHandler {
 
                            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$
                        }
@@ -77,7 +76,6 @@ public class CreateChildNodeHandler extends AbstractHandler {
 
                                AbstractPostOperation operation = new CreateNodeOperation(
                                        label, undoContext, keyNode, editorPage);
-                               AbstractUtility.executeOperation(operation);
                            } catch (NotDefinedException e) {
                                MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
                            }
index f34fd782bc2eab6780c18b63117106d3274a194a..10d32dfb5c51295d37c9bae112e43d7a619fce29 100644 (file)
@@ -60,7 +60,6 @@ public class CreateSiblingNodeHandler extends AbstractHandler {
 
                                                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$
                                        }
index c34fef3a3d372493af6b00f565d2700ec226e9d2..cb7895fe0944826e3d9743d5aae306c2c53e5843 100644 (file)
@@ -5,7 +5,6 @@ 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.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.handlers.HandlerUtil;
@@ -15,7 +14,6 @@ import eu.etaxonomy.taxeditor.editor.EditorUtil;
 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;
@@ -31,7 +29,7 @@ public class RefreshNodeNumberingHandler extends AbstractHandler {
                                        .getActiveEditor();
 
                        if (editorPage instanceof PolytomousKeyListEditor) {
-                                                               
+
                                IStructuredSelection selection = (IStructuredSelection) HandlerUtil
                                                .getCurrentSelection(event);
 
@@ -45,13 +43,12 @@ public class RefreshNodeNumberingHandler extends AbstractHandler {
 
                                                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;
        }
index 338eb51c8cbc842e62f359284ae1275f89274b2e..b0f13ef38f8f20b490d58268f75802fd4cfeedf0 100644 (file)
@@ -174,7 +174,6 @@ public class Messages extends NLS {
     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;
index d0a5d67def711e4626e30fa8a819da94051d215b..7874d9f2a9fff29f67fc88471210f32364d1f74f 100644 (file)
@@ -63,7 +63,6 @@ DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN=Could not open taxon ed
 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
index a1a5776041119f2753c5818ccc5f583e0bc76806..f9b329ab2ae6d3bc7e5e8776cab7562338f0e456 100644 (file)
@@ -63,7 +63,6 @@ DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN=Taxon-Editor f
 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.
@@ -134,7 +133,7 @@ TaxonEditorInput_NO_ACCEPTED_TAXON_PRESENT=
 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 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
deleted file mode 100644 (file)
index da9d5fe..0000000
+++ /dev/null
@@ -1,955 +0,0 @@
-/**
- * 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);
-       }
-
-
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedGroup.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedGroup.java
deleted file mode 100644 (file)
index c968b3b..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
-* 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);
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedNameContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AcceptedNameContainer.java
deleted file mode 100644 (file)
index 4771ca3..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
-* 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);
-       }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptContainer.java
deleted file mode 100644 (file)
index e1fccf3..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
-* 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);
-       }
-}
-
-
-
-
-
-
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptGroup.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ConceptGroup.java
deleted file mode 100644 (file)
index dab86a4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
-* 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
-               
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ContainerFactory.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/ContainerFactory.java
deleted file mode 100644 (file)
index 66c0f51..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 
- */
-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();
-                       }
-               }
-               
-       }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/HomotypicalSynonymGroup.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/HomotypicalSynonymGroup.java
deleted file mode 100644 (file)
index 85c9c72..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
-* 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);
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisappliedGroup.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisappliedGroup.java
deleted file mode 100644 (file)
index 0f3e9ae..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
-* 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));
-       }
-}
index d02ab0313ed66c30e51e83725f34a0a49298a379..8fc5f570a4a20bce5abdb96b84f773cd947fcc0d 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -57,10 +57,10 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * @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;
 
@@ -71,11 +71,11 @@ public class NameViewer extends SourceViewer {
         */
        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;
@@ -84,55 +84,55 @@ public class NameViewer extends SourceViewer {
                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>
         *
@@ -154,7 +154,7 @@ public class NameViewer extends SourceViewer {
                        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()
         */
@@ -170,27 +170,27 @@ public class NameViewer extends SourceViewer {
                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);
        }
 
@@ -201,11 +201,11 @@ public class NameViewer extends SourceViewer {
        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
@@ -214,24 +214,24 @@ public class NameViewer extends SourceViewer {
         * @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;
@@ -243,25 +243,25 @@ public class NameViewer extends SourceViewer {
 //                                     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>
         *
@@ -283,7 +283,7 @@ public class NameViewer extends SourceViewer {
                        throw e;
                }
        }
-       
+
        /**
         * <p>setMenu</p>
         *
@@ -299,10 +299,9 @@ public class NameViewer extends SourceViewer {
         */
        public void setCursorToEOL() {
                getTextWidget().setCaretOffset(getTextWidget().getText().length());
-               getTextWidget().setFocus();
        }
 
-       
+
        /**
         * <p>getCursorPosition</p>
         *
@@ -311,7 +310,7 @@ public class NameViewer extends SourceViewer {
        public int getCursorPosition(){
                return getTextWidget().getCaretOffset();
        }
-       
+
        /**
         * <p>setCursorPosition</p>
         *
@@ -335,15 +334,15 @@ public class NameViewer extends SourceViewer {
                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);
@@ -355,13 +354,13 @@ public class NameViewer extends SourceViewer {
 //                             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>
         *
@@ -374,11 +373,11 @@ public class NameViewer extends SourceViewer {
                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);
@@ -389,7 +388,7 @@ public class NameViewer extends SourceViewer {
                        if (actionBars != null) {
                                actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.UNDO, undoAction);
                                actionBars.setGlobalActionHandler(IWorkbenchActionDefinitionIds.REDO, redoAction);
-                               
+
                        }
                }
        }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetEffect.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/dnd/NameEditorDropTargetEffect.java
deleted file mode 100644 (file)
index 56d6a96..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 
- */
-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));
-               }
-       }
-       
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/IDropTargetableE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/IDropTargetableE4.java
new file mode 100644 (file)
index 0000000..f0eb85f
--- /dev/null
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+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();
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java
new file mode 100644 (file)
index 0000000..11bea36
--- /dev/null
@@ -0,0 +1,702 @@
+/**
+ * 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;
+    }
+
+}
similarity index 52%
rename from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroup.java
rename to eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AbstractGroupE4.java
index 75fe684313cd1ec05325d758d9bdaae36c831a93..aa4c6bc598f9d4d58711caafe0a21c516d370201 100644 (file)
@@ -7,11 +7,12 @@
 * 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;
@@ -20,46 +21,40 @@ import org.eclipse.swt.dnd.Transfer;
 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(){
@@ -73,9 +68,6 @@ public abstract class AbstractGroup implements IDropTargetable{
                editor.getManagedForm().reflow(true);
        }
 
-       /**
-        * <p>createControl</p>
-        */
        protected void createControl() {
                control = editor.getToolkit().createComposite(editor.getControl());
 
@@ -94,52 +86,31 @@ public abstract class AbstractGroup implements IDropTargetable{
                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));
@@ -151,34 +122,28 @@ public abstract class AbstractGroup implements IDropTargetable{
                }
        }
 
-       /**
-        * <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();
                }
        }
@@ -186,14 +151,11 @@ public abstract class AbstractGroup implements IDropTargetable{
        /** {@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();
@@ -201,17 +163,11 @@ public abstract class AbstractGroup implements IDropTargetable{
 
        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;
@@ -219,7 +175,7 @@ public abstract class AbstractGroup implements IDropTargetable{
 
        public void dispose(){
                if(getControl() != null){
-                       for(AbstractGroupedContainer container : getGroupedContainers()){
+                       for(AbstractGroupedContainerE4 container : getGroupedContainers()){
                                container.dispose();
                        }
                        getControl().setMenu(null);
@@ -227,19 +183,8 @@ public abstract class AbstractGroup implements IDropTargetable{
                }
        }
 
-       /**
-        * @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();
@@ -7,7 +7,7 @@
  * 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;
@@ -15,9 +15,11 @@ import java.util.Set;
 
 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;
@@ -40,30 +42,29 @@ import org.eclipse.swt.widgets.Composite;
 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;
@@ -88,12 +89,12 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * 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;
@@ -103,12 +104,12 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        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;
@@ -120,25 +121,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
        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());
        }
 
@@ -149,7 +136,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                createLineWrapSupport();
                createLineBreakListener();
 
-               setMenu(getEditor().getMenu());
+               setMenu();
 
                setDraggableControl(new Control[] { getControl(),
                                getNameViewer().getRulerControl() });
@@ -163,11 +150,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                enableFreeText();
        }
 
-       /**
-        * <p>
-        * createListener
-        * </p>
-        */
        protected void createListener() {
                nameCompositeModifyListener = new ModifyListener() {
 
@@ -192,13 +174,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                };
                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);
@@ -229,62 +204,12 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
         */
        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();
@@ -300,19 +225,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                calculateAnnotations();
        }
 
-       /**
-        * <p>
-        * calculateErrors
-        * </p>
-        */
        synchronized protected void calculateAnnotations() {
                getNameViewer().clearAnnotations();
                showAnnotations();
        }
 
-       /**
-        *
-        */
        public void showAnnotations() {
 
                if (getName() != null && getName().hasProblem()) {
@@ -335,12 +252,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        }
 
-       /**
-        *
-        */
        private void showParsingProblems() {
-               String text = getNameViewer().getTextWidget().getText();
-
                TaxonName name = getName();
                if (name == null){
                        return;
@@ -377,22 +289,14 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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));
        }
 
        /**
@@ -428,25 +332,15 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                enableFreeText();
        }
 
-       /**
-        *
-        */
        protected abstract void updateIcon();
 
        protected abstract void updateIndent();
 
-       /**
-        * <p>
-        * updateNonEditableInfo
-        * </p>
-        */
        protected abstract void updateNonEditableInfo();
 
-       /**
-        *
-        */
        protected void enableFreeText() {
                setEnabled(isFreetextEditingAllowed());
+
        }
 
        /**
@@ -477,7 +371,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                        Set<TaxonBase> taxonBases = name.getTaxonBases();
                        Iterator<TaxonBase> tbItr = taxonBases.iterator();
                        int nonOrphanedTaxonBaseCount = taxonBases.size();
-       
+
                        while(tbItr.hasNext()) {
                                TaxonBase<?> tb = tbItr.next();
                                if(tb.isOrphaned()) {
@@ -517,96 +411,39 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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());
@@ -625,60 +462,41 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        }
 
-       /**
-        * @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) {
@@ -690,26 +508,10 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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());
@@ -718,39 +520,19 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                        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;
@@ -766,17 +548,12 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                                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
@@ -797,14 +574,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        }
 
-       /**
-        * <p>
-        * setBackground
-        * </p>
-        *
-        * @param color
-        *            a {@link org.eclipse.swt.graphics.Color} object.
-        */
        public void setBackground(Color color) {
                control.setBackground(color);
 
@@ -815,32 +584,10 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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(
@@ -850,14 +597,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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());
@@ -886,42 +625,22 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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;
        }
@@ -930,14 +649,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                return focusListener;
        }
 
-       /**
-        * <p>
-        * setDirty
-        * </p>
-        *
-        * @param isDirty
-        *            a boolean.
-        */
        public void setDirty(boolean isDirty) {
                if (isDirty) {
                        getEditor().getManagedForm().dirtyStateChanged();
@@ -945,54 +656,21 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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) {
@@ -1010,7 +688,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                                                operations);
                                dragSource.setTransfer(types);
 
-                               dragSource.addDragListener(new NameEditorDragListener(this));
+                               dragSource.addDragListener(new NameEditorDragListenerE4(this));
                                dragSource.setDragSourceEffect(new NameEditorDragSourceEffect(
                                                control));
                        }
@@ -1042,8 +720,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        private T data;
 
-       private boolean enabled;
-
        /**
         * nonEditableInfo is a label displayed underneath a GroupedComposite's
         * input field. For instance, NameComposites display things like name
@@ -1100,26 +776,11 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                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);
        }
@@ -1133,7 +794,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                lineBreakListener = new LineBreakListener() {
                        @Override
                        public void handleSplitText(String text) {
-                               AbstractGroupedContainer.this.handleSplitText(text);
+                               AbstractGroupedContainerE4.this.handleSplitText(text);
                        }
 
                };
@@ -1165,11 +826,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                }
        }
 
-       /**
-        * <p>
-        * storeCursor
-        * </p>
-        */
        public void storeCursor() {
                this.cursorPosition = getNameViewer().getCursorPosition();
        }
@@ -1186,60 +842,24 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                }
        }
 
-       /**
-        * <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()) {
@@ -1247,51 +867,31 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                }
        }
 
-       /*
-        * (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;
-       }
+
 }
@@ -1,13 +1,13 @@
 /**
 * 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;
@@ -16,21 +16,19 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 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;
 
@@ -38,15 +36,12 @@ public abstract class AbstractHomotypicalGroupContainer extends AbstractGroup {
        }
 
        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;
        }
@@ -58,32 +53,24 @@ public abstract class AbstractHomotypicalGroupContainer extends AbstractGroup {
                }
        }
 
-       /**
-        * 
-        * @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;
        }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedGroupE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedGroupE4.java
new file mode 100644 (file)
index 0000000..f295665
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+* 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);
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedNameContainerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/AcceptedNameContainerE4.java
new file mode 100644 (file)
index 0000000..c9f13ef
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+* 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);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ContainerFactoryE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ContainerFactoryE4.java
new file mode 100644 (file)
index 0000000..0e26133
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+ *
+ */
+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();
+                       }
+               }
+
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/HomotypicalSynonymGroupE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/HomotypicalSynonymGroupE4.java
new file mode 100644 (file)
index 0000000..7e45e79
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+* 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);
+       }
+}
@@ -7,7 +7,7 @@
 * 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;
@@ -17,32 +17,25 @@ import eu.etaxonomy.cdm.model.name.TaxonName;
 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} */
@@ -50,7 +43,7 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
        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())){
@@ -83,15 +76,15 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
                        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;
@@ -99,11 +92,6 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
                setNonEditableInfo(title, false);
        }
 
-       /**
-        * <p>getMisappliedName</p>
-        *
-        * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
-        */
        public Taxon getMisappliedName() {
                return getTaxonBase();
        }
@@ -111,7 +99,7 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
        /** {@inheritDoc} */
        @Override
        protected Font getViewerFont() {
-               return EditorUtil.getFont(Resources.MISAPPLIEDNAME_FONT);
+               return AbstractUtility.getFont(Resources.MISAPPLIEDNAME_FONT);
        }
 
        @Override
@@ -134,12 +122,7 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
        protected void updateIndent() {
                setIndent(MISAPPLIEDNAME_INDENT);
        }
-       
-       /**
-        * <p>
-        * initTextViewer
-        * </p>
-        */
+
        @Override
        protected void initTextViewer() {
 
@@ -159,7 +142,7 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
                }
                calculateAnnotations();
        }
-       
+
        @Override
     public void refresh() {
                // showNameRelations();
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/MisappliedGroupE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/MisappliedGroupE4.java
new file mode 100644 (file)
index 0000000..fe9d8c6
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+* 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));
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/NameViewerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/NameViewerE4.java
new file mode 100644 (file)
index 0000000..6e15618
--- /dev/null
@@ -0,0 +1,271 @@
+/**
+ * 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);
+
+                       }
+               }
+       }
+
+}
+
@@ -1,13 +1,13 @@
 /**
 * 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;
 
@@ -16,7 +16,6 @@ import org.eclipse.swt.graphics.Image;
 
 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;
@@ -31,7 +30,7 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * @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;
@@ -43,37 +42,38 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
         * @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);
@@ -81,31 +81,31 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
                                }
                        }
                }
-               
+
                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>
         *
@@ -114,14 +114,15 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
        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);
        }
 
@@ -135,7 +136,7 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
         * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
         */
        @Override
-       protected void updateIndent() {         
+       protected void updateIndent() {
                setIndent(this.indent );
        }
 }
@@ -1,7 +1,7 @@
 /**
- * 
+ *
  */
-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;
@@ -10,48 +10,45 @@ import org.eclipse.ui.forms.ManagedForm;
 
 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) {
@@ -1,41 +1,32 @@
 /**
- * 
+ *
  */
-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);
        }
-       
+
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDropTargetEffect.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/dnd/NameEditorDropTargetEffect.java
new file mode 100644 (file)
index 0000000..be41b3a
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ *
+ */
+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));
+               }
+       }
+}
@@ -1,9 +1,10 @@
 /**
  *
  */
-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;
@@ -14,37 +15,32 @@ 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.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;
        }
 
@@ -52,10 +48,6 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
        @Override
     public void dragEnter(DropTargetEvent dropTargetEvent) {
                target.dragEntered();
-
-//             if(! EditorUtil.getActiveMultiPageTaxonEditor().equals(editor.getMultiPageTaxonEditor())){
-//                     editor.getMultiPageTaxonEditor().setFocus();
-//             }
        }
 
        /** {@inheritDoc} */
@@ -86,12 +78,12 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                        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();
@@ -103,25 +95,25 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                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);
 
                                }
                        }
@@ -129,13 +121,13 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                }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);
                        }
@@ -153,8 +145,8 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
 
 
        private HomotypicalGroup getHomotypicalGroup() {
-               if(target instanceof AbstractHomotypicalGroupContainer){
-                       return ((AbstractHomotypicalGroupContainer) target).getGroup();
+               if(target instanceof AbstractHomotypicalGroupContainerE4){
+                       return ((AbstractHomotypicalGroupContainerE4) target).getGroup();
                }
                return null;
        }
@@ -171,11 +163,7 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                return null;
        }
 
-       /**
-        * @return
-        *
-        */
-       private TaxonNameEditor getEditor() {
-               return (TaxonNameEditor) EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor();
+       private TaxonNameEditorE4 getEditor() {
+               return (TaxonNameEditorE4) EventUtility.getTaxonEditor();
        }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java
new file mode 100644 (file)
index 0000000..0292995
--- /dev/null
@@ -0,0 +1,146 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java
new file mode 100644 (file)
index 0000000..659e671
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.java
new file mode 100644 (file)
index 0000000..074355c
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHeterotypicSynonymHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHeterotypicSynonymHandlerE4.java
new file mode 100644 (file)
index 0000000..df6121b
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHomotypicSynonymHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateHomotypicSynonymHandlerE4.java
new file mode 100644 (file)
index 0000000..dab6ab3
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateMisapplicationHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateMisapplicationHandlerE4.java
new file mode 100644 (file)
index 0000000..2b8efd3
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateSynonymInHomotypicalGroupHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/CreateSynonymInHomotypicalGroupHandlerE4.java
new file mode 100644 (file)
index 0000000..c412900
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteAllEmptyNamesHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteAllEmptyNamesHandlerE4.java
new file mode 100644 (file)
index 0000000..7bc0f3f
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+* 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;
+    }
+
+}
@@ -7,14 +7,17 @@
 * 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;
@@ -24,52 +27,46 @@ 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.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()) {
@@ -88,24 +85,24 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler,
                // 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()){
@@ -120,13 +117,26 @@ public class DeleteTaxonBaseHandler extends AbstractHandler implements IHandler,
                 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;
        }
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java
new file mode 100644 (file)
index 0000000..2a83ec9
--- /dev/null
@@ -0,0 +1,122 @@
+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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SetBasionymHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SetBasionymHandlerE4.java
new file mode 100644 (file)
index 0000000..5c0c97d
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java
new file mode 100644 (file)
index 0000000..4d756e1
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+* 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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeSynonymToAcceptedTaxonHandler.java
deleted file mode 100644 (file)
index 211609d..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToConceptRelationHandler.java
deleted file mode 100644 (file)
index f6621a3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToMisapplicationHandler.java
deleted file mode 100644 (file)
index f0d38a6..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/ChangeToSynonymHandler.java
deleted file mode 100644 (file)
index c2ab8c9..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHeterotypicSynonymHandler.java
deleted file mode 100644 (file)
index 162eaa7..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateHomotypicSynonymHandler.java
deleted file mode 100644 (file)
index 2992d1c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateMisapplicationHandler.java
deleted file mode 100644 (file)
index 9208a74..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java
deleted file mode 100644 (file)
index f911793..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/DeleteAllEmptyNamesHandler.java
deleted file mode 100644 (file)
index 2f48796..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
-* 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;
-       }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/MoveSynonymToAnotherAcceptedTaxonHandler.java
deleted file mode 100644 (file)
index e81437b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-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;
-       }
-
-
-
-}
index 3030a0db458c7244332b0b843312b4876496ed0f..7ed086363dddf1617ddabac23e0a8334602d2b35 100644 (file)
@@ -17,9 +17,8 @@ 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.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;
 
 /**
@@ -101,7 +100,7 @@ public class NameEditorMenuPropertyTester extends PropertyTester {
 
        }
 
-       private boolean isAcceptedAndHasNoHomotypicSynonyms(Object selectedElement) {
+       public static boolean isAcceptedAndHasNoHomotypicSynonyms(Object selectedElement) {
                if (isAccepted(selectedElement)){
                        Taxon taxon = (Taxon) selectedElement;
                        return taxon.getSynonymsInGroup(taxon.getHomotypicGroup()).isEmpty();
@@ -109,7 +108,7 @@ public class NameEditorMenuPropertyTester extends PropertyTester {
                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;
@@ -118,11 +117,11 @@ public class NameEditorMenuPropertyTester extends PropertyTester {
        }
 
 
-       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;
                        }
@@ -135,38 +134,38 @@ public class NameEditorMenuPropertyTester extends PropertyTester {
         * @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();
            }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/RemoveBasionymHandler.java
deleted file mode 100644 (file)
index 5820a10..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SetBasionymHandler.java
deleted file mode 100644 (file)
index 4d35fe9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/SwapSynonymAndAcceptedHandler.java
deleted file mode 100644 (file)
index 17e4126..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateNameRelationOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/CreateNameRelationOperation.java
deleted file mode 100644 (file)
index 083b172..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
-* 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);
-       }
-}
index ab7253831c6f03d6a5992bf9ff1bd4eaa36eed79..028dcc587da63d89666a2495cab76ac2157c45ce 100644 (file)
@@ -51,10 +51,10 @@ public class DeleteMisapplicationOperation extends DeleteTaxonBaseOperation {
         * @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;
        }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteNameRelationOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteNameRelationOperation.java
deleted file mode 100644 (file)
index 2a38fc5..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
-* 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;
-       }
-}
index 13e5fc202bfdd4fddaafda2ca5a529bfc4d492c9..1285a4539e791cb25dd2daebd25d16fadd003668 100644 (file)
@@ -14,7 +14,6 @@ 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 org.eclipse.ui.IWorkbenchPage;
 
 import eu.etaxonomy.cdm.api.application.ICdmRepository;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
@@ -50,9 +49,9 @@ public class DeleteSynonymOperation extends DeleteTaxonBaseOperation {
         * @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;
        }
index a800d1abe8152b748e13b5e3e25066fc160a2a52..997a5b45f86a0f3489b112a43383ae0f143e9886 100644 (file)
@@ -5,7 +5,6 @@ import org.eclipse.core.commands.operations.IUndoContext;
 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
@@ -22,7 +21,6 @@ public class DeleteTaxonBaseOperation extends AbstractPersistentPostOperation {
        public DeleteTaxonBaseOperation(String label,\r
                IUndoContext undoContext,\r
                TaxonBaseDeletionConfigurator configurator,\r
-               IWorkbenchPage activePage,\r
                IPostOperationEnabled postOperationEnabled,\r
                IConversationEnabled conversationEnabled,\r
                ICdmEntitySessionEnabled cdmEntitySessionEnabled) {\r
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/DeleteTaxonOperation.java
deleted file mode 100644 (file)
index 434cc57..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-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
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/RemoveHomotypicalGroupBasionymOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/RemoveHomotypicalGroupBasionymOperation.java
deleted file mode 100644 (file)
index 165e05c..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
-* 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);
-       }
-}
index aa6329c3efb39bfbd4a1f7b4dbbef180e5818da2..49cf0b77ad04d2c95b1e86c9ad043d07b8fdef91 100644 (file)
@@ -23,6 +23,9 @@ 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.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;
@@ -30,6 +33,7 @@ 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.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
@@ -76,6 +80,7 @@ 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.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -88,7 +93,7 @@ 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;
@@ -185,7 +190,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
 
     private Label statusLabel;
 
-   // private final ICdmEntitySession cdmEntitySession;
+    private ICdmEntitySession cdmEntitySession;
 
     private ChecklistLabelProvider labelProvider;
 
@@ -226,6 +231,17 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
         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();
@@ -251,7 +267,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
         final Text searchText = createSearchBar(parent);
         createToolbar(parent);
 
-        getSite().setSelectionProvider(viewer);
+       // getSite().setSelectionProvider(viewer);
 
         final ModifyListener modifyListener = new ChecklistModifyListener(viewer, filter, searchText);
 
@@ -456,7 +472,7 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
         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
@@ -464,18 +480,22 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
             // 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);
@@ -670,6 +690,8 @@ public class ChecklistEditor extends EditorPart implements ISelectionListener, I
      */
     @Override
     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+//     System.out.println(selection.getClass().getSimpleName());
+//     viewer.setSelection(selection, true);
     }
 
 
index 2a12b86995d8420e333d0a464aae087f82b01d67..93f59f35b5321deb6add9521aaafe625df56e1b6 100644 (file)
@@ -13,16 +13,15 @@ import java.util.Arrays;
 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;
@@ -34,14 +33,14 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @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;
 
@@ -56,12 +55,13 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
     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
@@ -70,7 +70,8 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
        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);
            }
        }
@@ -85,65 +86,26 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
     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
@@ -222,11 +184,11 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
 
     @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)
@@ -243,7 +205,7 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
     public ConversationHolder getConversation() {
         return conversation;
     }
-    
+
     private List<String> getTaxonNodePropertyPaths() {
         List<String> taxonNodePropertyPaths = new ArrayList<String>();
         for(String propertyPath : getTaxonBasePropertyPaths()) {
@@ -289,7 +251,13 @@ public class ChecklistEditorInput extends CdmEntitySessionInput implements IEdit
 
         return taxonBasePropertyPaths;
     }
-    
+
+
+       public void setTaxa(List<Taxon> taxonList) {
+               this.taxa = taxonList;
+
+       }
+
 //    @Override
 //    public void dispose(){
 //     conversation.unbind();
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistDropdownSelectionListenerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistDropdownSelectionListenerE4.java
new file mode 100755 (executable)
index 0000000..5d601a7
--- /dev/null
@@ -0,0 +1,134 @@
+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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
new file mode 100755 (executable)
index 0000000..e24d291
--- /dev/null
@@ -0,0 +1,864 @@
+/**
+ * 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);
+
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
new file mode 100755 (executable)
index 0000000..a7daf3e
--- /dev/null
@@ -0,0 +1,229 @@
+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;
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorHelper.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditorHelper.java
new file mode 100755 (executable)
index 0000000..218081c
--- /dev/null
@@ -0,0 +1,80 @@
+// $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;
+    }
+
+}
@@ -1,28 +1,32 @@
-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;
 
@@ -36,35 +40,53 @@ public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase<ITaxonTre
        }
 
        @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);
+    }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/CdmComboBoxViewerCellEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/edit/CdmComboBoxViewerCellEditor.java
new file mode 100755 (executable)
index 0000000..d8e4ffa
--- /dev/null
@@ -0,0 +1,32 @@
+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());
+               
+       }
+
+}
index ca645e4b294a26d2467c879f06c815be8dd53538..09a53ce419da7ded910b98aa8587ba6e09a85194 100644 (file)
@@ -35,7 +35,6 @@ public final class DistributionEditingSupport extends EditingSupport {
     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);
@@ -44,7 +43,7 @@ public final class DistributionEditingSupport extends EditingSupport {
         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(){
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/handler/CreateDescriptionElementHandler.java
deleted file mode 100644 (file)
index 780f72c..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * 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);
-       }
-
-}
index a772e2b3e31ebb714c7555b15219fcbf09fe344f..153460eee44d306cba282d99e2954baccb2f2aa1 100644 (file)
@@ -22,10 +22,9 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 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;
@@ -60,18 +59,16 @@ public class CreateDescriptionHandler extends AbstractHandler {
                        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$
                        }
index 45eec0ca38bd1fd439c1bd912a28c0ad359c390c..720601e2e9ff0275c94e111d568ce20000147fc5 100644 (file)
@@ -22,8 +22,8 @@ import org.eclipse.swt.widgets.TableColumn;
 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
@@ -36,7 +36,7 @@ public class OpenDistributionHandler extends AbstractHandler {
     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) {
 
index cc32fdea748dc3a7260d3053b177124dd3a51f4e..1a7834a95ede66d53b392c8c8420ac7345567018 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -18,7 +18,6 @@ import org.eclipse.jface.viewers.Viewer;
 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
@@ -29,7 +28,7 @@ public class ConceptContentProvider implements IStructuredContentProvider {
 
        @Override
        public void dispose() {
-               
+
        }
 
        @Override
@@ -39,15 +38,12 @@ public class ConceptContentProvider implements IStructuredContentProvider {
        @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())) {
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
deleted file mode 100644 (file)
index dddb037..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
-* 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;
-       }
-
-}
index 8c81285146baf787ff1f5e3b088e1d52aa6700d9..fa5b5589c7c34e5db527db00dc17ddfc7cffa2e8 100644 (file)
@@ -21,15 +21,13 @@ import org.eclipse.jface.viewers.ListViewer;
 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;
@@ -77,9 +75,11 @@ implements IPartContentHasDetails, IPartContentHasSupplementalData{
                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();
@@ -87,17 +87,10 @@ implements IPartContentHasDetails, IPartContentHasSupplementalData{
 
        }
 
-    //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);
 
index 62a138a70c1a7033431922f4c1b6a73c44f65bab..52040d7f3eb96aab316b38295f3d4acb34a7718d 100644 (file)
@@ -17,6 +17,7 @@ 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.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;
@@ -27,9 +28,7 @@ import eu.etaxonomy.cdm.api.service.ITermService;
 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;
@@ -50,50 +49,51 @@ public class CreateConceptRelationHandlerE4 {
     @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
@@ -103,7 +103,7 @@ public class CreateConceptRelationHandlerE4 {
         ConceptViewPartE4 conceptView = (ConceptViewPartE4) activePart.getObject();
 
         Object e4WrappedPart = WorkbenchUtility.getE4WrappedPart(conceptView.getSelectionProvidingPart());
-        canExecute = e4WrappedPart instanceof MultiPageTaxonEditor;
+        canExecute = e4WrappedPart instanceof TaxonNameEditorE4;
         menuItem.setVisible(canExecute);
         return canExecute;
     }
index 71da526a7992e992c683f4cc3da848a2cd80d4e7..e87520a48d0f2031a3719d2a0d91ced052f5eb6d 100644 (file)
@@ -17,6 +17,7 @@ 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.model.application.ui.menu.MMenuItem;
@@ -24,9 +25,7 @@ import org.eclipse.e4.ui.services.IServiceConstants;
 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;
@@ -43,31 +42,32 @@ public class DeleteConceptRelationHandlerE4 {
 
     @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
@@ -77,7 +77,7 @@ public class DeleteConceptRelationHandlerE4 {
         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);
index df8f8647b5147f6946cbe0377d6b8269f80e6eec..80f2a5a6087a7711fdad6322abece72e01ad2597 100644 (file)
@@ -13,18 +13,20 @@ import javax.inject.Named;
 
 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;
@@ -40,16 +42,16 @@ public class OpenRelatedConceptHandlerE4  {
 
     @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;
@@ -73,20 +75,12 @@ public class OpenRelatedConceptHandlerE4  {
                            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){
index 324c9b7f214e74b0f35b56b5cb6fa837504f5425..76ef1b04264a2a5e4967bb4e88c267c2368ee1a2 100644 (file)
@@ -1,21 +1,20 @@
 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);
     }
 }
index d444bc6d8e91a3609b46692ea190c5341937d9c4..47c31242c38e510cb25b1056337930993835ded5 100644 (file)
@@ -1,24 +1,21 @@
 /**
- * 
+ *
  */
 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 {
@@ -62,12 +59,12 @@ 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];
@@ -78,30 +75,30 @@ public class ConceptGraphContentProvider implements IGraphContentProvider {
                // 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);
-       
+
                                        }
                                }
                        }
-                       
-                       
+
+
                }
-               
-               
+
+
        }
 
 }
index d40528d94ea909bc8225904bc1687079ad3c5704..e0f91b54ff1d5f0ec8a088e2eff4b3e4f04eb642 100644 (file)
@@ -4,12 +4,9 @@
 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;
@@ -17,12 +14,8 @@ 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.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
@@ -40,34 +33,34 @@ public class ConceptGraphView extends AbstractCdmEditorViewPart {
         */
        @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));
+//                     }
+//             }
 
        }
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/e4/ConceptGraphViewE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/e4/ConceptGraphViewE4.java
new file mode 100644 (file)
index 0000000..6f18e3b
--- /dev/null
@@ -0,0 +1,140 @@
+/**
+ *
+ */
+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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeHandler.java
deleted file mode 100644 (file)
index d9d8d76..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/ChangeConceptRelationshipTypeMenu.java
deleted file mode 100644 (file)
index f1161d1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
-* 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;
-       }
-       
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java
deleted file mode 100644 (file)
index db45226..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/DeleteConceptRelationHandler.java
deleted file mode 100644 (file)
index 179db9f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptHandler.java
deleted file mode 100644 (file)
index 9ece4d9..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
-* 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;
-               }
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/OpenRelatedConceptInBulkEditorHandler.java
deleted file mode 100644 (file)
index 1b3e6c1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-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);
-        }
-    }
-}
index a38272e989ddf02759ae1d873f7714cfd5da6451..3293b3cdb5feb23b79da50564d9f8aa9189c2ddd 100644 (file)
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.editor.view.derivate;
 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;
@@ -21,13 +20,14 @@ import eu.etaxonomy.taxeditor.editor.l10n.Messages;
 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;
 
@@ -49,7 +49,7 @@ public class DerivateDropListener extends ViewerDropAdapter {
             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;
index c9b6dc5136cb636eaa1fb20260540aa2cc2f7852..db527053ec2d308f629ffd0094ce0cab9736cc18 100644 (file)
@@ -17,6 +17,8 @@ import javax.inject.Inject;
 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;
@@ -56,8 +58,8 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 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;
@@ -179,7 +181,8 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
     }
 
     @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();
@@ -205,7 +208,7 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
         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;
@@ -230,7 +233,9 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
         //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() {
@@ -511,8 +516,8 @@ public class DerivateView implements IPartContentHasFactualData, IConversationEn
         }
         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();
index 3a1510c8021b8db662a8c61dc1aa51b2b6ace587..72945a14bc6749c73f2ca93417868d40105b5033 100644 (file)
@@ -12,10 +12,6 @@ import java.util.Collection;
 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;
 
 /**
@@ -25,7 +21,7 @@ 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;
@@ -45,7 +41,7 @@ public class DerivateViewEditorInput implements IEditorInput {
     public DerivateViewEditorInput(UUID derivativeUuid) {
        this(derivativeUuid, null);
     }
-    
+
     public DerivateViewEditorInput(Collection<UUID> derivativeUuids) {
         this(derivativeUuids, null);
     }
@@ -58,36 +54,6 @@ public class DerivateViewEditorInput implements IEditorInput {
         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;
     }
index 8440fada556137e79170d09c74b335202b92ce5d..fcf611eacf03cb9be45c55127ca00c85ba4d2763 100644 (file)
@@ -3,25 +3,21 @@ package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
 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) {
@@ -33,7 +29,7 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle
     }
 
     @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;
@@ -41,13 +37,15 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle
         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;
+    }
 }
index bbab719babd1abe89ea22268b8c0655fc9cc5b8c..194550dc38ba245f47ce65667fe030db6c8c4a4f 100644 (file)
@@ -2,22 +2,18 @@ package eu.etaxonomy.taxeditor.editor.view.derivate.handler;
 
 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;
 
@@ -30,12 +26,19 @@ public class OpenDerivativeEditorForSpecimenOrOBservationBase extends DefaultOpe
     }
 
     @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;
     }
 
 }
index 329ca8d43db1cb0fc772ffe69ffdf0992b69ca3e..eeba98772f8d144275899e2ac4d6a370a334fdea 100644 (file)
@@ -5,25 +5,21 @@ import java.util.Collection;
 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;
 
@@ -33,7 +29,7 @@ public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase<Tax
     }
 
     @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);
@@ -43,10 +39,15 @@ public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase<Tax
             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;
     }
 
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenSpecimenEditorFromMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenSpecimenEditorFromMenu.java
new file mode 100644 (file)
index 0000000..98a23e1
--- /dev/null
@@ -0,0 +1,19 @@
+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);
+    }
+
+}
index 50072f040ff7630ee5356c5759fd50c7b8d6f926..c9367281e7ac1eb7e460e3fa51df80b17b942e96 100644 (file)
@@ -13,7 +13,6 @@ import java.util.ArrayList;
 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;
 
@@ -24,13 +23,14 @@ import eu.etaxonomy.taxeditor.editor.l10n.Messages;
 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;
 
@@ -75,7 +75,7 @@ public class DescriptionElementDropAdapter extends ViewerDropAdapter {
 
                        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);
index 106ac2f1508a2025c31450435e8d9ff837d734eb..ec7e1c6ab8e78dc44ba596188e0c8a0df9537b02 100644 (file)
@@ -45,10 +45,10 @@ 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.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;
@@ -119,9 +119,9 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
        /** {@inheritDoc} */
        @Override
        protected ISelection getInitialSelection() {
-               if(getEditor() != null){
-                       return new StructuredSelection(getEditor().getEditorInput());
-               }
+//             if(getEditor() != null){
+//                     return new StructuredSelection(getEditor().getEditorInput());
+//             }
 
                return super.getInitialSelection();
        }
@@ -176,7 +176,7 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                }
 
         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;
@@ -194,8 +194,8 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
         }
         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;
                }
index 2279cdd54f09060b22fd8ef2b74948d461db61b5..358b0d7eee2336e4ecb6ac6b090df96dbd4e0000 100644 (file)
@@ -16,11 +16,10 @@ import java.util.Map;
 
 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;
@@ -30,7 +29,6 @@ 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.graphics.ImageData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Tree;
 
@@ -41,8 +39,8 @@ import eu.etaxonomy.cdm.model.description.IDescribable;
 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;
@@ -58,12 +56,12 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
 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
@@ -71,7 +69,8 @@ import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
  *
  */
 public class FactualDataPartE4 extends AbstractCdmEditorPartE4
-        implements IPartContentHasDetails, IPartContentHasSupplementalData, ICdmEntitySessionEnabled {
+        implements IPartContentHasDetails, IPartContentHasSupplementalData, ICdmEntitySessionEnabled,
+        ICollapsableExpandable {
 
     /**
      * Maps {@link FeatureNodeContainerTree} to their corresponding {@link TaxonDescritpion}.<br>
@@ -79,18 +78,18 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
      */
     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());
@@ -99,8 +98,10 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         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;
 
@@ -111,21 +112,8 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         //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){
@@ -154,8 +142,8 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
                 }
             }
             Object firstElement = structuredSelection.getFirstElement();
-            if (partObject instanceof MultiPageTaxonEditor){
-                if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
+            if (partObject instanceof TaxonNameEditorE4){
+                if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
                     showEmptyPage();
                     return;
                 }
@@ -181,46 +169,6 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         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) {
@@ -263,6 +211,26 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         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();
index 153e13dc9e16fa0d49426cdf6f3f848a5d951b3c..d6d63299430be24972c1a6b7173edca5087f8f94 100644 (file)
@@ -15,6 +15,7 @@ import javax.inject.Named;
 
 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;
@@ -44,7 +45,8 @@ public class CreateDescriptionElementHandlerE4 {
 
     @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");
@@ -66,9 +68,10 @@ public class CreateDescriptionElementHandlerE4 {
             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);
     }
 
     /**
@@ -80,8 +83,10 @@ public class CreateDescriptionElementHandlerE4 {
         * @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);
+    }
 
 }
index 718d552648bc9d43ebf050cd8b4e6576fa0e3039..b9920165cc9b022e633c632cadf8fd6dc7c15d28 100644 (file)
@@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler;
 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;
@@ -36,7 +37,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 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();
 
@@ -47,11 +49,11 @@ public class CreateDescriptionHandlerE4 {
         }
         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);
 
         }
        }
index 086d388ae0e82b20258241c58c8b8725dcb7e9e7..3661c012f7bb077df6efed168069a4d818ae94b8 100644 (file)
@@ -18,6 +18,7 @@ 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.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;
@@ -60,7 +61,8 @@ public class DeleteHandlerE4 {
        @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();
 
@@ -141,7 +143,7 @@ public class DeleteHandlerE4 {
 
         // execute all cumulated operations
         for(AbstractPostOperation<?> operation : operations){
-               AbstractUtility.executeOperation(operation);
+               AbstractUtility.executeOperation(operation, sync);
         }
        }
 
index 815c4581cd72680ed00581dca02aa956dfe9b437..83e29c7e7470c05d51c89b2d552e333a08e2d270 100644 (file)
@@ -11,7 +11,7 @@ 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.name.e4.TaxonNameEditorE4;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
@@ -160,21 +160,21 @@ public class DescriptionsMenuPropertyTesterE4 extends PropertyTester {
        }
 
        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;
index edc94df8cbf8d439cfa7e4a8bdafa609de94518b..bacb86cb93bd81ef022fa3f7073c95c990f737ec 100644 (file)
@@ -18,15 +18,18 @@ 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.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;
@@ -38,15 +41,12 @@ 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.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;
@@ -62,17 +62,25 @@ import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
  */
 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;
 
@@ -127,13 +135,13 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
             }
             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);
         }
     }
 
@@ -149,18 +157,12 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
             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);
             }
 
         });
@@ -181,7 +183,7 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
         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();
index ff57967e02e203f8fb747c47e3f4935f5b8443b5..a8f1ae0bf5381514719d3dab51148de1288fca1e 100644 (file)
@@ -12,16 +12,19 @@ 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.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;
@@ -30,16 +33,14 @@ 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.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;
 
@@ -54,23 +55,30 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
     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;
                 }
@@ -90,15 +98,14 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
 
         // 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,
@@ -121,8 +128,8 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
                     newAcceptedTaxonNode,
                     this,
                     editor,
-                    (ICdmEntitySessionEnabled)editor.getEditorInput());
-            AbstractUtility.executeOperation(operation);
+                    editor.getEditorInput());
+            AbstractUtility.executeOperation(operation, sync);
         }
 
 
@@ -135,17 +142,18 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
 
             @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());
                 }
@@ -169,7 +177,7 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
         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();
index 28a23aac871269c111572fca5a493cfae10bb941..bfdcfa30adc42c242d3d55fe6e3ab0bf69da0e25 100644 (file)
@@ -25,7 +25,6 @@ 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;
@@ -74,7 +73,6 @@ public class CreateDescriptionElementHandler extends AbstractHandler {
             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$
             }
index 1c0c638fc5941d508a26e36ad9660d42a7bbc2b6..e82adf72c5f21b1aecc6a1b9be4fa5847f7ba998 100644 (file)
@@ -22,7 +22,6 @@ import eu.etaxonomy.taxeditor.editor.EditorUtil;
 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;
@@ -44,13 +43,14 @@ public class CreateDescriptionHandler extends AbstractHandler {
     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$
                        }
@@ -58,7 +58,6 @@ public class CreateDescriptionHandler extends AbstractHandler {
                    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$
                             }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DeleteHandler.java
deleted file mode 100644 (file)
index e66cecf..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java
deleted file mode 100644 (file)
index 0d1da78..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- *
- */
-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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java
deleted file mode 100644 (file)
index f9e466e..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java
deleted file mode 100644 (file)
index d601247..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
-* 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;
-       }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java
deleted file mode 100644 (file)
index f67ef51..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- *
- */
-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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/ToggleShowOnlyIndividualAssociationsHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/ToggleShowOnlyIndividualAssociationsHandler.java
deleted file mode 100644 (file)
index cdaec22..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
-* 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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaLabelProvider.java
deleted file mode 100644 (file)
index 90ba5d3..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-
-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();
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewLabelProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewLabelProvider.java
new file mode 100755 (executable)
index 0000000..0189541
--- /dev/null
@@ -0,0 +1,134 @@
+// $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
+
+    }
+
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
deleted file mode 100644 (file)
index bed33a7..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
-* 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;
-       }
-}
index 653a02ae307ce6c8fc7713194b924eb15d8d9944..f48b568dc70135b6ea86b3678ed7c0c70667d7a1 100644 (file)
@@ -23,12 +23,12 @@ import org.eclipse.swt.widgets.Composite;
 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;
@@ -47,13 +47,19 @@ public class MediaViewPartE4 extends AbstractCdmEditorPartE4
         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;
 
@@ -89,8 +95,8 @@ public class MediaViewPartE4 extends AbstractCdmEditorPartE4
                }
 
                Object firstElement = structuredSelection.getFirstElement();
-               if (partObject instanceof MultiPageTaxonEditor){
-                   if (firstElement != ((MultiPageTaxonEditor)partObject).getTaxon()){
+               if (partObject instanceof TaxonNameEditorE4){
+                   if (firstElement != ((TaxonNameEditorE4)partObject).getTaxon()){
                        showEmptyPage();
                        return;
                    }
@@ -126,4 +132,6 @@ public class MediaViewPartE4 extends AbstractCdmEditorPartE4
                return Messages.MediaViewPart_MEDIA;
        }
 
+
+
 }
index 8d8f20d81c3140153aa4e2078f33748874be4645..26ac3a8fdaaae0fbbd3ac18109b3b1710da76c6d 100644 (file)
@@ -5,6 +5,7 @@ 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.MMenuItem;
 import org.eclipse.e4.ui.services.IServiceConstants;
@@ -22,7 +23,8 @@ public class AddExistingMediaHandler  {
 
     @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();
 
@@ -34,7 +36,7 @@ public class AddExistingMediaHandler  {
                 // TODO use undo context specific to editor
                 operation = new AddExistingMediaToImageGalleryOperation(media, menuItem.getLocalizedLabel(),
                         EditorUtil.getUndoContext(), description, mediaView);
-                AbstractUtility.executeOperation(operation);
+                AbstractUtility.executeOperation(operation, sync);
             }
         }
     }
index 796a7128d937a10a46769c85fa09a1ef24298cee..d7f07cc47d2c3907eff33afde082c78e4b436160 100644 (file)
@@ -6,6 +6,7 @@ package eu.etaxonomy.taxeditor.editor.view.media.handler;
 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;
@@ -32,7 +33,8 @@ public class AddImageGalleryHandler {
 
     /** {@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();
 
@@ -44,7 +46,7 @@ public class AddImageGalleryHandler {
                 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);
@@ -52,7 +54,7 @@ public class AddImageGalleryHandler {
                 AbstractPostOperation<?> operation = new AddDerivedUnitFacadeMediaOperation(menuItem.getLocalizedLabel(),
                         BulkEditorUtil.getUndoContext(), specimen, mediaView);
 
-                AbstractUtility.executeOperation(operation);
+                AbstractUtility.executeOperation(operation, sync);
             }
         }
     }
index 7a5f46e8ba9a36eaa67513a521f2d6597da67f19..6e1d3b88612e050431ea3ca6f15af3be3f051feb 100644 (file)
@@ -7,6 +7,7 @@ import javax.inject.Named;
 
 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;
@@ -28,7 +29,8 @@ public class CreateMediaHandler {
 
     @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();
 
@@ -37,7 +39,7 @@ public class CreateMediaHandler {
                        // TODO use undo context specific to editor
             operation = new AddMediaToImageGalleryOperation(menuItem.getLocalizedLabel(),
                     EditorUtil.getUndoContext(), description, mediaView);
-            AbstractUtility.executeOperation(operation);
+            AbstractUtility.executeOperation(operation, sync);
                }
        }
 
index 2f1c3d004cbe7645ebee69812b172be34e1610d6..bc2f881770595e446ae7ea66e9ac0cc4396c47c4 100644 (file)
@@ -6,8 +6,11 @@ package eu.etaxonomy.taxeditor.editor.view.media.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.model.application.ui.menu.MMenuItem;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.dialogs.MessageDialog;
@@ -15,9 +18,6 @@ import org.eclipse.jface.viewers.ISelection;
 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;
@@ -25,17 +25,15 @@ 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.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;
 
 /**
  *
@@ -47,97 +45,72 @@ public class DeleteMediaHandler  {
 
     @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
index 9cb928fb43ba5d02b45e12b0a4e0a4fd41a5fe69..f401ebf6859472b0f2fa4a68242c9a9a9d5f5b57 100644 (file)
@@ -10,21 +10,20 @@ package eu.etaxonomy.taxeditor.editor.view.media.handler;
 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;
@@ -42,37 +41,36 @@ public class MoveImageDownInListHandler  {
     @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);
             }
         }
-       }
+    }
 
 }
index f020333cbe1174bd290b97abeedc03ad2af2fbbf..a46b6e097451e73a95c45004b9c0cb6fd36e9e0c 100644 (file)
@@ -10,21 +10,20 @@ package eu.etaxonomy.taxeditor.editor.view.media.handler;
 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;
@@ -42,35 +41,34 @@ public class MoveImageUpInListHandler  {
     @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);
             }
         }
     }
index 842097aaf440ed3f991cac169f81501c4acb0be7..03697f7d6a0d58519ca40cc6650fbd659fe587f5 100644 (file)
@@ -26,7 +26,6 @@ import eu.etaxonomy.cdm.model.description.DescriptionBase;
 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;
@@ -74,10 +73,10 @@ public class DeleteMediaOperation extends AbstractPostTaxonOperation {
           // 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();
@@ -96,7 +95,7 @@ public class DeleteMediaOperation extends AbstractPostTaxonOperation {
                } else{
                        ImagesUtility.removeMediaFromGallery(description, media);
                }
-               
+
                monitor.worked(40);
 
                return postExecute(null);
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/UsesViewPartE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/UsesViewPartE4.java
new file mode 100644 (file)
index 0000000..5d3f359
--- /dev/null
@@ -0,0 +1,89 @@
+/**
+ * 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);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseHandlerE4.java
new file mode 100644 (file)
index 0000000..b843130
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+* 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);
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseRecordHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseRecordHandlerE4.java
new file mode 100644 (file)
index 0000000..acaf565
--- /dev/null
@@ -0,0 +1,54 @@
+/**
+ * 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseSummaryHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/e4/handler/CreateUseSummaryHandlerE4.java
new file mode 100644 (file)
index 0000000..f082a16
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+* 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;
+       }
+
+}
index 270eec97c747dd0110c6b5abca4d5dea3f3bdb7f..97056743b8c5d93d51f7ff226e20dfca73538cc7 100644 (file)
@@ -49,11 +49,12 @@ public class CreateUseRecordOperation extends AbstractPostOperation {
         * @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;
        }
 
 
index c6a08882e608656d66bd93edd409336913afa193..c2c5dc2b37ac5b9f66f64ee7e7cdd69f6c62e0c2 100644 (file)
@@ -20,6 +20,7 @@ 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;
@@ -62,6 +63,7 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
 import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
 
 /**
@@ -71,7 +73,7 @@ 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;
@@ -226,8 +228,9 @@ public class CharacterEditor
         });
     }
 
+    @Override
     @Persist
-    public void save(){
+    public void save(IProgressMonitor monitor){
         if (!conversation.isBound()) {
             conversation.bind();
         }
index 4f57c79b53899fa30439b3227479a2f266a0e1c7..cac8a1c13e1ca1ae0a78bb0615cf13f07de65e53 100644 (file)
@@ -43,7 +43,7 @@ public class DeleteMisapplicationOperationTest extends AbstractTaxeditorOperatio
 
                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);
 
        }
 
index a1e4fb8d459ec3652877318730c22f68251d4963..a34cb943841c64830c73f6556fdc1ae04a23c1ae 100644 (file)
@@ -45,7 +45,7 @@ public class DeleteSynonymOperationTest extends AbstractTaxeditorOperationTestBa
 
                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);
 
        }
 
index a97b62292b4540afada97df1217f970ef436aefc..c95e2b92fb04098b10f3e98b4f9c4d6a5b0551f9 100644 (file)
@@ -2,7 +2,7 @@
 <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">
index 697c94411770acb41eb917a2063ae2e858f9027f..518a227555a0d6e038740eef3bfa193bef4c37ca 100644 (file)
@@ -3,7 +3,7 @@
        <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>
index 24eee4e75a64596e34bd14cee4d06c723e86de28..4214205c8a1e873cdefd8da5f7e749d57091cd03 100644 (file)
@@ -2,7 +2,7 @@
 <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"
index 6d9874acb28e140dee8a00856593460959ebc771..62361cf9dc7f2e79b39965d6d62f001e45aa27aa 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index 474cf55aee8265d3b381926533eb611e19a0b03f..81deae0565d57fe89b4d2a91f33cc81d342ca24a 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Help
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.help; singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-Activator: eu.etaxonomy.taxeditor.help.Activator
 Bundle-Vendor: EDIT
 Require-Bundle: org.eclipse.ui,
index bbd412f59808575ed1960012b0bbaec34522d88c..bd0b1fe84a92bdf7d3c816c309aa5e479d8bca87 100644 (file)
@@ -3,7 +3,7 @@
        <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>
index 1280ab958243e552db40fb00cc033080f13da910..aeb79df825a3e78b6752bb03f74b29c0eaca6199 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-ClassPath: .,
  lib/owlapi-xmlutils-4.1.4.jar,
  lib/commons-collections4-4.1.jar,
index 90a601741985ffd39e2c6bbd513ec6f9edcbc5c5..30d52c4cb0ba0f683563543ecf3289a9f3115588 100644 (file)
@@ -7,7 +7,7 @@
   <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>
index 5056291fc84e354d189c1009dedbcca48d3abfc7..329c87cdc5390365eb347859e5a9c75c9b6c1116 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Molecular Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
@@ -19,7 +19,9 @@ Require-Bundle: org.eclipse.ui,
  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
index 40518278c1e2377bcb726bf9c9f81cecfea8782e..24836fdfb8da718b43a58e59e0a71b339f022e08 100644 (file)
@@ -6,7 +6,7 @@ command.name.SHOW_PHEROGRAM = Show Pherogram
 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
index 00286584be4120bb99eb6d9b1c9f15f74b829704..ddb671b5b281649d6e4c72b1e30edb2f38a5f7e9 100644 (file)
@@ -1,18 +1,69 @@
 <?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>
index 521206e463789172778899993e95c8071fbe48f2..ff56c7c4ba7664d62d4a15f022d7ed2efa1dcfca 100644 (file)
@@ -1,72 +1,6 @@
 <?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>
index 564a77ada853599867794e2c3aea5dec4d75da73..983caf70c69fd6e2e319eedd0b5c0807480389b5 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index 20c1ae1b2d2057e8d82e07cbf1991b71ae33ef7a..f1a71713d59899a5ab15421211b006e6fa285ca6 100644 (file)
@@ -72,6 +72,7 @@ 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;
@@ -584,11 +585,21 @@ public class AlignmentEditor extends EditorPart {
                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();
                }
     }
@@ -596,7 +607,7 @@ public class AlignmentEditor extends EditorPart {
 
     /**
      * 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() {
index 94095996f632606ceb5bda32e746897cafc44c57..b9835667e34be1ee62c55747810c6a942941fb70 100644 (file)
@@ -13,14 +13,9 @@ import java.util.Arrays;
 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;
 
 
@@ -30,9 +25,7 @@ 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;
@@ -44,63 +37,6 @@ public class AlignmentEditorInput extends CdmEntitySessionInput implements IEdit
        }
 
 
-       /* (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.
@@ -164,6 +100,6 @@ public class AlignmentEditorInput extends CdmEntitySessionInput implements IEdit
     @Override
     public void merge() {
         CdmStore.getService(ISequenceService.class).merge(sequenceNode, true);
-        
+
     }
 }
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
new file mode 100644 (file)
index 0000000..35d3835
--- /dev/null
@@ -0,0 +1,770 @@
+/**
+* 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;
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java
new file mode 100644 (file)
index 0000000..eb7a88e
--- /dev/null
@@ -0,0 +1,61 @@
+/**
+* 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();
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCopyHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCopyHandlerE4.java
new file mode 100644 (file)
index 0000000..0ccb1c2
--- /dev/null
@@ -0,0 +1,59 @@
+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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCutHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorCutHandlerE4.java
new file mode 100644 (file)
index 0000000..fcb138c
--- /dev/null
@@ -0,0 +1,54 @@
+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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorPasteHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorPasteHandlerE4.java
new file mode 100644 (file)
index 0000000..da49e7f
--- /dev/null
@@ -0,0 +1,124 @@
+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);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ChangePherogramQualityOutputTypeE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ChangePherogramQualityOutputTypeE4.java
new file mode 100644 (file)
index 0000000..2865cc3
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+* 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CreateConsensusSequenceHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CreateConsensusSequenceHandlerE4.java
new file mode 100644 (file)
index 0000000..a442425
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+* 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramLeftHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramLeftHandlerE4.java
new file mode 100644 (file)
index 0000000..d99d410
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+* 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);
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramRightHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CutPherogramRightHandlerE4.java
new file mode 100644 (file)
index 0000000..a39ec94
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+* 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);
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/EditSequenceHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/EditSequenceHandlerE4.java
new file mode 100644 (file)
index 0000000..cfd2591
--- /dev/null
@@ -0,0 +1,61 @@
+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&ouml;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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ExportSequenceToFileHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ExportSequenceToFileHandlerE4.java
new file mode 100644 (file)
index 0000000..cf007ef
--- /dev/null
@@ -0,0 +1,116 @@
+// $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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/LoadPherogramHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/LoadPherogramHandlerE4.java
new file mode 100644 (file)
index 0000000..455dd5b
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+* 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
+               }
+            }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ReverseComplementHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ReverseComplementHandlerE4.java
new file mode 100644 (file)
index 0000000..b168fa6
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+* 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ShowPherogramHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ShowPherogramHandlerE4.java
new file mode 100644 (file)
index 0000000..c74d91d
--- /dev/null
@@ -0,0 +1,78 @@
+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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleInsertOverwriteHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleInsertOverwriteHandlerE4.java
new file mode 100644 (file)
index 0000000..f24895d
--- /dev/null
@@ -0,0 +1,67 @@
+/**
+* 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);
+//             }
+//     }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleLeftRightInsertionHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleLeftRightInsertionHandlerE4.java
new file mode 100644 (file)
index 0000000..ed4422e
--- /dev/null
@@ -0,0 +1,72 @@
+/**
+ * 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);
+//            }
+//        }
+//    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramBaseCallLinesHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramBaseCallLinesHandlerE4.java
new file mode 100644 (file)
index 0000000..973be40
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramProbabilitiesHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramProbabilitiesHandlerE4.java
new file mode 100644 (file)
index 0000000..81642a5
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+* 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/UpdateConsensusSequenceHandlerE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/UpdateConsensusSequenceHandlerE4.java
new file mode 100644 (file)
index 0000000..fb928cc
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+* 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();
+    }
+}
index 8dedfb8c9664528da30da9b4cc7e20d36e2c9b14..2745ddeaf3cc8e5258a1eb750648efadde87f414 100644 (file)
@@ -28,7 +28,7 @@ import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
  */
 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;
         }
index 8589c7f2833882d46457cf657bcac3270f3fe327..201843de7fea3324db8128620c47725f3baeecdb 100644 (file)
@@ -34,7 +34,7 @@ import info.bioinfweb.libralign.pherogram.PherogramComponent;
 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;
index 84b2ce6636c612833895bb1c8d1140b1bc88158d..c76354ad4a638ac230c14eff154d0546b07c27c0 100644 (file)
@@ -9,13 +9,8 @@ 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.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;
 
 
 
@@ -32,14 +27,14 @@ public class EditSequenceHandler {
     @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);
+//            }
         }
     }
 
index 2168d57ed5dac6c851f58a1fb9ed14a5e92f5687..b11cf21dcfd061e722b94dc966d9c7ad4437ed5b 100644 (file)
@@ -37,7 +37,7 @@ public class LoadPherogramHandler extends AbstractHandler {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        Object activeEditor = AbstractUtility.getActiveE4Editor();
+        Object activeEditor = AbstractUtility.getActiveEditor();
         if (activeEditor instanceof AlignmentEditor) {
             AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
 
index 2867fd49a5a747175f59cc6684941cc47fa73a4d..1710c3bafbf7433becb2961e7895ba4b49ed00c0 100644 (file)
@@ -49,7 +49,7 @@ public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler
 
        @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);
index 5ea69c778d6a3d2b3cacf6e547eb73fbc64c6d71..27bb9597ab7abb605543f64d593cdd03b3d4252a 100644 (file)
@@ -52,7 +52,7 @@ public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHand
 
     @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()) {
index be5220d141cab070023d117b0cc9a971aab43947..eea17cb5847fcbcdb533f1c67f8b0029fbfd74a3 100644 (file)
@@ -8,7 +8,7 @@
  */
 /**
  * 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
index cbe714175ad64eaffc1b97afd87fc597d981a73f..75a22d378987c794aedab96b5c05a9230b46864f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Navigation Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.navigation;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-Activator: eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin
 Bundle-Vendor: EDIT
 Export-Package: eu.etaxonomy.cdm,
@@ -20,7 +20,16 @@ Require-Bundle: org.eclipse.ui,
  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,
index f305d3233a34d592585443a9ac48d49ad9254227..db0a64e305c4448906f81318fac1bb08b6e5d8a5 100644 (file)
@@ -20,6 +20,8 @@ command.label.13 = Taxon
 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
@@ -46,3 +48,20 @@ command.label.moveFactualData = Move factual data to another taxon
 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
index 4f1b16ca978fd2a8dc0fa4663f12e7bd45ce6c1f..7bcf643523443a1b55cc87873553a27791fcd117 100644 (file)
@@ -21,6 +21,7 @@ command.label.14 = Klassifikation
 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
@@ -45,5 +46,15 @@ navigatorContent.name.0 = Taxonknoten
 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
index f31de2d05301df44031a34fe1eeea604a8450f82..549f70cc4e0024b7c75c901e95ede9f8b5343afa 100644 (file)
@@ -1,6 +1,160 @@
 <?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>
index 7d33aed75713950766e926b18b3bb0f2a5054cb1..83845a7d1d80122dfed1c761bd65a59544b806eb 100644 (file)
          </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"
index f4fbd8c67bbf3e204183ebf06ed09e30349aca92..e640393129388c5c0cdd5b5752c98d9cdb8dd202 100644 (file)
@@ -3,7 +3,7 @@
        <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>
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/AppModelId.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/AppModelId.java
new file mode 100644 (file)
index 0000000..a70a437
--- /dev/null
@@ -0,0 +1,116 @@
+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
index d6f3919b9e0515fc0878fd4441873afe57791477..b7055a20b3d591d697d2386711adf04bf396ab69 100644 (file)
@@ -9,36 +9,25 @@
 
 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;
@@ -47,19 +36,17 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 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
@@ -68,7 +55,6 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 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;
 
        /**
@@ -76,7 +62,7 @@ public class NavigationUtil extends AbstractUtility{
         *
         * @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)){
@@ -95,14 +81,14 @@ public class NavigationUtil extends AbstractUtility{
                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){
@@ -112,29 +98,19 @@ public class NavigationUtil extends AbstractUtility{
                                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,
@@ -145,72 +121,13 @@ public class NavigationUtil extends AbstractUtility{
                }
        }
 
-       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);
        }
 
        /**
@@ -237,53 +154,20 @@ public class NavigationUtil extends AbstractUtility{
         * @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>
         *
@@ -311,15 +195,16 @@ public class NavigationUtil extends AbstractUtility{
        }
 
        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);
+//             }
        }
 
        /**
@@ -327,44 +212,17 @@ public class NavigationUtil extends AbstractUtility{
         */
        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);
+//             }
        }
 
        /**
index 0ec7431c9cf026e110b40767cdd0df19a89526de..5b3f21ae550bcb7c8308a484d41c14b39aa17298 100644 (file)
@@ -5,19 +5,14 @@ import org.eclipse.core.runtime.IProgressMonitor;
 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}
         *
@@ -25,29 +20,26 @@ public class NavigatorStateManager extends ContextListenerAdapter {
         */
        @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}
         *
@@ -55,38 +47,36 @@ public class NavigatorStateManager extends ContextListenerAdapter {
         */
        @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();
+//             }
        }
 
 }
index 0d0ac8ad3416fb5ecefa3a24692b9324f29e9ac8..3f541c6ad2de945083b899a604ec8f6587675332 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -14,14 +14,6 @@ import org.eclipse.jface.action.ContributionItem;
 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()
@@ -32,6 +24,7 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
  * @version 1.0
  */
 public class RecentNamesContributionItem extends ContributionItem {
+    //FIXME E4 migrate recent menu items
        private static final Logger logger = Logger
                        .getLogger(RecentNamesContributionItem.class);
 
@@ -43,19 +36,19 @@ public class RecentNamesContributionItem extends ContributionItem {
 ////           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()
         */
index d99ef7cf8c8076e8ab055653460c44fd43650418..380c9773c55fd6b7c68dd62ec86617a6f922ef23 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -28,15 +28,16 @@ public class WorkbenchUndoContextAdapterFactory implements IAdapterFactory {
        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;
        }
 
@@ -58,7 +59,8 @@ public class WorkbenchUndoContextAdapterFactory implements IAdapterFactory {
         *
         * @return an array of {@link java.lang.Class} objects.
         */
-       public Class[] getAdapterList() {
+       @Override
+    public Class[] getAdapterList() {
                return ADAPTER_LIST;
        }
 }
index c0a0ff645fe5d1dcb661d11e43d3348e50b95feb..b2f959e0b529c8fca8cdd74e16e5a16c6d9c0a34 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.swt.layout.GridData;
 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;
@@ -120,14 +119,14 @@ public class PolytomousKeyViewPart extends ViewPart implements
        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)
@@ -171,11 +170,11 @@ public class PolytomousKeyViewPart extends ViewPart implements
        }
 
        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) {
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartDataChangeBehaviorE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartDataChangeBehaviorE4.java
new file mode 100644 (file)
index 0000000..53fe14d
--- /dev/null
@@ -0,0 +1,107 @@
+/**
+* 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;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/PolytomousKeyViewPartE4.java
new file mode 100644 (file)
index 0000000..7daade5
--- /dev/null
@@ -0,0 +1,312 @@
+/**
+ *
+ */
+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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/NewPolytomousKeyHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/NewPolytomousKeyHandlerE4.java
new file mode 100644 (file)
index 0000000..299c7df
--- /dev/null
@@ -0,0 +1,48 @@
+/**
+* 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();
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyListHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyListHandlerE4.java
new file mode 100644 (file)
index 0000000..2b81535
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+* 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();
+    }
+}
+
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyNodesHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RefreshPolytomousKeyNodesHandlerE4.java
new file mode 100644 (file)
index 0000000..fbd6118
--- /dev/null
@@ -0,0 +1,93 @@
+/**
+* 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();
+
+                               }
+                       }
+               }
+
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingDeletePolytomousKeyHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingDeletePolytomousKeyHandlerE4.java
new file mode 100644 (file)
index 0000000..0434e0c
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java
new file mode 100644 (file)
index 0000000..a48e170
--- /dev/null
@@ -0,0 +1,130 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingUpdatePolytomousKeyAllNodesHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingUpdatePolytomousKeyAllNodesHandlerE4.java
new file mode 100644 (file)
index 0000000..77f2351
--- /dev/null
@@ -0,0 +1,58 @@
+/**
+* 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;
+    }
+
+}
index ad614b249221e8ead42d0cad6090c6469f001b76..137f2da476b394a2e2614c55c6cc4ddf1971f0bc 100644 (file)
@@ -14,17 +14,12 @@ 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.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
@@ -33,9 +28,6 @@ import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
  */
 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)
         */
@@ -49,24 +41,24 @@ public class DeleteHandler extends AbstractHandler {
                        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;
index b539552d1e9fb8b1d4ee06b70736f44944f9c3a0..ab137d1cb49ff5b047afea0c09adbd002306e293 100644 (file)
@@ -12,18 +12,6 @@ package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler;
 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
@@ -32,50 +20,48 @@ import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
  */
 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;
        }
 
index 2d2cef6fcaf2f7bfad250afdbcf87abffb4fd7d4..face05ae32084d76350f81036d74ad368d3c6fc1 100644 (file)
@@ -1,8 +1,8 @@
 /**\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
@@ -13,14 +13,6 @@ import org.eclipse.core.commands.AbstractHandler;
 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
@@ -35,18 +27,19 @@ public class NewPolytomousKeyHandler extends AbstractHandler implements IHandler
      * @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
index 8ab56e1bd8e18628c007ea2d8f82d1eadcc48b3f..6a801c6b4a22fb04b5875a6fca9a46df59c13db7 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -14,9 +14,6 @@ import org.eclipse.core.commands.ExecutionEvent;
 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>
@@ -31,9 +28,10 @@ public class RefreshPolytomousKeyListHandler extends AbstractHandler implements
      * @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;
     }
 }
index cb1a2d05c8163f166c2fb3e78da9dbe4a36b8516..080f48dd4490426c53c6626030a139965ba6e907 100644 (file)
@@ -9,25 +9,12 @@
 
 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;
 
 
 /**
@@ -43,45 +30,45 @@ public class RefreshPolytomousKeyNodesHandler extends AbstractHandler implements
 
     @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;
                        }
                }
index 9adb3879f967cc81bb808e2afdc2a2e05c9b26af..5960a0ce4e4b523968cea3907642d47fed373053 100644 (file)
@@ -25,6 +25,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 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;
@@ -57,7 +58,7 @@ public class RemotingDeletePolytomousKeyHandler extends RemotingCdmHandler {
            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;
index 2e5d3487b0aa9bfb473f026203fa75e62e7ec6bf..6c0886c36e507d0ecda94bf6e159ac2b2d1adf73 100644 (file)
@@ -11,20 +11,6 @@ package eu.etaxonomy.taxeditor.navigation.key.polytomous.handler;
 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
@@ -38,51 +24,51 @@ public class RemotingEditPolytomousKeyNodesHandler extends AbstractHandler {
      */
     @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;
     }
 
index 57356a8fefd765a276c8c73ae3f93a8e1a559054..784d06f917611d310f06a39d6cee140d429d7de6 100644 (file)
@@ -72,7 +72,6 @@ public class Messages extends NLS {
     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;
@@ -176,6 +175,8 @@ public class Messages extends NLS {
     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 {
index b12a69a936d6cdbbaf8546e5feb75b7782ae6f85..9bf8986e84ddc7de5cca86883312247dcfc0ecdd 100644 (file)
@@ -53,7 +53,6 @@ NavigationUtil_MULTI_TREE=The accepted taxon is in multiple taxonomic trees. We
 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
@@ -152,3 +151,5 @@ TreeNodeDropAdapter_MOVING_MESSAGE=The operation move accepted taxon to other pa
 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
index 1ad57fe98395a7df821d03d90a2a87ee81fb5c96..9bfdefa46ac08135aa3c5dac12026ef4fe838da7 100644 (file)
@@ -53,7 +53,6 @@ NavigationUtil_MULTI_TREE=Das akzeptierte Taxon ist in mehreren taxonomischen B
 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
@@ -93,7 +92,7 @@ RemotingMoveTaxonOperation_MOVE_OP=Taxon verschieben
 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
@@ -153,3 +152,6 @@ TreeNodeDropAdapter_TARGET_NODE=Zielknoten
 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
+
index a7fa38f4336ca92597db611eff1e39d5862faef9..3db2bdda405bbf6e7f91cae6db7fc5f9e1e259e0 100644 (file)
@@ -25,10 +25,6 @@ import eu.etaxonomy.cdm.api.service.IClassificationService;
 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;
 
 /**
@@ -63,13 +59,14 @@ public class Root extends PlatformObject implements IAdaptable, IPersistableElem
 
                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());
index a1b71ab146c0731845ebabd577c48f8056842fb2..f71f2796f856c1de52e4f49b15d4dbe3ca92289c 100644 (file)
@@ -24,8 +24,6 @@ import java.util.UUID;
 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;
@@ -34,13 +32,11 @@ import org.eclipse.ui.navigator.CommonNavigator;
 
 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;
@@ -137,7 +133,7 @@ public class TaxonNavigator extends CommonNavigator implements
                        // closing the whole application
                        // should be handled by the state manager too
                    root = new Root(conversation);
-                   
+
                        return root;
                }
                return new EmptyRoot();
@@ -166,8 +162,8 @@ public class TaxonNavigator extends CommonNavigator implements
                    CdmApplicationState.getCurrentDataChangeService().register(this);
                }
                CdmStore.getLoginManager().addObserver(this);
-               
-               
+
+
        }
 
        /**
@@ -465,13 +461,13 @@ public class TaxonNavigator extends CommonNavigator implements
        /** {@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
index bed0d11f388b22e4bf5ce111977eaf38e0814d35..19ee3feefb5d0fa2abfa412df1c9c1eecb0a5fb4 100644 (file)
@@ -17,7 +17,6 @@ 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.IEditorPart;
 
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.CdmBase;
@@ -29,7 +28,6 @@ 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.NavigationUtil;
 import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
 
 /**
@@ -90,25 +88,6 @@ public class TaxonNavigatorDataChangeBehavior extends AbstractDataChangeBehaviou
                                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;
                        }
index 9487c7874d626d24381bd980bf3ba30fc248de69..83b595e61bbe5ef2f1b613bcd220094f919afe3c 100644 (file)
@@ -26,7 +26,9 @@ public class TaxonNodeNavigatorComparator extends ViewerComparator{
                        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);
                        }
index 9620a9e4b76d8a9a4bbeca69872f737ed7fff834..5f34d5bb9a665b2533e1a0acfb8fa080ef3bd885 100644 (file)
@@ -13,10 +13,8 @@ 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;
@@ -32,12 +30,8 @@ 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.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;
 
 /**
@@ -189,93 +183,93 @@ public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOpera
         */
        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} */
index 22a37216ec9d585b9e10316f8a4c709f22cdf5ee..50e2aad7debf6011f3a867eb7449ae36db4a6748 100644 (file)
@@ -13,14 +13,10 @@ 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.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;
@@ -35,11 +31,7 @@ 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.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;
 
 /**
@@ -166,92 +158,92 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
         */
        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} */
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorContentProviderE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorContentProviderE4.java
new file mode 100644 (file)
index 0000000..22a1a87
--- /dev/null
@@ -0,0 +1,100 @@
+// $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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorDataChangeBehaviorE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorDataChangeBehaviorE4.java
new file mode 100644 (file)
index 0000000..1fc6993
--- /dev/null
@@ -0,0 +1,196 @@
+/**
+* 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();
+
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorE4.java
new file mode 100644 (file)
index 0000000..3849745
--- /dev/null
@@ -0,0 +1,542 @@
+/**
+ * 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) {
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorLabelProviderE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TaxonNavigatorLabelProviderE4.java
new file mode 100644 (file)
index 0000000..2c7102d
--- /dev/null
@@ -0,0 +1,146 @@
+// $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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDragListenerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDragListenerE4.java
new file mode 100644 (file)
index 0000000..da1014b
--- /dev/null
@@ -0,0 +1,44 @@
+/**
+ * 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);
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDropAdapterE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDropAdapterE4.java
new file mode 100644 (file)
index 0000000..4cb035a
--- /dev/null
@@ -0,0 +1,272 @@
+/**
+* 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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/ChangeAcceptedTaxonToSynonymHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/ChangeAcceptedTaxonToSynonymHandlerE4.java
new file mode 100644 (file)
index 0000000..8a98589
--- /dev/null
@@ -0,0 +1,160 @@
+/**
+ *
+ */
+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;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CloneClassificationHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CloneClassificationHandlerE4.java
new file mode 100644 (file)
index 0000000..c325128
--- /dev/null
@@ -0,0 +1,79 @@
+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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CopyHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CopyHandlerE4.java
new file mode 100644 (file)
index 0000000..c62849d
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CreateClassificationHierarchyHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/CreateClassificationHierarchyHandlerE4.java
new file mode 100644 (file)
index 0000000..facc35d
--- /dev/null
@@ -0,0 +1,63 @@
+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;
+    }
+
+}
@@ -7,48 +7,46 @@
 * 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;
@@ -59,23 +57,13 @@ public class DeleteHandler extends AbstractHandler{
     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>();
@@ -104,20 +92,20 @@ public class DeleteHandler extends AbstractHandler{
                                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,
@@ -135,12 +123,12 @@ public class DeleteHandler extends AbstractHandler{
                                                        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);
                                        }
@@ -151,7 +139,7 @@ public class DeleteHandler extends AbstractHandler{
                                                return null;
                                        }*/
 
-                                               operation = new DeleteOperation(event.getCommand().getName(),
+                                               operation = new DeleteOperation(menuItem.getLocalizedLabel(),
                                                        NavigationUtil.getUndoContext(),
                                                                taxonNode,
                                                                config,
@@ -159,26 +147,24 @@ public class DeleteHandler extends AbstractHandler{
                                                                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(),
@@ -186,39 +172,46 @@ public class DeleteHandler extends AbstractHandler{
                                                        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;
        }
 }
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/LinkWithTaxonHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/LinkWithTaxonHandlerE4.java
new file mode 100644 (file)
index 0000000..45addcf
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+* 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveFactualDataHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/MoveFactualDataHandlerE4.java
new file mode 100644 (file)
index 0000000..a95e721
--- /dev/null
@@ -0,0 +1,113 @@
+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;
+    }
+
+}
@@ -7,7 +7,7 @@
 * 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;
@@ -16,22 +16,28 @@ import java.util.List;
 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;
@@ -39,24 +45,22 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 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>();
@@ -65,8 +69,6 @@ public class MoveTaxonHandler extends AbstractHandler implements IPostOperationE
                // 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){
@@ -76,14 +78,8 @@ public class MoveTaxonHandler extends AbstractHandler implements IPostOperationE
                                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;
@@ -91,39 +87,39 @@ public class MoveTaxonHandler extends AbstractHandler implements IPostOperationE
                                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;
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewClassificationHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewClassificationHandlerE4.java
new file mode 100644 (file)
index 0000000..56aa247
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+* 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/NewTaxonNodeHandlerE4.java
new file mode 100644 (file)
index 0000000..4f6333b
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+ * 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();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RefreshTreeHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RefreshTreeHandlerE4.java
new file mode 100644 (file)
index 0000000..877aa7a
--- /dev/null
@@ -0,0 +1,47 @@
+/**
+* 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;
+    }
+}
@@ -1,55 +1,54 @@
 /**
  *
  */
-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,
@@ -87,23 +86,19 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
         }
 
         // 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,
@@ -115,7 +110,7 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
         }
 
         RemotingChangeAcceptedTaxonToSynonymOperation rcattso =
-                new RemotingChangeAcceptedTaxonToSynonymOperation(event.getTrigger(),
+                new RemotingChangeAcceptedTaxonToSynonymOperation(getTrigger(),
                         false,
                         oldTaxonNode.getUuid(),
                         newAcceptedTaxonNode.getUuid());
@@ -123,16 +118,24 @@ public class RemotingChangeAcceptedTaxonToSynonymHandler extends RemotingCdmHand
         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;
+    }
 }
@@ -6,20 +6,25 @@
  * 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;
@@ -27,13 +32,14 @@ import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
 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;
 
 /**
@@ -41,18 +47,20 @@ import eu.etaxonomy.taxeditor.ui.dialog.configurator.deleteConfigurator.DeleteCo
  * @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>();
@@ -63,18 +71,11 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
                 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();
 
@@ -96,13 +97,13 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
             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;
                                }
@@ -112,12 +113,12 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
                 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){
@@ -132,7 +133,7 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
                         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);
@@ -143,15 +144,34 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
     }
 
     @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;
+    }
+
 }
@@ -6,33 +6,34 @@
 * 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;
 
 /**
@@ -40,24 +41,20 @@ 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,
@@ -82,7 +79,7 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
                     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);
@@ -91,11 +88,11 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
         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) {
@@ -103,7 +100,7 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
                     "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);
@@ -111,45 +108,58 @@ public class RemotingMoveFactualDataHandler extends RemotingCdmHandler {
         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;
+    }
 }
@@ -6,20 +6,25 @@
  * 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;
@@ -28,7 +33,7 @@ import eu.etaxonomy.taxeditor.navigation.l10n.Messages;
 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;
 
@@ -37,20 +42,19 @@ 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,
@@ -76,13 +80,11 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
         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>();
@@ -93,7 +95,7 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
         if (PreferencesUtil.getSortNodesNaturally()){
 
 
-            parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+            parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
                     new ConversationHolderMock(),
                     Messages.RemotingMoveTaxonNodeHandler_CHOOSE_TAXON,
                     excludeTaxa,
@@ -109,7 +111,7 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
                 moveToNewParent = MovingType.BEHIND;
             }
         } else {
-            parentTaxonNode = TaxonNodeSelectionDialog.select(activeShell,
+            parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
                     new ConversationHolderMock(),
                     Messages.RemotingMoveTaxonNodeHandler_CHOOSE_PARENT,
                     excludeTaxa,
@@ -119,14 +121,14 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
 
 
         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(),
@@ -136,13 +138,24 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
         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;
+    }
 }
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetPublishFlagForSubtreeHandlerE4.java
new file mode 100755 (executable)
index 0000000..6cab818
--- /dev/null
@@ -0,0 +1,138 @@
+// $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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetSecReferenceForSubtreeHandlerE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetSecReferenceForSubtreeHandlerE4.java
new file mode 100755 (executable)
index 0000000..411be08
--- /dev/null
@@ -0,0 +1,134 @@
+/**
+ * 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/ChangeAcceptedTaxonToSynonymHandler.java
deleted file mode 100644 (file)
index 3cff9d8..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- *
- */
-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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CloneClassificationHandler.java
deleted file mode 100644 (file)
index e02afdb..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CopyHandler.java
deleted file mode 100644 (file)
index 9faca12..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/**\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
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/CreateClassificationHierarchyHandler.java
deleted file mode 100644 (file)
index ee633e0..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/MoveFactualDataHandler.java
deleted file mode 100644 (file)
index f7c9568..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NavigatorHandlerUtils.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NavigatorHandlerUtils.java
deleted file mode 100644 (file)
index 9930db8..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
-* 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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewClassificationHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewClassificationHandler.java
deleted file mode 100644 (file)
index 1f61acb..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewTaxonNodeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewTaxonNodeHandler.java
deleted file mode 100644 (file)
index 179f3a8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RefreshTreeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RefreshTreeHandler.java
deleted file mode 100644 (file)
index 5490a3b..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-* 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;
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/SetSecReferenceForSubtreeHandler.java
deleted file mode 100755 (executable)
index 829a55e..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
-* Copyright (C) 2017 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.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
-
-       }
-
-
-
-
-
-
-}
index eca7b851c16d1a19233def9b1986d2f8f59274a0..29733421681c08a3bc1452a4d4001c4008d96a22 100644 (file)
@@ -21,11 +21,10 @@ import org.eclipse.core.runtime.Status;
 
 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;
@@ -50,19 +49,9 @@ public class MoveTaxonOperation extends AbstractPersistentPostOperation {
 
        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);
 
@@ -84,14 +73,16 @@ public class MoveTaxonOperation extends AbstractPersistentPostOperation {
                        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 {
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetPublishForSubtreeOperation.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/SetPublishForSubtreeOperation.java
new file mode 100755 (executable)
index 0000000..3b3b2af
--- /dev/null
@@ -0,0 +1,119 @@
+// $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;
+    }
+
+}
index 96c68e75f1cef68d7ba62bba019ea1cf4ba894b2..47a1f1b627fb574adfde1fd2353aa3a9ed7038b9 100755 (executable)
@@ -24,13 +24,10 @@ 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.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;
@@ -46,8 +43,8 @@ public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation i
     private static final Logger logger = Logger
             .getLogger(SetSecundumForSubtreeOperation.class);
     UUID parentUuid;
-    SetSecundumForSubtreeConfigurator config;
-    UpdateResult updateResult = new UpdateResult();
+    SecundumForSubtreeConfigurator config;
+
 
     /**
      * @param label
@@ -58,10 +55,11 @@ public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation i
     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();
     }
 
     /**
@@ -69,6 +67,8 @@ public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation i
      */
     @Override
     protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
+//        runMoniteredOperation();
+
         Job job = createJob(monitor);
         // configure the job
         job.setProperty(IProgressConstants.KEEP_PROPERTY, true);
@@ -92,28 +92,31 @@ public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation i
 
             @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;
 
             }
@@ -122,6 +125,29 @@ public class SetSecundumForSubtreeOperation extends RemotingCdmUpdateOperation i
     }
 
 
+    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();
+        }
+
+    }
 
 
 
index ca87fd110c7544e3ce2f351638f48c7f32b231d9..f3fa81d9bee9eb9229625a7be2d791d0f9066b70 100644 (file)
@@ -9,9 +9,19 @@
 
 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;
@@ -21,6 +31,7 @@ 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.layout.RowData;
 import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -30,9 +41,6 @@ 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.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.swt.IFocusService;
 
@@ -40,12 +48,14 @@ import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
 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
@@ -54,12 +64,23 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @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} */
@@ -122,6 +143,9 @@ public class SearchBar implements IContextListener{
                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();
        }
@@ -166,12 +190,12 @@ public class SearchBar implements IContextListener{
        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);
@@ -210,20 +234,46 @@ public class SearchBar implements IContextListener{
         */
        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;
        }
 
        /**
@@ -306,57 +356,6 @@ public class SearchBar implements IContextListener{
                }
        }
 
-       /**
-        * 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) {
     }
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchOption.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchOption.java
new file mode 100644 (file)
index 0000000..8304799
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+ * 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;
+    }
+
+}
index fc619781a1ac71c6d6b0340b13d78cee70c58f32..0608e837a55bb48ab6f71a6670cb3146d7d66469 100644 (file)
@@ -1,9 +1,9 @@
 // $$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.
 */
@@ -11,7 +11,6 @@
 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;
@@ -20,72 +19,48 @@ 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.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) {
@@ -107,24 +82,21 @@ public class SearchResultLabelProvider extends ColumnLabelProvider implements IL
                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();
        }
-       
-       
-       
+
 }
index 9f5753e9114c074fc7e3cd5e93c99a31617d03bc..6fdc1006da0770790ac92b6e36877de82abef8bd 100644 (file)
@@ -44,12 +44,9 @@ 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.SearchBar.SearchOption;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -68,7 +65,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                @Override
                public void contextStop(IMemento memento, IProgressMonitor monitor) {
                        monitor.subTask(Messages.SearchResultView_REMOVE_SEARCH_RESULTS);
-                       AbstractUtility.hideView(SearchResultView.this);
+//                     AbstractUtility.hideView(SearchResultView.this);
                }
        }
 
@@ -117,7 +114,7 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                            if(selection instanceof IStructuredSelection){
                                Object firstElement = ((IStructuredSelection) selection).getFirstElement();
                                if(firstElement instanceof UuidAndTitleCache){
-                                   NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
+//                                 NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
                                }
                            }
                        }
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/e4/SearchResultViewE4.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/e4/SearchResultViewE4.java
new file mode 100644 (file)
index 0000000..d5de5d9
--- /dev/null
@@ -0,0 +1,359 @@
+/**
+* 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;
+               }
+
+       }
+}
index 9624b0e798d9b2fef0eef429c21f3069af08cd89..0edce22d3a761fea5f8fab969a6586042399f380 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -22,7 +22,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 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;
 
 /**
@@ -37,42 +37,42 @@ public class MoveTaxonOperationTest extends 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());
@@ -81,25 +81,25 @@ public class MoveTaxonOperationTest extends AbstractTaxeditorOperationTestBase {
 
        /**
         * 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());
index 3270ce3a7492f43fe47162fd48abeca67d55f7a7..dd1fad4ea24a23490f908dc5d93886021e5f4aac 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Printpublisher Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.printpublisher;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Require-Bundle: org.eclipse.osgi,
  org.eclipse.ui,
  eu.etaxonomy.taxeditor.cdmlib,
index 4e578e0c09bbb893bbb8d29016277f07edf721d1..b21e4e9e6fd5182ef2b309004c9a9c020c0b00a0 100644 (file)
@@ -3,7 +3,7 @@
        <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>
index 8cde7d596fe055b7b27ef304d6e8d9bc3ef8c203..a95ddb85352e6b1af80d376560b7019c725b9cdd 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -20,14 +20,12 @@ import org.eclipse.ui.IEditorPart;
 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;
 
@@ -39,48 +37,49 @@ 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;
        }
 }
index d9ec9e77282ffc7ec8271e3ed1352083535a2831..8ba8e143082dff522335bf5ea8c34ea1904fefe8 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: DataStore Bundle
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
 Bundle-Vendor: EDIT
 Bundle-Localization: OSGI-INF/l10n/bundle
@@ -14,16 +14,19 @@ Export-Package: eu.etaxonomy.cdm,
  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,
@@ -33,6 +36,7 @@ Export-Package: eu.etaxonomy.cdm,
  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,
@@ -84,7 +88,9 @@ Require-Bundle: org.eclipse.osgi,
  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,
index 4b4d7cd91d562438654487deae5e1cfd1057ae04..6ac62a17180cb2e1428efa2e18efbf2f649442f1 100644 (file)
@@ -38,6 +38,7 @@ view.name.4 = Details
 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
@@ -178,4 +179,5 @@ wizard.name.22 = CDM light (csv)
 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
index e519919071bcc182620987b4e5f9cae3cef47bf6..1ea4fe6e828e780ec9f9ed408139380702e646b8 100644 (file)
@@ -38,7 +38,7 @@ view.name.4 = Details
 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
@@ -179,4 +179,5 @@ wizard.name.22 = CDM light (csv)
 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
index ffea36f739a5bc09a9d0d6f0bb2e51c791afbb64..3457f7295bd5c5381b23d7100843af8209989673 100644 (file)
@@ -1,10 +1,11 @@
 <?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>
@@ -21,7 +22,7 @@
     </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>
index 615341c2c704cc25bc3b82445d49bcbf36efa1ae..f7851a544cc5a808bb671955f3c63c58c2372291 100755 (executable)
@@ -2,385 +2,8 @@
 <?eclipse version="3.2"?>
 <plugin>
    <extension-point id="eu.etaxonomy.taxeditor.store.cdmViewer" name="Cdm Viewer" schema="schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd"/>
-   <extension
-         point="org.eclipse.ui.preferencePages">
-      <page
-            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>
index e75b0c676f193376dde244669288eaf32a3b53e6..b3bd138f15f946ee22510f3e70060be242cd84d6 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index 885b7c9f7a4baf9fb799f4831943b42573619ac6..d076b3becef41ae1509330ef73816a577c8f9b19 100755 (executable)
@@ -14,9 +14,9 @@ import org.eclipse.jface.preference.IPreferenceStore;
 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;
@@ -25,6 +25,7 @@ import org.eclipse.swt.widgets.Label;
 
 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;
@@ -115,7 +116,7 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
                    .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() {
@@ -162,7 +163,7 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
         //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);
@@ -181,19 +182,26 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
        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) {
@@ -203,9 +211,14 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
          });
 
         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) {
@@ -215,9 +228,13 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
          });
 
         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) {
@@ -225,11 +242,15 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
                  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) {
@@ -238,6 +259,25 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
               }
          });
 
+//        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);
+              }
+         });
+
 
 
  }
index 43b9701c2716c4e4f6f6734b0be1e0592decc7dd..95f6fa558215534fcce7082cd1b33e05610cb3c6 100644 (file)
@@ -16,6 +16,8 @@ import eu.etaxonomy.cdm.api.service.IPreferenceService;
 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;
 
 /**
@@ -53,6 +55,7 @@ public class DatabasePreferencesWizard extends Wizard {
     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);
@@ -65,27 +68,37 @@ public class DatabasePreferencesWizard extends Wizard {
         }
         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();
index 5ba51a1f34c2c1492b6eddf3c48ff960a9890821..cb2ff92279b4300d1376b2e8e8550514bc1a9424 100755 (executable)
@@ -14,6 +14,7 @@ import java.util.ArrayList;
 
 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;
@@ -42,7 +43,7 @@ public class ListComponent
     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);
@@ -50,14 +51,18 @@ public class ListComponent
         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);
 
@@ -198,7 +203,8 @@ public class ListComponent
 
             //Select the new item
             list.setSelection(index);
-            list.redraw();
+            list.update();
+            providerURI.setText("");
 
         }
     }
index a6a6274a88d3a4e5e88b5f124f1ca0d168d64f94..33103e5185b931c589df3a22cd0997a46ec1c60e 100755 (executable)
@@ -17,6 +17,7 @@ import org.eclipse.swt.layout.GridLayout;
 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;
@@ -61,10 +62,28 @@ public class NameDetailsViewComposite extends Composite {
       // 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
@@ -87,8 +106,8 @@ public class NameDetailsViewComposite extends Composite {
        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
@@ -99,8 +118,8 @@ public class NameDetailsViewComposite extends Composite {
         });
 
        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
@@ -111,8 +130,8 @@ public class NameDetailsViewComposite extends Composite {
         });
 
        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
@@ -123,8 +142,9 @@ public class NameDetailsViewComposite extends Composite {
         });
 
        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
@@ -134,8 +154,8 @@ public class NameDetailsViewComposite extends Composite {
              }
         });
        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
@@ -146,135 +166,124 @@ public class NameDetailsViewComposite extends Composite {
         });
 
        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){
@@ -289,62 +298,30 @@ public class NameDetailsViewComposite extends Composite {
     *
     */
    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();
index fbb1862c350afd397b1c8fada173c0c56747f66c..dbd0659e0bbd1e393fc54597e8174a66dcccc89a 100644 (file)
@@ -1,24 +1,28 @@
 /**
 * 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
  *
@@ -26,14 +30,14 @@ import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeVie
 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
@@ -50,15 +54,18 @@ public class CdmAuthorityTableDropTargetListener implements DropTargetListener {
 
        @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
index a24d8dd0f06f22474af33b7a5eba53db459515c9..20024f890d23aa3ab420aa05bb912dafcacc01d7 100644 (file)
@@ -26,7 +26,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @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";
@@ -58,12 +58,11 @@ public class TaxonNodeTransfer extends CdmObjectTransfer<ITaxonTreeNode> {
         * @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;
        }
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/AppModelId.java
deleted file mode 100644 (file)
index afae040..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-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
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/IDistributionEditor.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/IDistributionEditor.java
new file mode 100755 (executable)
index 0000000..68376b7
--- /dev/null
@@ -0,0 +1,19 @@
+// $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 {
+
+}
index d76d1c708533d6ecc6ac09cfee7325d2a6263dff..e6baa874a0af3e5baf2e1abda905397269b50fed 100644 (file)
@@ -66,7 +66,7 @@ public class DefinedTermDropAdapter extends ViewerDropAdapter {
                        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
index 0572d1a6fe6fde4722589aed8f9a7d15796b4803..25d62803b718fd1e0e6318f1c5aab912b7aeea09 100644 (file)
@@ -64,7 +64,6 @@ public class DefinedTermMenu extends CompoundContributionItem {
                     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());
 
index afe20ea94af10b0fc99faae4cb859e1d54c194e7..b747f460e8a3aef1c0a1b577a24d7eb4884b0a48 100644 (file)
@@ -11,8 +11,10 @@ package eu.etaxonomy.taxeditor.editor.definedterm.e4;
 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;
@@ -24,6 +26,7 @@ import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
 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;
 
 /**
  *
@@ -31,10 +34,14 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @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;
@@ -60,7 +67,7 @@ public class DefinedTermDropAdapterE4 extends ViewerDropAdapter {
                        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()])));
 
index 47cd9c75f41577a7bd836aa73a622de1c1492834..8ca9525f8975755b05e16b2b0b0e01489c36d955 100644 (file)
@@ -13,6 +13,8 @@ import javax.annotation.PreDestroy;
 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;
@@ -30,6 +32,7 @@ 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.conversation.ConversationHolder;
@@ -86,7 +89,8 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
        }
 
        @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();
@@ -101,7 +105,7 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
            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());
@@ -109,7 +113,9 @@ IPartContentHasDetails, IPartContentHasSupplementalData, IE4SavablePart, IContex
 
            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)));
index d133ff033f6d2ac6b22afcf8b37cfc0b1578fce8..059fbfeb680a4b3a140883e05e53afbf24af8bb3 100644 (file)
@@ -60,7 +60,6 @@ public class DefinedTermMenuE4 {
             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);
 
index 1be63a510f124fa3cedda74b499232479018ca7b..d53359d1f1a3531f6a7a773590ae144143a87131 100644 (file)
@@ -14,6 +14,7 @@ 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.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;
@@ -39,7 +40,8 @@ public class CreateDefinedTermHandlerE4 {
 
     @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();
 
@@ -55,7 +57,7 @@ public class CreateDefinedTermHandlerE4 {
                         termBase,
                         termEditor.getDefinedTermEditorInput(),
                         termEditor, addTermAsKindOf);
-        AbstractUtility.executeOperation(operation);
+        AbstractUtility.executeOperation(operation, sync);
 
     }
 
index 8cf06f13d57a6f9d29e1a30cfa38e58da63beefe..13a2dc9d958cb82d1aa6fb9d5eccd02e33c6f0c3 100644 (file)
@@ -10,15 +10,13 @@ package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
 
 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;
@@ -35,7 +33,8 @@ public class CreateTermVocabularyHandlerE4 {
 
     @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();
 
@@ -47,6 +46,6 @@ public class CreateTermVocabularyHandlerE4 {
                         undoContext,
                         termEditor.getDefinedTermEditorInput(),
                         termEditor);
-        AbstractUtility.executeOperation(operation);
+        AbstractUtility.executeOperation(operation, sync);
     }
 }
index 077eefdc523d54f0552b7542f2138c819dc571f4..d31b44668a906f44566da592a541d5ce3c5aa264 100644 (file)
@@ -14,6 +14,7 @@ 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.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;
@@ -40,7 +41,8 @@ public class DeleteTermBaseHandlerE4 {
 
     @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();
 
@@ -61,7 +63,7 @@ public class DeleteTermBaseHandlerE4 {
                         termBase,
                         termEditor.getDefinedTermEditorInput(),
                         termEditor);
-        AbstractUtility.executeOperation(operation);
+        AbstractUtility.executeOperation(operation, sync);
     }
 
     @CanExecute
index d4a985b708e80afc394c66918ec67303f5848019..ccb9a47b37deada73abf33ea35dcd7b2f75beb2a 100644 (file)
@@ -11,14 +11,18 @@ package eu.etaxonomy.taxeditor.editor.definedterm.e4.handler;
 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;
 
 
 /**
@@ -30,15 +34,19 @@ import eu.etaxonomy.taxeditor.editor.definedterm.input.TermEditorInput;
 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);
        }
 
index 4dc81af70f3560a755b02763fce68865ff1546b8..3f942475309e802ec20f39b9576763b39fbeef4e 100644 (file)
@@ -56,7 +56,6 @@ public class CreateDefinedTermHandler extends AbstractHandler {
                                                                        termBase,\r
                                                                        dfe.getDefinedTermEditorInput(),\r
                                                                        editor, addTermAsKindOf);\r
-                                       StoreUtil.executeOperation(operation);\r
 \r
                                } catch (NotDefinedException e) {\r
                                        MessagingUtils.error(getClass(), e);\r
index f4a8746a4330787aa2bdfe625e98e565d9c60b57..623cf377284bd74e9c57863deacf3cc25d1e7d97 100644 (file)
@@ -1,8 +1,8 @@
 /**\r
 * Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
+* European Distributed Institute of Taxonomy\r
 * http://www.e-taxonomy.eu\r
-* \r
+*\r
 * The contents of this file are subject to the Mozilla Public License Version 1.1\r
 * See LICENSE.TXT at the top of this package for the full license terms.\r
 */\r
@@ -46,16 +46,15 @@ public class CreateTermVocabularyHandler extends AbstractHandler implements
                                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
index c8eb9e156c60073ee2ba0b04e58357914569a720..31fc650285aadd8745252c3d5d79ade1bdb27abc 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.ui.handlers.HandlerUtil;
 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
@@ -72,7 +71,6 @@ public class DeleteTermBaseHandler extends AbstractHandler {
                                                term,\r
                                                dfe.getDefinedTermEditorInput(),\r
                                                dfe);\r
-                               AbstractUtility.executeOperation(operation);\r
                            }\r
                        }\r
                    } catch (NotDefinedException e) {\r
index b4b5bd6dc602d3c6a38bc2f3538bc4d790f43318..e79eaeb929b11513895dd84a51beeff9a6a17b74 100644 (file)
@@ -8,23 +8,10 @@
  */\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
@@ -40,17 +27,17 @@ public class OpenDefinedTermEditorHandler extends AbstractHandler implements IHa
        @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
index af47989d6f1aaf569ca1b4bf129140f3c16494c6..7c4dec8ca971b99d93fb094c2b8568d17480231a 100644 (file)
@@ -10,10 +10,6 @@ package eu.etaxonomy.taxeditor.editor.definedterm.input;
 \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
@@ -22,7 +18,7 @@ import eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput;
  * @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
@@ -31,31 +27,6 @@ public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase>
                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
index ff305fec55f804c71be6d06ea0a64a7e66fa99d6..1dae6c28c120dd0f630db0ebfd3739ffedfa4dbf 100644 (file)
@@ -49,10 +49,6 @@ public class TermEditorInput extends AbstractDefinedTermEditorInput<DefinedTerm>
                vocabularies = new HashSet<TermVocabulary<DefinedTermBase>>();
                initialiseVocabularies();
        }
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.IEditorInput#getName()
-        */
-       @Override
        public String getName() {
                return termType.getMessage();
        }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/EventUtility.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/EventUtility.java
new file mode 100644 (file)
index 0000000..e9204b7
--- /dev/null
@@ -0,0 +1,117 @@
+/**
+* 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);
+//    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/WorkbenchEventConstants.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/event/WorkbenchEventConstants.java
new file mode 100644 (file)
index 0000000..edf9fd0
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+* 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";
+
+}
index daa4f9d44d5fef34df42855147856e38e13ed936..a000baacfee39b24bda2617b119701d7078a52ba 100644 (file)
@@ -20,6 +20,7 @@ import javax.annotation.PreDestroy;
 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;
@@ -40,9 +41,11 @@ import org.eclipse.swt.widgets.Composite;
 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;
@@ -52,6 +55,7 @@ import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
 import eu.etaxonomy.taxeditor.workbench.part.IE4ViewerPart;
 
 /**
@@ -61,7 +65,7 @@ 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;
 
@@ -104,7 +108,7 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListen
                     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;
@@ -178,8 +182,17 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListen
            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();
         }
@@ -272,4 +285,11 @@ public class FeatureTreeEditor implements ICdmEntitySessionEnabled, ModifyListen
     public void workbenchShutdown(IMemento memento, IProgressMonitor monitor) {
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void update(CdmDataChangeMap arg0) {
+    }
+
 }
index 404134355b0146cd19d2d08d1d0bf75cda48a901..be610a1651dc25c4746befbba35e1b40160745b4 100644 (file)
@@ -71,7 +71,7 @@ public class FeatureTreeEditorComposite extends Composite{
         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(
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java
deleted file mode 100644 (file)
index 483dcb3..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
-* 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;
-
-       }
-
-
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ReconnectHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ReconnectHandler.java
deleted file mode 100644 (file)
index 87717ed..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
-* 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;
-
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java
deleted file mode 100644 (file)
index 696ec88..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-* 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;
-               
-       }
-
-       
-       
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowRemotingLoginWindowHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowRemotingLoginWindowHandler.java
deleted file mode 100644 (file)
index 44ce5ff..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
-* 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;
-
-       }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/SwitchUserHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/SwitchUserHandler.java
deleted file mode 100644 (file)
index d97e803..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
-* 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;
-
-       }
-}
-
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java
deleted file mode 100644 (file)
index 307564c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-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();
-    }
-
-
-}
index 46639878f81dbea2f069017d8d5d3f1b1abbe42b..75c97622bde039cc2e209790c8c2a0c841078b96 100644 (file)
@@ -7,11 +7,9 @@ import org.eclipse.core.commands.ExecutionEvent;
 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 {
 
@@ -35,10 +33,11 @@ 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;
     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java
deleted file mode 100644 (file)
index 4b036b5..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-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;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsViewHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsViewHandler.java
new file mode 100644 (file)
index 0000000..92344f8
--- /dev/null
@@ -0,0 +1,16 @@
+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);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenClassificationWizardHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenClassificationWizardHandlerE4.java
new file mode 100644 (file)
index 0000000..2d66141
--- /dev/null
@@ -0,0 +1,39 @@
+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);
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenHandlerBaseE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/e4/DefaultOpenHandlerBaseE4.java
new file mode 100644 (file)
index 0000000..494ac23
--- /dev/null
@@ -0,0 +1,60 @@
+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);
+
+}
@@ -6,13 +6,14 @@
 * 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;
@@ -24,18 +25,25 @@ import eu.etaxonomy.taxeditor.ui.section.classification.EditTaxonNodeWizard;
  * @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
@@ -6,33 +6,33 @@
 * 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;
         }
-
     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenPasswordWizzardHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenPasswordWizzardHandlerE4.java
new file mode 100644 (file)
index 0000000..b51f6cd
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+* 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);
+           }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ReconnectHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ReconnectHandlerE4.java
new file mode 100644 (file)
index 0000000..c701f9f
--- /dev/null
@@ -0,0 +1,39 @@
+/**
+* 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);
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowLoginWindowHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowLoginWindowHandlerE4.java
new file mode 100644 (file)
index 0000000..a65915a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowRemotingLoginWindowHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/ShowRemotingLoginWindowHandlerE4.java
new file mode 100644 (file)
index 0000000..1ec9ecc
--- /dev/null
@@ -0,0 +1,36 @@
+/**
+* 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/SwitchUserHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/SwitchUserHandlerE4.java
new file mode 100644 (file)
index 0000000..0b9aa7c
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+* 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);
+       }
+}
+
index d256407643de5697c6ed43924cd57962fafbf6a1..ac767716736c1314d721a6e075dbad41a2d39f0c 100644 (file)
 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;
@@ -33,35 +31,29 @@ 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.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;
 
 /**
@@ -74,7 +66,7 @@ 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);
@@ -165,8 +157,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
 
                                        @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;
@@ -218,11 +209,11 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                                 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{
@@ -232,7 +223,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                                    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();
@@ -241,13 +232,13 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                             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();
@@ -257,12 +248,12 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                                 } 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) {
@@ -327,7 +318,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
     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) {
@@ -356,14 +347,14 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                              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();
@@ -407,7 +398,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
     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() {
@@ -437,7 +428,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> implem
                        CdmStore.getContextManager().notifyContextRefresh();
                    }
                });
-               
+
        }
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractImportWizardE4.java
new file mode 100644 (file)
index 0000000..d171aba
--- /dev/null
@@ -0,0 +1,103 @@
+/**
+* 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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractOpenImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/AbstractOpenImportWizard.java
new file mode 100644 (file)
index 0000000..400740b
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/GenericConfiguratorWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/GenericConfiguratorWizardPageE4.java
new file mode 100644 (file)
index 0000000..492e1d9
--- /dev/null
@@ -0,0 +1,251 @@
+/**
+ * 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;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileAndChooseVocIdWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileAndChooseVocIdWizardPageE4.java
new file mode 100755 (executable)
index 0000000..c59ef26
--- /dev/null
@@ -0,0 +1,124 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileDataSourceWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ImportFromFileDataSourceWizardPageE4.java
new file mode 100644 (file)
index 0000000..7a08b4b
--- /dev/null
@@ -0,0 +1,134 @@
+/**
+* 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());
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/NomenclaturalCodeWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/NomenclaturalCodeWizardPageE4.java
new file mode 100644 (file)
index 0000000..b79c419
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+* 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);
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportConfiguratorWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportConfiguratorWizardPageE4.java
new file mode 100644 (file)
index 0000000..7dde35f
--- /dev/null
@@ -0,0 +1,274 @@
+/**
+* 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();
+           }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportWizardE4.java
new file mode 100644 (file)
index 0000000..f6ddcb7
--- /dev/null
@@ -0,0 +1,95 @@
+/**
+* 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();
+
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/ClassificationChooserWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/ClassificationChooserWizardPageE4.java
new file mode 100644 (file)
index 0000000..4234537
--- /dev/null
@@ -0,0 +1,103 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/OpenAbcdImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/OpenAbcdImportWizard.java
new file mode 100644 (file)
index 0000000..3697e16
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/ExcelDistributionUpdateWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/ExcelDistributionUpdateWizardE4.java
new file mode 100755 (executable)
index 0000000..7f61dec
--- /dev/null
@@ -0,0 +1,126 @@
+/**
+* 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);
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/OpenExcelDistributionImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/distribution/OpenExcelDistributionImportWizard.java
new file mode 100644 (file)
index 0000000..ed74576
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/OpenExcelSpecimenImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/OpenExcelSpecimenImportWizard.java
new file mode 100644 (file)
index 0000000..8b6b6e4
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/SpecimenCdmExcelImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/specimen/SpecimenCdmExcelImportWizardE4.java
new file mode 100644 (file)
index 0000000..d1677e2
--- /dev/null
@@ -0,0 +1,90 @@
+/**
+ *
+ */
+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);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/ExcelNormalExplicitTaxaImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/ExcelNormalExplicitTaxaImportWizardE4.java
new file mode 100644 (file)
index 0000000..b4b581e
--- /dev/null
@@ -0,0 +1,132 @@
+/**
+* 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);
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/OpenExcelTaxaImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/excel/taxa/OpenExcelTaxaImportWizard.java
new file mode 100644 (file)
index 0000000..cfbb0e5
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/OpenRisImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/OpenRisImportWizard.java
new file mode 100644 (file)
index 0000000..bf48670
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/RISImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/ris/RISImportWizardE4.java
new file mode 100755 (executable)
index 0000000..5a0e370
--- /dev/null
@@ -0,0 +1,117 @@
+/**
+* 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);
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/OpenSddImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/OpenSddImportWizard.java
new file mode 100644 (file)
index 0000000..7715e6d
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/SddImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/sdd/SddImportWizardE4.java
new file mode 100644 (file)
index 0000000..f9d33a1
--- /dev/null
@@ -0,0 +1,82 @@
+/**
+* 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/OpenTcsImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/OpenTcsImportWizard.java
new file mode 100644 (file)
index 0000000..034cddf
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/TcsImportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/tcs/TcsImportWizardE4.java
new file mode 100644 (file)
index 0000000..4e0b403
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+* 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractExportWizardE4.java
new file mode 100644 (file)
index 0000000..b92b39c
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+* 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();
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractOpenExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/AbstractOpenExportWizard.java
new file mode 100644 (file)
index 0000000..2fb2c19
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+* 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
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/CdmLightExportWizardE4.java
new file mode 100755 (executable)
index 0000000..ba28faf
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ * 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();
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/OpenCdmLightExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/cdmlight/OpenCdmLightExportWizard.java
new file mode 100644 (file)
index 0000000..7f02e53
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/CsvExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/CsvExportWizardE4.java
new file mode 100644 (file)
index 0000000..d49d9b2
--- /dev/null
@@ -0,0 +1,107 @@
+/**
+ * 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);
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/OpenCsvExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/OpenCsvExportWizard.java
new file mode 100644 (file)
index 0000000..8287f2b
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/CsvNameExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/CsvNameExportWizardE4.java
new file mode 100644 (file)
index 0000000..df54ce8
--- /dev/null
@@ -0,0 +1,84 @@
+/**
+ * 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);
+       }
+}
+
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/OpenCsvNameExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/name/OpenCsvNameExportWizard.java
new file mode 100644 (file)
index 0000000..b5cac94
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/CsvPrintExportWizardE4.java
new file mode 100644 (file)
index 0000000..59db4a0
--- /dev/null
@@ -0,0 +1,63 @@
+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;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/OpenCsvPrintExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/csv/print/OpenCsvPrintExportWizard.java
new file mode 100644 (file)
index 0000000..d70df80
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/DarwinCoreArchiveExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/DarwinCoreArchiveExportWizardE4.java
new file mode 100644 (file)
index 0000000..5569acb
--- /dev/null
@@ -0,0 +1,83 @@
+/**
+ * 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();
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/OpenDwcaExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/dwca/OpenDwcaExportWizard.java
new file mode 100644 (file)
index 0000000..a94cb9d
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/JaxbExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/JaxbExportWizardE4.java
new file mode 100644 (file)
index 0000000..8c15f0a
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+* 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;
+       }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/OpenJaxbExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/jaxb/OpenJaxbExportWizard.java
new file mode 100644 (file)
index 0000000..0201f4b
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/OpenSddExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/OpenSddExportWizard.java
new file mode 100644 (file)
index 0000000..f14f755
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+* 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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/SddExportWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/sdd/SddExportWizardE4.java
new file mode 100644 (file)
index 0000000..6882726
--- /dev/null
@@ -0,0 +1,77 @@
+/**
+* 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();
+       }
+}
index 6c7eb748bba2e1f2c508afaa1f1d537640487317..0654a1735473bcba5977c0c65c3fab817d0940d9 100644 (file)
@@ -9,7 +9,6 @@
 
 package eu.etaxonomy.taxeditor.io.wizard;
 
-import java.awt.Checkbox;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Collections;
@@ -17,7 +16,6 @@ import java.util.Comparator;
 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;
@@ -28,7 +26,6 @@ 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.Control;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
@@ -41,7 +38,6 @@ import eu.etaxonomy.cdm.io.cdmLight.CdmLightExportConfigurator;
 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;
@@ -86,16 +82,12 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
 
        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;
@@ -115,17 +107,14 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
     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);
@@ -147,22 +136,13 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                   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,
@@ -172,15 +152,6 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                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,
@@ -190,15 +161,6 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                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,
@@ -208,9 +170,6 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                XML, config);
        }
 
-       /**
-        * @return
-        */
        public static ExportToFileDestinationWizardPage Dwca(DwcaTaxExportConfigurator config) {
                return new ExportToFileDestinationWizardPage(
                                DWCA_EXPORT,
@@ -220,11 +179,8 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                ZIP, config);
        }
 
-       /**
-     * @return
-     */
     public static ExportToFileDestinationWizardPage OutputModel(CdmLightExportConfigurator config) {
-        
+
         return new ExportToFileDestinationWizardPage(
                 OUTPUT_MODEL_EXPORT,
                 OUTPUT_MODEL_EXPORT,
@@ -233,12 +189,8 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                 CSV,config);
     }
 
-
-    /**
-     * @return
-     */
     public static ExportToFileDestinationWizardPage Csv(CsvDemoExportConfigurator config) {
-        
+
         return new ExportToFileDestinationWizardPage(
                 CSV_EXPORT,
                 CSV_EXPORT,
@@ -247,11 +199,8 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                 CSV, config);
     }
 
-    /**
-     * @return
-     */
     public static ExportToFileDestinationWizardPage CsvNames(CsvNameExportConfigurator config) {
-       
+
         return new ExportToFileDestinationWizardPage(
                 CSV_NAME_EXPORT,
                 CSV_NAME_EXPORT,
@@ -260,11 +209,8 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                 CSV, config);
     }
 
-    /**
-     * @return
-     */
     public static ExportToFileDestinationWizardPage CsvPrint(CsvNameExportConfigurator config) {
-       
+
         return new ExportToFileDestinationWizardPage(
                 CSV_PRINT_EXPORT,
                 CSV_NAME_EXPORT,
@@ -273,13 +219,6 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                 CSV, config);
     }
 
-       /*
-        * (non-Javadoc)
-        *
-        * @see
-        * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
-        * .Composite)
-        */
        /** {@inheritDoc} */
        @Override
     public void createControl(Composite parent) {
@@ -288,10 +227,10 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
 
                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);
@@ -312,21 +251,21 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                        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());
@@ -341,7 +280,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                GridData data = (GridData)  classificationSelectionCombo.getLayoutData();
                                data.exclude = b.getSelection();
                                classificationSelectionCombo.setVisible(!data.exclude);
-                               classificationLabel.setVisible(!data.exclude);
+
                                }
                                });
                                  checkUseSelectedtaxonNode.setSelection(true);
@@ -354,28 +293,30 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                                   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");
@@ -397,13 +338,6 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                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);
@@ -417,7 +351,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                        }
                });
                if (!outputModelExport){
-                       
+
                         Label fileLabel = new Label(composite, SWT.NONE);
                        fileLabel.setText("File");
                        text_exportFileName = new Text(composite, SWT.BORDER);
@@ -451,55 +385,32 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                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));
 
@@ -543,13 +454,9 @@ public class ExportToFileDestinationWizardPage extends WizardPage implements Sel
                return checkUseSelectedtaxonNode.getSelection();
        }
 
-       
        @Override
        public boolean canFlipToNextPage() {
         return  getFolderText() != null;
     }
-       
-
-   
 
 }
index 532a118fd98d17e82ee92da4590c6a9c5fe4f52c..b13dc8f63af7b9d55ecc1156c9fb36241910b922 100644 (file)
@@ -188,6 +188,7 @@ public class Messages extends NLS {
     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;
@@ -228,7 +229,7 @@ public class Messages extends NLS {
     public static String AbstractImportWizard_ConfigurationLabel;
 
 
-       
+
 
     public static String FeatureTreeEditorComposite_ADD_FEATURE;
 
@@ -266,10 +267,67 @@ public class Messages extends NLS {
        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;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
-       
 
 
 
index a981e91cd4171cb0ffbd14ebdc7fd2bd5f68bc80..e7c1c54c7b7bb8a07c3c1349873460eee41ba7de 100644 (file)
@@ -163,6 +163,7 @@ SetSecundumConfiguration_IncludeSharedtaxa=Include shared taxa
 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
@@ -196,6 +197,7 @@ ImportFromFileAndChooseVocIdWizardPage_AreaVoc=Area Vocabulary
 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
@@ -208,4 +210,38 @@ NonViralNameDetails_desciptionDeleteOfBacterialNameParts=If you click Ok, the na
 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
index e348f2d35ca0e5bdb0f98bc6b5be9c00b2a210a2..27b3392964871566d0b66d6263e53978c059f2e8 100644 (file)
@@ -163,6 +163,7 @@ SetSecundumConfiguration_IncludeSharedtaxa=Auch mehrfach verwendete Taxa mit ein
 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
@@ -192,10 +193,12 @@ DatabasePreferencesPage_UseLocalPreferences=Erlaube das lokale 
 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
@@ -208,4 +211,39 @@ NonViralNameDetails_desciptionDeleteOfBacterialNameParts=Best
 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
old mode 100755 (executable)
new mode 100644 (file)
index 8d6516d..b39a7f7
@@ -14,7 +14,6 @@ import java.io.File;
 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;
@@ -31,47 +30,31 @@ import java.util.zip.ZipOutputStream;
 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;
@@ -80,20 +63,20 @@ 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.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;
 
 /**
  *
@@ -110,148 +93,35 @@ public abstract class AbstractUtility {
     /** 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");
@@ -260,21 +130,17 @@ public abstract class AbstractUtility {
         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();
@@ -283,25 +149,34 @@ public abstract class AbstractUtility {
                 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");
@@ -310,23 +185,24 @@ public abstract class AbstractUtility {
         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();
                 }
@@ -334,12 +210,12 @@ public abstract class AbstractUtility {
                 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);
         }
@@ -396,9 +272,9 @@ public abstract class AbstractUtility {
                     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
@@ -411,7 +287,7 @@ public abstract class AbstractUtility {
                                    }
                                });
                            }
-                           
+
                            if (urlString != null){
                                 ExportDataWrapper data = result.getExportData();
                                 try{
@@ -433,14 +309,14 @@ public abstract class AbstractUtility {
                                         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();
@@ -448,13 +324,13 @@ public abstract class AbstractUtility {
                                             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();
@@ -596,85 +472,36 @@ public abstract class AbstractUtility {
         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();
         }
     }
 
@@ -827,32 +654,6 @@ public abstract class AbstractUtility {
         }
     }
 
-
-    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;
@@ -881,7 +682,7 @@ public abstract class AbstractUtility {
             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
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ColorResources.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ColorResources.java
new file mode 100644 (file)
index 0000000..6194133
--- /dev/null
@@ -0,0 +1,73 @@
+/**
+* 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));
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FontResources.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FontResources.java
new file mode 100644 (file)
index 0000000..ec80270
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+* 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)});
+    }
+}
index b05d106fae4309ac238985fdb4bac74f1f692652..0f41b326693baaa312e96026f4a1840d58ce3978 100644 (file)
@@ -9,30 +9,25 @@
 
 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;
 
@@ -40,15 +35,8 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
 
        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()));
        }
@@ -60,9 +48,6 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
         */
        protected abstract String getEntityName();
 
-       /* (non-Javadoc)
-        * @see org.eclipse.jface.wizard.Wizard#performFinish()
-        */
        /** {@inheritDoc} */
        @Override
        public boolean performFinish() {
@@ -73,20 +58,10 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
                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;
        }
@@ -96,40 +71,17 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
         */
        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;
@@ -139,16 +91,6 @@ public abstract class AbstractNewEntityWizard<T> extends Wizard implements
        @Override
     public void update(CdmDataChangeMap changeEvents) {}
 
-       /**
-        * @return the workbench
-        */
-       public IWorkbench getWorkbench() {
-               return workbench;
-       }
-
-       /**
-        * @return the selection
-        */
        public IStructuredSelection getSelection() {
                return selection;
        }
index a58b5ad42673c0c7ea8fe405887c4860108790e5..baf6e5bd908770cdc454ec2f96aa67a9ac94cf25 100644 (file)
@@ -38,29 +38,6 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
     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
@@ -68,15 +45,14 @@ public abstract class AbstractPostOperation<T extends ICdmBase> extends Abstract
      */
     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;
index 6604f27bb22cd09fda681b1fd62231c5182e681d..c1cfb4bf0e037ef7c6d7b1b8829bcc48cfab3a20 100644 (file)
@@ -36,17 +36,9 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<T
     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,
@@ -54,19 +46,13 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<T
         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;
     }
@@ -79,7 +65,8 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<T
      * @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;
     }
@@ -93,7 +80,7 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<T
      */
     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,
@@ -101,11 +88,6 @@ public abstract class AbstractPostTaxonOperation extends AbstractPostOperation<T
         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);
     }
index 5a8ba1e8c9b4353df05a0e7b2604a7792bf0c226..7686ec8575e4fe0d5e6b4fe7fbc37e016d8b2a79 100644 (file)
@@ -15,7 +15,6 @@ import org.eclipse.core.commands.operations.AbstractOperation;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.ErrorDialog;
 
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
@@ -40,7 +39,7 @@ public abstract class RemotingCdmHandler extends AbstractHandler {
         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 ||
index 0c5144d30eddc0ef71559f12b5f27cd82c439bb3..aa1a080f2de70c048d19807918da80c7a2f9b5c9 100644 (file)
@@ -28,7 +28,7 @@ import eu.etaxonomy.cdm.api.service.UpdateResult;
  */
 public abstract class RemotingCdmUpdateOperation extends RemotingCdmOperation {
 
-    private UpdateResult updateResult;
+    protected UpdateResult updateResult;
     public static boolean throwExceptions = false;
 
     /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/e4/RemotingCdmHandlerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/e4/RemotingCdmHandlerE4.java
new file mode 100644 (file)
index 0000000..3860196
--- /dev/null
@@ -0,0 +1,91 @@
+/**
+* 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();
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java
deleted file mode 100644 (file)
index 8db8757..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
-* 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) {
-               
-       }
-}
index 4b299df601dc59b4740379f6421b939d37a3a964..2168b53186558aa206e51ee6d68a5d214f515e6e 100644 (file)
@@ -68,7 +68,7 @@ public class DefaultFeatureTreePreferenecs extends CdmPreferencePage implements
 
        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));
@@ -98,7 +98,7 @@ public class DefaultFeatureTreePreferenecs extends CdmPreferencePage implements
 
        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));
index ea2721e0f90439c8064dd359f8add22c0762b660..977a1aee135ec948dfb15a7f7a128180c53e2735 100644 (file)
@@ -135,7 +135,7 @@ public interface IPreferenceKeys {
     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";
@@ -146,7 +146,7 @@ public interface IPreferenceKeys {
     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";
@@ -165,6 +165,8 @@ public interface IPreferenceKeys {
        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";
@@ -175,10 +177,12 @@ public interface IPreferenceKeys {
      * 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
      *
@@ -204,13 +208,18 @@ public interface IPreferenceKeys {
     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";
+
 
 
 
index 9d3963ca622d7c4eda7cad6c3f7a8c846ae665c4..62c1d837333ab979ba51f69584ee70d164bcc407 100644 (file)
@@ -36,6 +36,9 @@ public class MediaPreferences extends FieldEditorPreferencePage implements IWork
         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()));
 
     }
 
index f2d87e71de7e930ad659fe2b74b7f786d76166eb..28e420ea9def48323241ae73be1190988fa48892 100644 (file)
@@ -9,13 +9,20 @@ 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.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) {
 
@@ -33,205 +40,264 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
 
        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;
 
 
index ca98bcd0d9489a098233ed6887a6d696eb5c878f..11f53743fb9c9459b57f26af188a3c73a693c433 100644 (file)
@@ -188,15 +188,68 @@ public class PreferencesUtil implements IPreferenceKeys {
                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();
         }
@@ -214,6 +267,11 @@ public class PreferencesUtil implements IPreferenceKeys {
            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
@@ -952,7 +1010,7 @@ public class PreferencesUtil implements IPreferenceKeys {
     public static void setShowIdInVocabularyInChecklistEditor(boolean selection) {
         getPreferenceStore().setValue(CHECKLIST_ID_IN_VOCABULARY, selection);
     }
-    
+
     /**
      * @return
      */
@@ -990,7 +1048,7 @@ public class PreferencesUtil implements IPreferenceKeys {
             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....
@@ -1004,60 +1062,60 @@ public class PreferencesUtil implements IPreferenceKeys {
             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;
@@ -1069,44 +1127,44 @@ public class PreferencesUtil implements IPreferenceKeys {
                }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;
@@ -1217,7 +1275,68 @@ public class PreferencesUtil implements IPreferenceKeys {
 
     }
 
-
+    /**
+    *
+    */
+   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());
+
+   }
 
 
 
index 763df43c1049d6f1b1bc47c881a54befdae76999..aaa131f6cee324af92d034cf3b219731e7fc74e6 100644 (file)
@@ -10,9 +10,20 @@ package eu.etaxonomy.taxeditor.preference;
 
 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
@@ -20,22 +31,67 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
  */
 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()));
+
+
+        }
+
     }
 
 
index ba1cde56afd6e67309b3c03560e7259660caaa9e..c90645912fdf4752a46344317848d47d8ac482f3 100644 (file)
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.preference.matching;
 
 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;
index c83cc5e939a6aff0a2864ab523b96c76f132930b..d396d7592cbe3b1e1c47b9661f8254ecbdbef20b 100644 (file)
@@ -39,7 +39,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 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;
@@ -181,7 +181,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
 
                                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 {
@@ -199,7 +199,7 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                                                        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(),
index 73e851ba5c7e49f8437a3280e8ccf4628b0a0cc6..a7c16cc654bd4256699436f1316dc2b807621408 100644 (file)
@@ -26,7 +26,7 @@ public class NomenclaturalStatusTypeMenuPreferences extends
         * <p>Constructor for NomenclaturalStatusTypeMenuPreferences.</p>
         */
        public NomenclaturalStatusTypeMenuPreferences() {
-               super("Nomenlcatural Status Type Preferences",
+               super("Nomenclatural Status Type Preferences",
                                "Configure nomenclatural status types",
                                false);
        }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/AppModelId.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/AppModelId.java
new file mode 100644 (file)
index 0000000..0b935d0
--- /dev/null
@@ -0,0 +1,127 @@
+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
index 172af4405da52f83c7eb6db90a00a255b119d6df..13ca2c371256305a24c28e8243c133d2c6665e8d 100644 (file)
@@ -36,6 +36,7 @@ import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 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;
@@ -52,6 +53,7 @@ import eu.etaxonomy.cdm.model.name.TaxonName;
 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;
@@ -643,6 +645,9 @@ public class CdmStore {
             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);
             }
index 8ccbc23517ba5ce8d2ea41193aefb799d80bf259..805ba9b3ce1f595eb1b22aebb99f04f5e9235dc7 100644 (file)
@@ -35,15 +35,12 @@ import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
 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;
 
 
 /**
@@ -114,10 +111,11 @@ class CdmStoreConnector extends Job {
                 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)){
index 6df774bfa7ff10d66e23091447c3bb3168b6005c..f42bfb51f57a789929e52cc51f9c32f1366399e2 100644 (file)
@@ -28,7 +28,6 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 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;
 
@@ -60,13 +59,6 @@ public class LoginManager extends Observable implements IConversationEnabled, IC
         * @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) {
index f38ef3aa9bc696c0cc562f8e963cd87e2a5f70a2..3f0de0796b57a3a4891152696e4956684016483f 100644 (file)
@@ -14,8 +14,8 @@ import java.util.UUID;
 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;
@@ -87,6 +87,19 @@ public class StoreUtil extends AbstractUtility {
                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>
@@ -106,15 +119,4 @@ public class StoreUtil extends AbstractUtility {
                return TaxeditorStorePlugin.PLUGIN_ID;
        }
 
-       /**
-        *
-        * @return
-        */
-       public static IEditorInput getActiveEditorInput() {
-               IEditorPart activeEditor = getActiveEditor();
-               if (activeEditor != null){
-                       return activeEditor.getEditorInput();
-               }
-               return null;
-       }
 }
index 2005e46856acf7cef35b584f649739e090baf414..04dd2513e80e39e156e9212eea4aa4dfd7b32ab4 100644 (file)
@@ -11,27 +11,22 @@ package eu.etaxonomy.taxeditor.store;
 
 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";
@@ -40,10 +35,7 @@ public class TermManager extends ContextListenerAdapter{
        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);
        }
 
        /**
@@ -73,57 +65,6 @@ public class TermManager extends ContextListenerAdapter{
                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
         *
@@ -134,23 +75,17 @@ public class TermManager extends ContextListenerAdapter{
 
                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);
                        }
                }
@@ -158,6 +93,11 @@ public class TermManager extends ContextListenerAdapter{
                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;
@@ -175,202 +115,6 @@ public class TermManager extends ContextListenerAdapter{
            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
         *
@@ -379,16 +123,19 @@ public class TermManager extends ContextListenerAdapter{
         * @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);
+
+               }
        }
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/EditViewerDropAdapter.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/EditViewerDropAdapter.java
new file mode 100644 (file)
index 0000000..93f148f
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+* 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);
+    }
+
+}
index 130a0994e421ea531e6d417e20f2b73a337b0d91..63225cefd78a0cb59f7f5a74533dde40a14a16e5 100644 (file)
@@ -8,14 +8,13 @@
 */
 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;
 
@@ -45,7 +44,7 @@ DisposeListener {
 
     protected Label label;
 
-    protected final Combo combo;
+    protected final CCombo combo;
 
 
     public AbstractComboElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
@@ -55,13 +54,16 @@ DisposeListener {
         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} */
@@ -83,10 +85,6 @@ DisposeListener {
         if (label != null) {
             label.setBackground(color);
         }
-        colorId = !irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT
-                : Resources.COLOR_COMPOSITE_BACKGROUND;
-        color = AbstractUtility.getColor(colorId);
-        combo.setForeground(color);
 
     }
 
index 8f0d39a2d15e537343e20b58d539de73e3ab2980..e90bca0492fb602e45782635a6b5ed7efc99436a 100644 (file)
@@ -49,9 +49,9 @@ public class TermComboElement<T extends DefinedTermBase>
        public void setTermComparator(Comparator<T> termComparator) {
                this.termComparator = termComparator;
                List<T> termsWithoutNull = terms.subList(1, terms.size());
-               
+
                populateTerms(termsWithoutNull);
-               
+
        }
 
        private final TermType termType;
@@ -209,11 +209,12 @@ public class TermComboElement<T extends DefinedTermBase>
                        }
                }
 
-               if (selection != null && index == 0) {
+        if (selection != null && index == 0) {
                        createTermNotInPreferredTerms(selection);
                }
 
                combo.select(index);
+
        }
 
        protected List<T> getPreferredTerms(){
index 41692b1b125464173159dec1960aad3cd38887f9..acda0523cf46d51d36d57751c36c8e1a44563847 100644 (file)
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.jobs.Job;
 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;
@@ -529,17 +530,22 @@ public class RemotingLoginDialog extends Dialog implements ICDMServerError {
 
 
     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() {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/PublishSubTreeConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/PublishSubTreeConfiguratorWizardPage.java
new file mode 100755 (executable)
index 0000000..7fc39ba
--- /dev/null
@@ -0,0 +1,205 @@
+// $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
+
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetPublishForSubtreeWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/SetPublishForSubtreeWizard.java
new file mode 100755 (executable)
index 0000000..67c26b2
--- /dev/null
@@ -0,0 +1,72 @@
+// $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);
+    }
+
+
+
+}
index 456b066d1b69c97068af58aae32788dd4e4ca699..b1b77ef85d16b48eb56f71e44a38a8572df02df8 100755 (executable)
@@ -12,7 +12,6 @@ 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.Wizard;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
@@ -26,7 +25,7 @@ import org.eclipse.swt.widgets.Listener;
 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;
@@ -42,10 +41,10 @@ public class SetSecundumConfiguratorWizardPage extends WizardPage implements Lis
     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;
@@ -62,11 +61,12 @@ public class SetSecundumConfiguratorWizardPage extends WizardPage implements Lis
      * @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) {
@@ -130,7 +130,7 @@ public class SetSecundumConfiguratorWizardPage extends WizardPage implements Lis
 
         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));
 
@@ -142,21 +142,21 @@ public class SetSecundumConfiguratorWizardPage extends WizardPage implements Lis
         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);
@@ -188,7 +188,7 @@ public class SetSecundumConfiguratorWizardPage extends WizardPage implements Lis
         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;
index a8186ca2a144ba2824c545b2cecb2e6731674392..254a5023175f974a5ec1110f70be6f9233c87071 100755 (executable)
@@ -9,11 +9,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
@@ -23,7 +22,7 @@ import eu.etaxonomy.cdm.model.reference.Reference;
 public class SetSecundumForSubtreeConfigurationWizard extends Wizard {
 
     Reference newSecRef;
-    private final SetSecundumForSubtreeConfigurator configurator;
+    private final SecundumForSubtreeConfigurator configurator;
 
 
     private SetSecundumConfiguratorWizardPage page;
@@ -40,11 +39,12 @@ public class SetSecundumForSubtreeConfigurationWizard extends Wizard {
      * @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);
 
 
 
@@ -52,20 +52,8 @@ public class SetSecundumForSubtreeConfigurationWizard extends Wizard {
 
 
 
-    /**
-     * @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);
 
 
-    }
-
 
 
 
@@ -88,7 +76,7 @@ public class SetSecundumForSubtreeConfigurationWizard extends Wizard {
     /** {@inheritDoc} */
     @Override
     public void addPages() {
-        page = new SetSecundumConfiguratorWizardPage(configurator, this, SWT.NONE);
+        page = new SetSecundumConfiguratorWizardPage(configurator);
         addPage(page);
     }
 
index fb46d4fa2361e62e8d020c8412a483db84874963..51923f3e20ea13fa5f271eb2e304e13e578f8aa5 100644 (file)
@@ -14,7 +14,6 @@ import org.eclipse.jface.util.PropertyChangeEvent;
 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;
@@ -294,18 +293,6 @@ public abstract class AbstractCdmFormElement implements ICdmFormElement {
                }
        }
 
-       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
index 1550fce58e7324ddb9f4580cc7ec6c6c8e5a719d..026b527bbf0720c1d9d6bcda70ffee9fe727a8ad 100644 (file)
@@ -573,14 +573,14 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
         */
        @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){
index 1f594092679b77704a1b4fd71e7e6a5823bccab4..55668cb9ac56316dec09271ee99b773d2c872638 100644 (file)
@@ -4,7 +4,6 @@
 package eu.etaxonomy.taxeditor.ui.element;
 
 import java.net.URI;
-
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -12,7 +11,9 @@ import java.util.List;
 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;
@@ -36,7 +37,6 @@ import org.eclipse.swt.widgets.Control;
 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;
@@ -44,8 +44,6 @@ import org.eclipse.ui.forms.widgets.Section;
 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;
 
@@ -55,7 +53,6 @@ import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 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;
@@ -122,7 +119,6 @@ import eu.etaxonomy.taxeditor.ui.combo.VocabularyComboElement;
 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;
@@ -361,6 +357,9 @@ public class CdmFormFactory extends FormToolkit {
     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>();
@@ -412,44 +411,26 @@ public class CdmFormFactory extends FormToolkit {
         }
     }
 
-    /**
-     * <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
      *
@@ -518,7 +499,7 @@ public class CdmFormFactory extends FormToolkit {
     @Override
     public void adapt(Composite composite) {
         composite.addMouseListener(selectionMouseHandler);
-       
+
         super.adapt(composite);
     }
 
@@ -925,7 +906,7 @@ public class CdmFormFactory extends FormToolkit {
             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);
     }
@@ -939,12 +920,12 @@ public class CdmFormFactory extends FormToolkit {
                        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);
        }
@@ -992,9 +973,6 @@ public class CdmFormFactory extends FormToolkit {
                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;
@@ -2146,7 +2124,7 @@ public class CdmFormFactory extends FormToolkit {
         addAndAdaptElement(parentElement, element);
         return element;
     }
-  
+
     public NameDetailElement createNameDetailElement(ICdmFormElement parentElement, int style){
         NameDetailElement element = new NameDetailElement(this, parentElement, style);
         addAndAdaptElement(parentElement, element);
@@ -2912,10 +2890,10 @@ public class CdmFormFactory extends FormToolkit {
 //        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);
@@ -2965,7 +2943,7 @@ public class CdmFormFactory extends FormToolkit {
         } 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) {
@@ -3029,7 +3007,7 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-       
+
        public TaxonOfRelationshipElement createTaxonOfRelationshipDetailElement(
                        ICdmFormElement parentElement, int style) {
                TaxonOfRelationshipElement section = new TaxonOfRelationshipElement(this, parentElement, style);
@@ -3054,7 +3032,7 @@ public class CdmFormFactory extends FormToolkit {
 //             return element;
 //     }
 
-       
+
 
 
 
index 74a445c2ec5160309877d50384a1aae7f8e81a0c..baaf47c29bd3aba10f091864e080198cf1e6161b 100644 (file)
@@ -1,11 +1,11 @@
 /**
-* 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;
 
@@ -33,8 +33,8 @@ import org.eclipse.swt.widgets.Event;
 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;
@@ -46,25 +46,34 @@ 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
@@ -72,143 +81,143 @@ public class ImageElement extends AbstractCdmFormElement implements PaintListene
         }
     };
 
-       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();
+    }
 
 }
index 850c8b4f44f603fd0d3b49ad93b8f63ce3b3a047..74485aa093925894c1d19bad4b60c3c060b55f09 100644 (file)
@@ -1,24 +1,27 @@
 /**
 * 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;
@@ -26,15 +29,11 @@ import org.eclipse.swt.widgets.Label;
 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
  *
@@ -44,40 +43,41 @@ public class CdmAuthorityComposite extends Composite {
 
        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
@@ -96,42 +96,43 @@ public class CdmAuthorityComposite extends Composite {
                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();
        }
 }
index 030e350e343cae06dea84c9c5f4a7e7a7fffbfce..75a7b718bb090b8f6ae66131acd6cd08bccd5586 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -19,7 +19,6 @@ import org.eclipse.jface.viewers.ContentViewer;
 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;
@@ -36,7 +35,7 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
  * Viewer class for the {@link CdmAuthorityComposite} used in the editing of CDM Authorities.
- * 
+ *
  * @author cmathew
  * @created Mar 28, 2013
  *
@@ -45,8 +44,8 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 //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;
@@ -56,27 +55,27 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
        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);
@@ -88,64 +87,64 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
 
        /**
         * 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;
                }
@@ -153,46 +152,46 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
                //        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
@@ -212,21 +211,21 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
                }
                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
@@ -235,17 +234,17 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
                newCdmAuthorities.clear();
        }
 
-       
+
        /**
-        * 
-        * 
+        *
+        *
         */
        public void save() {
-               clearNewCdmAuthorities();               
+               clearNewCdmAuthorities();
                refresh();
-               
-       }       
-       
+
+       }
+
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.Viewer#getControl()
         */
@@ -270,7 +269,7 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
        public void refresh() {
                updateAuthorities();
                cdmAuthorityComposite.refresh();
-               
+
        }
 
        /* (non-Javadoc)
@@ -279,6 +278,6 @@ public class CdmAuthorityCompositeViewer extends ContentViewer {
        @Override
        public void setSelection(ISelection selection, boolean reveal) {
                // TODO Auto-generated method stub
-               
+
        }
 }
index 0c2ba37276a6a37d77c486136113375d4037a0ff..608be8118652e48576d63afb74700b6b61d41188 100644 (file)
@@ -54,7 +54,7 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
        private boolean irrelevant;
 
        private boolean enabled;
-       
+
        private LabelElement warnForReferencedObjects;
 
        private EnumSet<CRUD> requiredCrud = null;
@@ -105,7 +105,7 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
        protected void updateContent() {
                removeElements();
                createControls(this, entity, SWT.WRAP);
-               reflowParentScrolledForm(true);
+               StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
 
                updateControlStates();
        }
@@ -249,7 +249,7 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
                if (getParentElement() instanceof AbstractCdmDetailSection) {
                        ((AbstractCdmDetailSection) getParentElement()).updateTitle();
                }
-               reflowParentScrolledForm(true);
+               StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
        }
 
        /**
@@ -310,19 +310,19 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
        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));
-                               
+
                        }
                }
            }
@@ -333,5 +333,5 @@ public abstract class AbstractCdmDetailElement<T> extends AbstractCdmFormElement
                        getWarnForReferencedObjects().setVisible(isVisible);
                }
        }
-       
+
 }
index fa7c17f3a28b82eb411066984a1e62424b937a65..aff83e4aaa2310d656471eed90db11011a4a2df9 100644 (file)
@@ -1,24 +1,26 @@
 /**
-* 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;
 /**
@@ -35,100 +37,86 @@ INewWizard, IConversationEnabled{
 
     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) {}
 
 }
index 5434c984a18c7adf6ad5c0567d08507329209199..55e7c2a219d2f22f56f85a347c23a8b31e736393 100644 (file)
@@ -9,8 +9,11 @@
 
 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;
@@ -40,10 +43,18 @@ public class CloneClassificationWizard extends Wizard{
 
     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);
     }
index 01c6ef29689d846234eee2a22a207383fe0781be..5b3ceb86777ec31860d5d09f83053f73e6586035 100644 (file)
@@ -9,7 +9,10 @@
 
 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;
@@ -19,6 +22,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 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;
@@ -27,6 +31,7 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 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>
@@ -62,7 +67,7 @@ public class DescriptionElementDetailSection extends
 
                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()
                         */
@@ -71,10 +76,11 @@ public class DescriptionElementDetailSection extends
                                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));
                                }
                        }
                };
index 438e00e19747fa4b79b12c1a32aa22bf7c1dc2d2..cd7d66212d8b59d54ec89f29fa040afffe4882bf 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -16,15 +16,16 @@ 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.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;
@@ -38,7 +39,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  * @version 1.0
  */
 public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<TaxonDescription> {
-       
+
 
        private static final Logger logger = Logger
                        .getLogger(NaturalLanguageDetailElement.class);
@@ -54,13 +55,13 @@ public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<Taxon
                        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();
@@ -68,7 +69,7 @@ public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<Taxon
                        label.setText("Taxon Description does not contain structured data.");
                }
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
         */
@@ -77,28 +78,28 @@ public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<Taxon
        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()) + " ";
                                        }
@@ -109,21 +110,21 @@ public class NaturalLanguageDetailElement extends AbstractCdmDetailElement<Taxon
                        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;
                }
-               
+
        }
 }
index f44a4b56a7bbd4973c1acc478bef3e99f4ba22e5..b19959a322405169806f9d907a9f19f93d623d7f 100644 (file)
@@ -29,6 +29,7 @@ public class DistributionDetailElement extends
 
        private EntitySelectionElement<NamedArea> selection_namedArea;
        private TermComboElement<PresenceAbsenceTerm> combo_presenceAbsence;
+       private boolean namedAreaEditable = true;
 
 
        /**
@@ -42,6 +43,7 @@ public class DistributionDetailElement extends
        public DistributionDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement, Distribution entity, int style) {
                super(formFactory, formElement, entity, style);
+
        }
 
        /** {@inheritDoc} */
@@ -51,6 +53,8 @@ public class DistributionDetailElement extends
                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);
 
        }
index 7dcff5f0a3c4523456fa0c192979c7f33b945879..536dbafc282139a9db72d8acb10307c2fcada1bd 100644 (file)
@@ -50,7 +50,7 @@ public class IndividualsAssociationDetailElement extends
                                                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) {
index ada00347b3ed7420b12f6b0ce8b9530b74f1e841..9c6a099023e6aa1465db6a7cb710a72663739347 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 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;
@@ -29,6 +30,7 @@ import eu.etaxonomy.cdm.model.description.TaxonInteraction;
 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>
@@ -41,7 +43,8 @@ public class ChangeDescriptionElementType extends AbstractPostTaxonOperation {
 
        private DescriptionElementBase sourceElement;
        private DescriptionElementBase destinationElement;
-       
+       private Viewer viewer;
+
        /**
         * <p>Constructor for ChangeDescriptionElementType.</p>
         *
@@ -50,10 +53,13 @@ public class ChangeDescriptionElementType extends AbstractPostTaxonOperation {
         * @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)
@@ -65,7 +71,7 @@ public class ChangeDescriptionElementType extends AbstractPostTaxonOperation {
                        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
@@ -100,6 +106,8 @@ public class ChangeDescriptionElementType extends AbstractPostTaxonOperation {
                destinationElement.setFeature(feature);
                inDescription.addElement(destinationElement);
                inDescription.removeElement(sourceElement);
+
+        viewer.setInput(destinationElement);
                return postExecute(destinationElement);
        }
 
index c20d4549cf95954e91a6615f384d8b10ddd3a200..00aec6f1095d69bd92450dbe39b3898875605a78 100644 (file)
@@ -9,7 +9,9 @@ import eu.etaxonomy.cdm.api.service.IAgentService;
 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;
@@ -18,10 +20,10 @@ import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
 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 {
@@ -30,8 +32,8 @@ public class GrantedAuthorityLabelTextProvider {
                        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")){
@@ -42,20 +44,20 @@ public class GrantedAuthorityLabelTextProvider {
                }
                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){
@@ -91,7 +93,7 @@ public class GrantedAuthorityLabelTextProvider {
                                        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:
@@ -100,16 +102,24 @@ public class GrantedAuthorityLabelTextProvider {
                                        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;
        }
-       
+
 
 }
index bd6a26c40648075f808adc1daea574d890a651dd..e6a64cf73da8293d72d21e6ed390596af1f85260 100644 (file)
@@ -27,6 +27,7 @@ import eu.etaxonomy.cdm.model.media.MediaUtils;
 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;
@@ -144,7 +145,7 @@ public class MediaDetailElement extends AbstractCdmDetailElement<Media>{
         }
         isAdvancedMediaView = !isAdvancedMediaView;
         showAdvancedView();
-        reflowParentScrolledForm(true);
+        StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
     }
 
     private void showAdvancedView() {
index afef19ac4e9a0e31b245f59174204824ca53ced3..636e757fcc77645036c898bf4499cbb86a02ca32 100644 (file)
@@ -12,10 +12,10 @@ package eu.etaxonomy.taxeditor.ui.section.name;
 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;
index e9ea6c22d589468c21ddc5e6fdcee4123814ddf1..13c0fe786443ff053296064ad6f8870933c5f83c 100644 (file)
@@ -14,7 +14,6 @@ import java.util.Arrays;
 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;
@@ -34,7 +33,7 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement
  * @author n.hoffmann
  * @created May 20, 2010
  */
-public class NonViralNameDetailElement 
+public class NonViralNameDetailElement
                extends AbstractIdentifiableEntityDetailElement<TaxonName>  {
 
        private NameDetailSection section_name;
@@ -66,7 +65,7 @@ public class NonViralNameDetailElement
                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)){
@@ -87,7 +86,7 @@ public class NonViralNameDetailElement
                        textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
 
                }
-               
+
 
         }
 
@@ -96,12 +95,12 @@ public class NonViralNameDetailElement
            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);
@@ -123,7 +122,7 @@ public class NonViralNameDetailElement
 //             if(combo_nomenclaturalCode!=null){
 //                 combo_nomenclaturalCode.setEnabled(false);
 //             }
-               
+
                if(toggleable_cache!=null){
                    toggleable_cache.setEnabled(getEntity().isProtectedTitleCache() || getEntity().isProtectedFullTitleCache());
                    setIrrelevant(toggleable_cache.getState(),
@@ -191,7 +190,7 @@ public class NonViralNameDetailElement
                        boolean change = checkForDeletableParts(combo_nomenclaturalCode.getSelection());
                        if (change){
                                getEntity().setNameType(combo_nomenclaturalCode.getSelection());
-                               
+
                                this.updateContent();
                                section_hybrid.setEntity(getEntity());
                                section_author.setEntity(getEntity());
@@ -219,7 +218,7 @@ public class NonViralNameDetailElement
                        }else {
                                return true;
                        }
-                       
+
                }
                if (actualCode.equals(NomenclaturalCode.ICNB)){
                        if (getEntity().getNameApprobation() != null || getEntity().getSubGenusAuthorship() != null){
@@ -231,7 +230,7 @@ public class NonViralNameDetailElement
                        }else{
                                return true;
                        }
-                       
+
                }
                if (actualCode.equals(NomenclaturalCode.Fungi)){
                        if (getEntity().isAnamorphic() ){
@@ -252,7 +251,7 @@ public class NonViralNameDetailElement
                        }else{
                                return true;
                        }
-                       
+
                }
                if (actualCode.equals(NomenclaturalCode.ICNAFP)){
                        return true;
index 636add03749a1b06aa92ca4fa951e8a85c81a767..bcee75a263a1ff84a2b26186e093ff9a93c1fbc4 100644 (file)
@@ -12,7 +12,6 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence;
 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;
@@ -48,7 +47,7 @@ public abstract class AbstractDeterminationEventDetailSection extends
        @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{
index 60133290f0da9e4f8036f16dbd0744e35193209d..e0f929ab8f287ee66df231c31d9a4d45d5cc503a 100644 (file)
@@ -25,7 +25,6 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 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;
 
 /**
@@ -57,7 +56,7 @@ public class DerivedUnitBaseDetailElement extends
        private SourceCollectionDetailSection section_source;
 
     private OriginalLabelDataElement textOriginalLabel;
-    
+
 
 
        /**
@@ -116,13 +115,14 @@ public class DerivedUnitBaseDetailElement extends
 
                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} */
index f82791fe672487120baf500c8fa9b97122ea0f06..5834ea5f10e7eb078e1988b3f17a6bc856b8f681 100644 (file)
@@ -17,7 +17,6 @@ import eu.etaxonomy.cdm.model.common.LanguageString;
 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;
@@ -88,7 +87,7 @@ public class DerivedUnitGeneralDetailElement extends
                            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);
index 4b383cbb4a88416aebf2f73b3c00f32e4caf73c9..7971265ea8093074b7907e37d7d974bcb87d54a3 100644 (file)
 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>
@@ -38,7 +33,7 @@ public class FieldUnitDetailElement extends AbstractSpecimenOrObservationDetailE
        private TextWithLabelElement text_fieldObjectDefinition;
 
        private TextWithLabelElement text_fieldNotes;
-       
+
        private TextWithLabelElement text_lifeForm;
 
        private NumberWithLabelElement number_individualCount;
@@ -69,10 +64,10 @@ public class FieldUnitDetailElement extends AbstractSpecimenOrObservationDetailE
                // 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);
        }
@@ -99,6 +94,6 @@ public class FieldUnitDetailElement extends AbstractSpecimenOrObservationDetailE
                else if(eventSource == number_individualCount){
                        getEntity().setIndividualCount(number_individualCount.getInteger());
                }
-               
+
        }
 }
index 1c1157036ea49f54a0ce0cdd34f0dfe03408d088..7b4c0ab497f96170b3622a7d4250c7b96ff5a7ba 100644 (file)
@@ -15,7 +15,6 @@ import eu.etaxonomy.cdm.model.agent.AgentBase;
 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;
@@ -77,7 +76,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         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);
index 0df102dbae60c6336931ebed2f6da095bacec9da..ceb90ac2ea3b9fcf64c07fd9731874b1a94b10ac 100644 (file)
@@ -12,7 +12,6 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence;
 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;
@@ -79,7 +78,7 @@ public class GatheringEventDetailElement extends
                                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);
index 7c40663b4adbbca88521747ee30f223c6fd95eff..3a6f614376767c144a4790928e3fddd24c365107 100644 (file)
@@ -10,6 +10,7 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.association;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -66,7 +67,9 @@ public class DerivedUnitTypeDesignationSection extends AbstractEntityCollectionS
         }
         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);
             }
index d34f3a939b7eac17d4b010ebda9abc59d705be1e..c8cf893e1bcf61323ab9cadc64718d271c7405bc 100644 (file)
@@ -9,6 +9,7 @@
 
 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;
@@ -69,7 +70,7 @@ public class ReferenceDetailSection extends AbstractCdmDetailSection<Reference>
        @Override
        public void refresh() {
                super.refresh();
-               AbstractUtility.refreshDetailsViewer();
+               AbstractUtility.refreshDetailsViewer(formFactory.getContext().get(EPartService.class));
        }
 
        @Override
index 5461f83acc2566535824a81b7cf3dd6435ccbb8f..f260902cbd0c6c07c6533304a1616b430cf8b9b0 100644 (file)
@@ -19,8 +19,6 @@ import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.SynonymType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.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;
@@ -37,7 +35,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  * @version 1.0
  */
 public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElement<TaxonBase> {
-       
+
        private CheckboxElement checkbox_doubtful;
 
        private CheckboxElement checkbox_useNameCache;
@@ -66,7 +64,7 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                                        "Title Cache", entity.getTitleCache(),
                                        entity.isProtectedTitleCache(), style);
 
-               
+
                text_appendedPhrase = formFactory.createTextWithLabelElement(
                                        formElement, "Appended Phrase", entity.getAppendedPhrase(),
                                        SWT.WRAP);
@@ -90,10 +88,10 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                                        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
index aa5fda94da8b380345391635aed531ddf81d5070..625b431c513f526f84bcfcf6105136fe8861e020 100644 (file)
@@ -10,14 +10,13 @@ package eu.etaxonomy.taxeditor.ui.section.taxon;
 
 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;
@@ -49,17 +48,14 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
        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
@@ -78,6 +74,15 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                        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);
@@ -93,11 +98,6 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                                        taxon.getSecMicroReference(),null,
                                        SWT.WRAP);
 
-
-
-
-
-
                        secReference = formFactory.createSelectionElement(Reference.class,
                                        getConversationHolder(), formElement, "Misappl. Sec.",
                                        entity.getCitation(), EntitySelectionElement.ALL,
@@ -107,9 +107,7 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                            formElement, "Detail",
                            entity.getCitationMicroReference(),null,
                            SWT.WRAP);
-
                }
-
        }
 
        private Taxon getRelatedTaxon() {
@@ -121,11 +119,7 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
        }
 
        private Taxon getSourceTaxon(){
-               IEditorInput editorInput = StoreUtil.getActiveEditorInput();
-               if(editorInput!=null){
-                   return editorInput.getAdapter(Taxon.class);
-               }
-               return null;
+               return EventUtility.getCurrentTaxon();
        }
 
        @Override
@@ -156,9 +150,6 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
 
-
-
-
         @Override
            protected void updateControlStates() {
                super.updateControlStates();
index ca27ca98c1e9a687eac9d78cb1c1df1d4d83e2c0..0d09578eba5e3c3cd53a207b25bd147474490cd0 100644 (file)
@@ -96,8 +96,8 @@ public class TaxonRelationshipDetailSection extends AbstractCdmDetailSection<Tax
                             TaxonRelationship rel = getEntity();
                             rel.setFromTaxon(taxon);
                             setEntity(rel);
-                            //                                 taxonBase.getTitleCache();
-                            
+                            setTaxonBase(taxon);
+                           
                             firePropertyChangeEvent(TaxonRelationshipDetailSection.this);
                            }
                        }
index df25eea9dea6d9305cab20be81ab128a20cdb7e7..500c9482ad802e65a2c40fb364271f44f7bb1d22 100644 (file)
@@ -13,7 +13,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
 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;
@@ -76,7 +75,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements IConversat
                        formFactory.dispose();
                        formFactory = null;
                }
-               formFactory = new CdmFormFactory(Display.getCurrent(), this);
+//             formFactory = new CdmFormFactory(Display.getCurrent(), this);
        }
 
        protected void markViewPartDirty(){
@@ -99,7 +98,7 @@ public abstract class AbstractCdmDataViewer extends Viewer implements IConversat
 
                return body;
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setInput(Object input) {
index 9afbdeadbb145ce32d4eee3aedf4b06e2daaec33..9f941b16a8ce3a69232c0b3bf8bd9cc83a9d26b0 100644 (file)
@@ -7,11 +7,8 @@ import org.eclipse.jface.viewers.ISelection;
 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;
 
@@ -120,16 +117,16 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart impl
         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}
@@ -145,10 +142,10 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart impl
     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);
+//        }
     }
 
     /**
@@ -167,10 +164,10 @@ public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart impl
             ((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);
+//            }
         }
     }
 
index 978859801b0b5929c1ebf2002f3627ac035f0aeb..ac6544ddc65f42d6980fbafc3110dd1b3e9bea5e 100644 (file)
@@ -30,7 +30,6 @@ 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.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
@@ -75,7 +74,7 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
     }
 
     private void setInitialSelection() {
-        selectionChanged(AbstractUtility.getActiveWorkbenchPart(), getInitialSelection());
+//        selectionChanged(AbstractUtility.getActiveWorkbenchPart(), getInitialSelection());
     }
 
     /**
index 3515efb745e921f55838358f7fafbd52cb99df68..7fc842dfbc7268db923de25cea4f2cad28a7c243 100644 (file)
@@ -80,22 +80,6 @@ public class BioCaseEditorInput extends DataImportEditorInput<SpecimenOrObservat
         });
     }
 
-    /* (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()
      */
index 56feee5c1ffd250fb98016e4365b96dec5997c62..92a0403a85cfcb9761b6f0ee66b1a040712edb17 100644 (file)
@@ -42,7 +42,7 @@ public class DataImportEditorContextMenu extends CompoundContributionItem {
                     @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;
index 40b3121c92896a3eef6ba7d4e37958e46306f18e..bd45ac44f1623641bd43ee035a557cb34dbd50a9 100644 (file)
@@ -11,9 +11,6 @@ package eu.etaxonomy.taxeditor.view.dataimport;
 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;
@@ -27,7 +24,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @date 25.02.2014
  *
  */
-public abstract class DataImportEditorInput<T> implements IEditorInput {
+public abstract class DataImportEditorInput<T> {
 
     protected static Logger logger = Logger.getLogger(DataImportEditorInput.class);
 
@@ -41,28 +38,6 @@ public abstract class DataImportEditorInput<T> implements IEditorInput {
         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;
     }
index 2106b1ce3e5313860a7cd9322e3c7aca35305613..330b51c3f649eefea8eba70f68ddbb6a73864df7 100644 (file)
@@ -46,16 +46,6 @@ public class GbifImportEditorInput extends DataImportEditorInput<GbifResponse> {
     }
 
 
-    @Override
-    public String getName() {
-        return "[GBIF] " + query.toString();
-    }
-
-    @Override
-    public String getToolTipText() {
-        return "[GBIF] " + query.toString();
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
index f96c5bf079a975f61c952e12aaf60e6dfa228984..e2ade59ca9d0a7a8b54cbdf354f512d62c0998e3 100644 (file)
@@ -27,15 +27,12 @@ public class SpecimenSearchWizardPage extends WizardPage{
 
     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);
@@ -50,7 +47,7 @@ public class SpecimenSearchWizardPage extends WizardPage{
         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();
index 06eb321ae293999b105a61b02baa4e507149726c..f421b89cf8d7bc0ed005fc9669e48da949016390 100644 (file)
@@ -13,13 +13,10 @@ import java.util.Collection;
 
 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;
@@ -34,12 +31,10 @@ import org.eclipse.swt.widgets.Display;
 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;
 
@@ -55,7 +50,6 @@ import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
 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
@@ -69,9 +63,6 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     protected final Logger logger = Logger.getLogger(DataImportViewE4.class);
 
-    @Inject
-    private Shell shell;
-
     protected Collection<T> results = new ArrayList<T>();
 
     protected boolean updated = false;
@@ -80,7 +71,7 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     private static ConversationHolder conversationHolder;
 
-    private SaveImportedSpecimenAction saveImportedSpecimenAction;
+    private SaveImportedSpecimenActionE4 saveImportedSpecimenAction;
 
     private Text textClassification;
 
@@ -90,6 +81,8 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     private Button toggleButton;
 
+    private Button importButton;
+
     private boolean state;
 
     private Button openConfigurator;
@@ -109,15 +102,13 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
     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();
-        }
     }
 
     /**
@@ -125,32 +116,39 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
      * @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");
@@ -171,54 +169,67 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
             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();
     }
 
     /**
@@ -258,10 +269,12 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
             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;
         }
@@ -283,7 +296,9 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
 
     @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();
@@ -330,7 +345,7 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
     @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());
                }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SaveImportedSpecimenActionE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SaveImportedSpecimenActionE4.java
new file mode 100644 (file)
index 0000000..130f5f4
--- /dev/null
@@ -0,0 +1,210 @@
+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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java
new file mode 100644 (file)
index 0000000..22d5724
--- /dev/null
@@ -0,0 +1,127 @@
+/**
+* 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;
+    }
+
+
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardE4.java
new file mode 100644 (file)
index 0000000..85869de
--- /dev/null
@@ -0,0 +1,194 @@
+/**
+* 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;
+        }
+
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java
new file mode 100644 (file)
index 0000000..2040fe4
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+* 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;
+    }
+
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/handler/OpenSpecimenImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/handler/OpenSpecimenImportWizard.java
new file mode 100644 (file)
index 0000000..29d386a
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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();
+    }
+}
index 03ac5d3f236b18ec433e632a19088f8644425a07..c6cbe843c18389c78a8d706dd73dd97e08e90263 100644 (file)
@@ -27,21 +27,21 @@ import eu.etaxonomy.taxeditor.view.datasource.e4.CdmDataSourceViewPartE4;
  * @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();
         }
index 85e3ca3d1bf85ce2c93bac59bddf0ca3b86be6b0..26e8177de0b40ee7c4e62a99cd46f79a3368edaf 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -16,8 +16,6 @@ import org.eclipse.jface.viewers.ISelection;
 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;
 
 /**
@@ -31,16 +29,19 @@ abstract class AbstractDataSourceHandler extends AbstractHandler {
         * @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>
         *
@@ -52,7 +53,7 @@ abstract class AbstractDataSourceHandler extends AbstractHandler {
                CdmMetaDataAwareDataSourceContainer container = (CdmMetaDataAwareDataSourceContainer) ((StructuredSelection) menuSelection).getFirstElement();
                return container;
        }
-       
+
        /**
         * <p>specificExecute</p>
         *
index 5fea830dc85d928f305b5cde1444570af54322f5..8830cecc602e494f1d375091fbea1416abb84f19 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -18,8 +18,6 @@ import org.eclipse.ui.handlers.HandlerUtil;
 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;
 
 /**
@@ -44,12 +42,12 @@ public class CloneDataSourceHandler extends AbstractDataSourceHandler {
                        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);
+//
+//                             }
                        }
                }
 
index d1be275cae1ebc1d2359538b3ca4dc3fceb6924f..9221164c214cf4159a6c93e6d71b42921891c8ef 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -18,8 +18,6 @@ import org.eclipse.ui.handlers.HandlerUtil;
 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;
 
 /**
@@ -47,12 +45,12 @@ public class EditDataSourceHandler extends AbstractDataSourceHandler {
                        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);
+//
+//                             }
                        }
                }
 
index 99d5c5d0cda9de6cbfb60442af96ab5c035b6aed..810fae13adb00d3e98485e31a17014bc7346b089 100644 (file)
@@ -12,7 +12,6 @@ package eu.etaxonomy.taxeditor.view.datasource.handler;
 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;
@@ -20,15 +19,6 @@ import org.eclipse.swt.widgets.Display;
 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;
 
 /**
@@ -58,37 +48,37 @@ public class UpdateDataSourceHandler extends AbstractDataSourceHandler {
 
                        @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;
                        }
index 596d7f9da133377ba3564067b73159094f1c3605..7628604edd59fb1c5125efd56da92f6bd0a89f88 100644 (file)
@@ -42,6 +42,9 @@ import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
 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;
 
 /**
@@ -112,6 +115,11 @@ public class CdmSectionPart<T> extends SectionPart implements
                            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());
index 4e472e4a40dd4f47ac2e25d0a67b7ff1cfca73ee..6390e8f56e6b75633592403c33c448d162ed73c6 100644 (file)
@@ -57,7 +57,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
        public static String ID = "eu.etaxonomy.taxeditor.view.detail"; //$NON-NLS-1$
 
        private DetailsViewer viewer;
-       
+
        private CdmBase lastObject;
        private Object lastPart;
 
@@ -76,7 +76,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
            if(wrappedPart!=null){
                partObject = wrappedPart;
            }
-           if(AbstractUtility.getActiveE4Editor() == null && !(AbstractUtility.getActiveE4Part() instanceof IConversationEnabled)){
+           if(AbstractUtility.getActiveEditor() == null && !(AbstractUtility.getActivePart() instanceof IConversationEnabled)){
             showEmptyPage();
             return;
         }
@@ -85,7 +85,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
            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();
@@ -163,7 +163,7 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
        @Override
        public void showEmptyPage() {
            viewer.setSelection(null);
-           
+
            super.showEmptyPage();
        }
 
@@ -234,13 +234,13 @@ public class DetailsViewPart extends AbstractCdmEditorViewPart implements IPartC
     }
     @Override
     public void showViewer(Object part, IStructuredSelection selection){
-       
-       
-       
+
+
+
        this.part = part;
 
         Object element = selection.getFirstElement();
-        
+
 //        if (part == lastPart && element == lastObject ){
 //             getViewer().setInput(element);
 //             return;
index 0f013376067e91ee6729739b2aa3de203fbffc1e..efe1b92f1816e3d68844dff9d46fa241f9abb225 100755 (executable)
@@ -67,7 +67,6 @@ import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSec
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
-
 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
@@ -142,7 +141,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
     @Override
     public void setInput(Object input) {
-       
+
         if(input instanceof TreeNode){
             input = ((TreeNode) input).getValue();
         }
@@ -190,7 +189,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         // Too much type checking to decide which detail view to display.
         // Need to build in a mechanism where navigators / editors are 'aware'
         // of the corresponding detail viewer.
-       
+
         Object input = getInput();
 
         destroySections();
@@ -324,7 +323,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             createEmptySection(rootElement);
         }
         layout();
-       
+
     }
 
 
@@ -357,14 +356,14 @@ public class DetailsViewer extends AbstractCdmDataViewer {
     /** {@inheritDoc} */
     @Override
     public void setSelection(ISelection selection, boolean reveal) {
-       
+
                this.selection = selection;
-             
+
                if(this.selection!=null){
                    SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
                    fireSelectionChanged(selectionChangedEvent);
                }
-       
+
     }
 
     private void createTaxonSections(RootElement parent) {
@@ -495,9 +494,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         destroySections();
 
         DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-        
+
       //  IntextReferenceSection intextReferenceSection = formFactory.createIntextReferenceSection(getConversationHolder(), parent,  ExpandableComposite.TWISTIE);
-        
+
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
@@ -585,9 +584,9 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
         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);
@@ -596,7 +595,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         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);
@@ -786,7 +785,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
        // 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);
@@ -823,7 +822,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                addPart(nameRelationshipSection);
        //}
 
-        
+
         //}
     }
 
index 87414b3ec3bc3cfa0dbaac58b41fba98f3c92a94..15e34c46dfedda1bd103d0af2f2f442230d0215b 100644 (file)
@@ -9,7 +9,10 @@
 
 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;
@@ -43,17 +46,24 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
 
        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){
@@ -98,18 +108,21 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
                        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;
        }
@@ -119,8 +132,6 @@ public abstract class AbstractCdmDataViewerE4 extends Viewer implements IConvers
        public void setInput(Object input) {
                this.input = input;
                if(input!=null){
-                   // reset selection
-                   setSelection(new StructuredSelection(input));
                    refresh();
                }
        }
index 6db462fc6c44ff2801e0b85cc022dc44d8ac8524..b5228607f2076bb5ede2da922ee3b9fb2ca62640 100644 (file)
@@ -16,28 +16,31 @@ import javax.inject.Named;
 
 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;
 
@@ -97,39 +100,50 @@ public abstract class AbstractCdmEditorPartE4
 
     }
 
-    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) {
@@ -138,12 +152,6 @@ public abstract class AbstractCdmEditorPartE4
             if(part instanceof IDirtyMarkable){
                 ((IDirtyMarkable) part).changed(object);
             }
-            else {
-                IEditorPart editor = AbstractUtility.getActiveEditor();
-                if (editor != null && editor instanceof IDirtyMarkable) {
-                    ((IDirtyMarkable) editor).changed(object);
-                }
-            }
         }
     }
 
@@ -154,35 +162,38 @@ public abstract class AbstractCdmEditorPartE4
     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;
         }
     }
 
@@ -200,6 +211,9 @@ public abstract class AbstractCdmEditorPartE4
             viewer.setInput(null);
         }
         selectionProvidingPart = null;
+        if(thisPart!=null){
+            thisPart.setLabel(getViewName());
+        }
     }
 
     protected IStructuredSelection createSelection(Object selection) {
index 4663a6bd4de955ba659e74930e8cf228413fb372..f3230e6dec22bd34ff4b20d9919c0edbd4c12776 100644 (file)
@@ -12,6 +12,8 @@ package eu.etaxonomy.taxeditor.view.e4.details;
 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;
@@ -38,8 +40,12 @@ public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartConte
     }
 
     @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)));
@@ -75,6 +81,12 @@ public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartConte
                     return;
                 }
             }
+//            if (partObject instanceof IDistributionEditor){
+//
+//                showViewer(structuredSelection, activePart, viewer);
+//                return;
+//
+//            }
             showViewer(structuredSelection, activePart, viewer);
             return;
         }
@@ -87,7 +99,7 @@ public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartConte
     @Override
     protected void showEmptyPage() {
         super.showEmptyPage();
-        if(viewer!=null && !viewer.getControl().isDisposed()){
+        if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
             ((DetailsViewerE4)viewer).destroySections();
         }
     }
index 1d9dd7be9b37fa28dff1414a08e1eef338e49bbb..c900f9bec6c553337e08c0b7c66a00e964204dde 100755 (executable)
@@ -9,13 +9,14 @@
 
 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;
@@ -32,6 +33,7 @@ import eu.etaxonomy.cdm.model.common.User;
 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;
@@ -48,10 +50,10 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.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;
@@ -129,11 +131,18 @@ import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
 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
@@ -154,7 +163,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
                 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){
@@ -237,8 +246,11 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
                 }
             }
-        } 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) {
@@ -307,7 +319,8 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
             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);
@@ -315,8 +328,16 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
             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();
@@ -345,12 +366,12 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     @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);
+        }
 
     }
 
@@ -360,54 +381,54 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         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);
@@ -420,22 +441,23 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         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);
@@ -453,7 +475,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         destroySections();
 
         ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
-                       ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
         addPart(referenceDetailSection);
     }
@@ -479,11 +501,12 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     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);
 
@@ -510,9 +533,9 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
         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,
@@ -526,7 +549,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
         addPart(descriptionDetailSection);
         addPart(naturalLanguageSection);
-//        addPart(describedSpecimenSection);
+        //        addPart(describedSpecimenSection);
         //             addPart(descriptionSourceSection);
         addPart(scopeSection);
     }
@@ -572,7 +595,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
         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);
@@ -583,7 +606,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         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);
@@ -594,7 +617,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         }
         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);
@@ -603,7 +626,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
             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);
@@ -632,7 +655,7 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         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);
@@ -770,54 +793,45 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
 
         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);
@@ -837,9 +851,9 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         addPart(definedTermDetailSection);
     }
 
-       @Override
-       public void update(CdmDataChangeMap arg0) {
+    @Override
+    public void update(CdmDataChangeMap arg0) {
 
-       }
+    }
 
 }
index dfe918bf97a4ee04be6dd92f2b13de82ec1d34f1..8ff3e74ae4100c0183ced85f3d18042783c766d5 100644 (file)
@@ -14,6 +14,8 @@ import java.util.Set;
 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;
@@ -46,8 +48,12 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
     }
 
        @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
@@ -118,7 +124,7 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
     @Override
     protected void showEmptyPage() {
         super.showEmptyPage();
-        if(viewer!=null && !viewer.getControl().isDisposed()){
+        if(viewer!=null && viewer.getControl()!=null && !viewer.getControl().isDisposed()){
             ((SupplementalDataViewerE4)viewer).destroySections();
         }
     }
index fb17acf88199c9b78a9791e1f86bb43b4de3cfc3..9a3c91890dd7da67c2952e9839bfaa74d95207c9 100644 (file)
@@ -11,7 +11,6 @@ package eu.etaxonomy.taxeditor.view.e4.supplementaldata;
 
 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;
@@ -19,7 +18,6 @@ import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 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;
@@ -47,10 +45,6 @@ public class SupplementalDataViewerE4 extends AbstractCdmDataViewerE4 {
 
        private boolean showDebug;
 
-       public SupplementalDataViewerE4(Composite parent, IDirtyMarkable viewPart) {
-               super(parent, viewPart);
-       }
-
        /** {@inheritDoc} */
        @Override
        public ISelection getSelection() {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/InspectSessionHandler.java
new file mode 100644 (file)
index 0000000..c67129e
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+* 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();
+    }
+}
index 368c3ff024acd07a79d471a9a85c407a6f76ee6b..d696de710bc4255135c40494ac94723b80b5ae36 100644 (file)
@@ -14,6 +14,10 @@ import java.util.Collection;
 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;
@@ -29,7 +33,6 @@ import org.eclipse.swt.widgets.Text;
 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;
@@ -61,6 +64,12 @@ public class SessionsViewPart implements ICdmEntitySessionManagerObserver {
     private Text txtCdmModelOnDisk;
     private Text txtDefaultOnDisk;
 
+    @Inject
+    private ECommandService commandService;
+
+    @Inject
+    private EHandlerService handlerService;
+
     @Inject
     public SessionsViewPart() {
         this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager();
@@ -210,7 +219,8 @@ public class SessionsViewPart implements ICdmEntitySessionManagerObserver {
             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));
index 350f7b7fa2629c4a27f10e6a4cad54c5f31ad4d8..76b11620ccd7ab1478022d1cdce125b59f6aa1fb 100644 (file)
@@ -8,8 +8,11 @@
 */
 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;
@@ -19,6 +22,10 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
 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
@@ -32,7 +39,7 @@ public class SpecimenSearchComposite extends Composite {
     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;
@@ -50,7 +57,7 @@ public class SpecimenSearchComposite extends Composite {
             tableWrapLayout.numColumns = 2;
             setLayout(tableWrapLayout);
         }
-
+        CdmFormFactory formFactory = new CdmFormFactory(parent.getDisplay());
         Label lblTaxonName = new Label(this, SWT.NONE);
         lblTaxonName.setText("Taxon Name");
 
@@ -87,8 +94,19 @@ public class SpecimenSearchComposite extends Composite {
         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");
@@ -140,7 +158,7 @@ public class SpecimenSearchComposite extends Composite {
     public Text getTextHerbarium() {
         return textHerbarium;
     }
-    public Text getTextCountry() {
+    public Combo getTextCountry() {
         return textCountry;
     }
     public Text getTextLocality() {
index 120eea4c02faf6ba06e8cd875b2ae6c88fd407e8..1d10cbeafb539c01d9ffa02d627cc950540c76e3 100644 (file)
@@ -92,7 +92,7 @@ public class SpecimenSearchController implements Listener{
     }
 
     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());
     }
 
     /**
@@ -153,8 +153,16 @@ public class SpecimenSearchController implements Listener{
      * @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());
     }
 
index 41174858f9fdf3c9b1970b277e53033fb0c2697e..6295eefb5799a79672ece59dcb1b1999c6283c0c 100644 (file)
@@ -67,7 +67,7 @@ public class SupplementalDataViewPart extends AbstractCdmEditorViewPart {
         if(wrappedPart!=null){
             partObject = wrappedPart;
         }
-               if(AbstractUtility.getActiveE4Editor() == null){
+               if(AbstractUtility.getActiveEditor() == null){
                        showEmptyPage();
                        return;
                }
index 04f6fd4f4f408fdbc2114312038bf7fe614650d1..6217fc5d30f4c096d8371081f4c54a3898e768dc 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: eu.etaxonomy.taxeditor.test
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.test;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: EDIT
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
index f2ce34f5b64f8cf459ec251456e7209e6b67d4a7..f8208fb1cef49063927df934cfb46ff07ad6c560 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index a4beec7e214d9b84bb0fcdf75011566e3e1e545f..d4156d4b240ea61fd3624286b1e5afe2ee8ec8a7 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Webapp
 Bundle-SymbolicName: eu.etaxonomy.taxeditor.webapp;singleton:=true
-Bundle-Version: 4.10.0
+Bundle-Version: 4.11.0
 Require-Bundle: org.eclipse.core.runtime
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
index ccb11da1cb1517a81ef364c59e002acfaf8522b8..741b432517bfd96b9e7f99d6a617d332a8a07958 100644 (file)
@@ -4,7 +4,7 @@
   <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>
index df8c32da9bda932741cfabfd2923a0a3e919893f..7680c14101fde6fe0f439accb20ed297660cdb5f 100644 (file)
@@ -1,10 +1,10 @@
 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,
@@ -16,10 +16,13 @@ Require-Bundle: org.eclipse.ui,
  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"
+
index 8032e432d6aac1a84fa2deec74f69ad48130b334..6de788f932860359b1794d60142567cd2c26538c 100644 (file)
@@ -1,6 +1,6 @@
 <?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">
@@ -74,7 +69,7 @@
       </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"/>
@@ -82,7 +77,7 @@
       </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"/>
index 7600f4a5ba75b8b28b041d518d54693a939efb9f..b9e1e11cc0519fb4c2e76058b0cf674ac951b4b1 100644 (file)
@@ -1,6 +1,8 @@
 <?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"
index 9e1cc6f4a517f8518d083f6f7c8769ec122ec706..2269d2d11724f1e530ff6491ed16793a7c0989fd 100644 (file)
@@ -3,7 +3,7 @@
   <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>
index 11f31313c92072723189749d9134259081b63b7e..ae5a9d57bfd588d2ee0f9e7df71a58656616bab5 100644 (file)
@@ -2,16 +2,20 @@ package eu.etaxonomy.taxeditor.bulkeditor;
 
 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
index 26f2e7dadf39ef799ea4106332fd27a91a0e0d2c..3e8ea8861b0e6f17321d1fd25de9b56f7faef93d 100644 (file)
@@ -6,14 +6,19 @@ import java.util.Map;
 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;
@@ -21,7 +26,14 @@ public class OpenPartHandler {
         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
index b1d6a754d5c9ab3038cbda2754051adc6f906e7a..eec46f63215a3a4512222527dd68691d6d1ab660 100644 (file)
@@ -8,13 +8,14 @@
 */
 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;
@@ -41,24 +42,6 @@ public class WorkbenchUtility {
         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;
     }
 
@@ -67,9 +50,37 @@ public class WorkbenchUtility {
         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;
+    }
 }
diff --git a/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/CollapseHandler.java b/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/CollapseHandler.java
new file mode 100644 (file)
index 0000000..158a47f
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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();
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/ExpandHandler.java b/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/handler/ExpandHandler.java
new file mode 100644 (file)
index 0000000..73a52b2
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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();
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/ICollapsableExpandable.java b/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/part/ICollapsableExpandable.java
new file mode 100644 (file)
index 0000000..70909b9
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+* 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();
+
+}
diff --git a/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/wizard/WizardChooser.java b/eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/workbench/wizard/WizardChooser.java
new file mode 100644 (file)
index 0000000..5ab45b2
--- /dev/null
@@ -0,0 +1,18 @@
+/**
+* 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 {
+
+}
index 4fd7c3c4264206bb82401da760d47946e3a504f7..21e7a7182e71bfcc9a391e84d84005ad6a541c80 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<?pde version="3.5"?><product application="eu.etaxonomy.taxeditor.application.application" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" includeLaunchers="true" name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product" useFeatures="true" version="4.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>
index 6ed9c44dbe5d18e87bfcc77f74a1ab656ba860b4..896a319a22364df3e95dee083634ad19d403aec8 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?pde version="3.5"?>
 
-<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="4.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"/>
index d2f9ca62248c5a2bb0633b0c6b3dde07ed639498..38fec5a71a8ea9fef9906bf300f95ac4562a6574 100644 (file)
@@ -2,7 +2,7 @@
   <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>
diff --git a/pom.xml b/pom.xml
index ebf46f16642bed2dbe743a83e0b73403eae4f77c..1c47d9c83581b788d618d4d321b483313c3cd77e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   </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>