Merge branch 'develop' into bulkEditorE4
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 13 Sep 2017 07:34:48 +0000 (09:34 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 13 Sep 2017 07:34:48 +0000 (09:34 +0200)
# Conflicts:
# eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/MisapplicationContainerE4.java
# eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java

207 files changed:
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/ChecklistPerspective.java
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/Taxonomic.java
eu.etaxonomy.taxeditor.bulkeditor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.bulkeditor/fragment.e4xmi
eu.etaxonomy.taxeditor.bulkeditor/plugin.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/e4/AnnotatedTableItem.java [new file with mode: 0644]
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/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/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.editor/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.editor/fragment.e4xmi
eu.etaxonomy.taxeditor.editor/plugin.xml
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/e4/TaxonEditorInputFactoryE4.java [new file with mode: 0644]
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/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/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/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/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/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 53% 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 72% 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 77% 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 83% 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 61% 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/handler/CreateDescriptionHandler.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/graph/ConceptGraphView.java
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/DerivateView.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/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/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/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/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/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/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.navigation/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.navigation/fragment.e4xmi
eu.etaxonomy.taxeditor.navigation/plugin.xml
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/key/polytomous/handler/EditPolytomousKeyNodesHandler.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/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/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 64% similarity]
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 57% 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 65% 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 56% 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 72% similarity]
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.printpublisher/src/main/java/eu/etaxonomy/taxeditor/printpublisher/handler/GeneratePdfHandler.java
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/fragment.e4xmi
eu.etaxonomy.taxeditor.store/plugin.xml
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/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
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 68% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.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/ui/section/taxon/TaxonRelationshipDetailElement.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/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/supplementaldata/SupplementalDataPartE4.java
eu.etaxonomy.taxeditor.workbench/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/AppModelId.java

index 752a45a4f97c4e4aa1b498ffb6e704b8007a3c10..60c61f1d42d1465cadecfabb97c38275ef8c0955 100644 (file)
@@ -1,8 +1,8 @@
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -13,12 +13,10 @@ 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
@@ -29,7 +27,7 @@ public class ChecklistPerspective extends Default {
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
         * .IPageLayout)
@@ -46,7 +44,6 @@ public class ChecklistPerspective extends Default {
                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(MediaViewPart.ID);
 
 //             createAdditionalFolder(layout, layout.getEditorArea());
index f16a8164bf313504148d93b983fd2c49c80b8a37..488498c12d7089c9a9582656d7a6a89c12a52eaa 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -13,7 +13,6 @@ 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;
@@ -32,16 +31,15 @@ public class Taxonomic extends Default {
        @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);
-               
+
                createAdditionalFolder(layout, layout.getEditorArea());
        }
 }
index 352f76d9b26a799e413fab14b46ffaeee6ff0141..044fbfff7845e3f7bf7c35f14843ad4a169e13ab 100644 (file)
@@ -23,7 +23,8 @@ 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
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Import-Package: eu.etaxonomy.taxeditor.editor,
  org.eclipse.core.runtime,
index 18685f48c04a2e44855c5360f2d4670e88cafd44..8d3a8b5247163679d5208e7f141c9df8aebe3b8e 100644 (file)
@@ -2,8 +2,18 @@
 <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">
     <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"/>
   </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"/>
@@ -19,6 +29,9 @@
   <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="Person and Teams" command="_Kc-ToCAzEeeepOgM49meig">
+        <parameters xmi:id="_-wbrUJRiEeeDJ72ZvUwCLA" elementId="eu.etaxonomy.taxeditor.bulkeditor.parameter.0" name="taxeditor-bulkeditor.commandParameter.inputType" value="bulkeditor.input.author"/>
+      </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">
+      <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.handler.ConvertTeam2PersonHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.bulkeditor/eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler" 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"/>
+      <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="_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:Menu" xmi:id="_saDaAJcMEeeM745tzuPNCQ" elementId="eu.etaxonomy.taxeditor.bulkeditor.menu.chooseMarkerType" label="%menu.label.2"/>
+        <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="">
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_NE4fEYKhEee80qfpLNk7uw" elementId="eu.etaxonomy.taxeditor.store.showViewMenu.referencingobjects" label="%view.name" iconURI="">
@@ -36,4 +76,8 @@
       <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>
   </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_Z75CcJMjEeeR4YRjNqCKeA" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+    <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"/>
+  </fragments>
 </fragment:ModelFragments>
index 5ea516688106c5fa85f5ff5196519855abc0efb6..2765e9a775fd1d0aaaeed0e36a718376532f4569 100644 (file)
    </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"
    </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
    </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">
             </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
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..94639d6
--- /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.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 eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class NewObjectHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            MHandledMenuItem menuItem) {
+
+        Object key = menuItem.getTransientData().get(IBulkEditorConstants.DYNAMIC_OPEN_OBJECT_ID+".key");
+
+        BulkEditorE4 bulkEditor = (BulkEditorE4) activePart.getObject();
+
+
+        if (key != null) {
+            IEntityCreator entityCreator = bulkEditor.getEditorInput().getEntityCreator();
+            String text = menuItem.getCommand().getCommandName();
+            Object createdEntity = entityCreator.createEntity(text);
+            bulkEditor.getEditorInput().getModel().add(createdEntity);
+            bulkEditor.refresh();
+
+            //                         if(!(key instanceof SpecimenOrObservationType)) {
+            //
+            //                                 //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) {
+            //                                         ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, dialog.getValue());
+            //                                 }
+            //                         } else {
+            //                                 ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject(key, "Untitled");
+            //                         }
+            //
+            //                 } else {
+            //                         ((AnnotatedLineEditor) editor).createAnnotatedLineNewObject();
+            //                 }
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/AnnotatedTableItem.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/AnnotatedTableItem.java
new file mode 100644 (file)
index 0000000..d714c8f
--- /dev/null
@@ -0,0 +1,54 @@
+// $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 eu.etaxonomy.cdm.model.common.ICdmBase;
+
+/**
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class AnnotatedTableItem <T extends ICdmBase> {
+
+    private T element;
+    private boolean isMergeCandidate = false;
+    private boolean isMergeTarget = false;
+
+    public AnnotatedTableItem(T element) {
+        super();
+        this.element = element;
+    }
+
+    public T getElement() {
+        return element;
+    }
+
+    public void setMergeCandidate(boolean isMergeCandidate) {
+        this.isMergeCandidate = isMergeCandidate;
+    }
+
+    public void setMergeTarget(boolean isMergeTarget) {
+        this.isMergeTarget = isMergeTarget;
+    }
+
+    public boolean isMergeCandidate() {
+        return isMergeCandidate;
+    }
+
+    public boolean isMergeTarget() {
+        return isMergeTarget;
+    }
+
+    @Override
+    public String toString() {
+        return element.toString();
+    }
+}
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..32e781d
--- /dev/null
@@ -0,0 +1,248 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.e4.ui.di.Persist;
+import org.eclipse.e4.ui.model.application.ui.MDirtyable;
+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.ISelectionChangedListener;
+import org.eclipse.jface.viewers.TableViewer;
+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 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.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.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 8, 2017
+ *
+ */
+public class BulkEditorE4 implements IPartContentHasDetails, IConversationEnabled, IPostOperationEnabled,
+        IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData, IPartContentHasMedia {
+
+       private BulkEditorSearchE4 searchBar = null;
+
+       @Inject
+       private MDirtyable dirty;
+
+    private AbstractBulkEditorInput<?> input;
+
+    private Composite topComposite;
+
+    private TableViewer viewer;
+
+    private ConversationHolder conversation;
+
+    @Inject
+    private ESelectionService selService;
+
+    private ISelectionChangedListener selectionChangedListener;
+
+    @Inject
+    public BulkEditorE4() {
+       }
+
+       public void init(AbstractBulkEditorInput<?> input){
+           this.input = input;
+           AbstractBulkEditorInput<?> bulkEditorInput = input;
+           if(bulkEditorInput.getEntityUuid()!=null){
+               bulkEditorInput.performSearch(new BulkEditorQuery(bulkEditorInput.getEntityUuid().toString(), null));
+           }
+           searchBar = new BulkEditorSearchE4(this, topComposite, SWT.NONE);
+
+       }
+
+       /** {@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);
+               viewer.setContentProvider(new ArrayContentProvider());
+               viewer.setLabelProvider(new BulkEditorLabelProvider());
+
+
+        //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");
+
+       }
+
+       @Persist
+       public void save() {
+           dirty.setDirty(false);
+
+           this.searchBar.updateEditorInput();
+
+       }
+
+       /** {@inheritDoc} */
+    public void performSearch(BulkEditorQuery query) {
+        if (query != null) {
+
+            // TODO check if dirty, prompt save
+            if (isDirty()) {
+                String[] labels = {"Save (and Search)", "Don't save (and Search)","Cancel"};
+                MessageDialog dialog =new MessageDialog(topComposite.getShell(), "Save changes", null, "You have made changes that must be saved before this query can be executed. Would you like to proceed?", MessageDialog.QUESTION,labels, 0);
+                int result = dialog.open();
+                if (result == 0) {
+                    save();
+                } else if (result == 2){
+                    return;
+                }
+            }
+
+            getEditorInput().performSearch(query);
+
+            viewer.setInput(getEditorInput().getWrappedModel());
+            refresh();
+        }
+    }
+
+    public void refresh() {
+        viewer.refresh();
+    }
+
+    public boolean isDirty() {
+        return dirty.isDirty();
+    }
+
+    public AbstractBulkEditorInput getEditorInput() {
+        return input;
+    }
+
+    public List<AnnotatedTableItem> getMergeCandidates(){
+        List<AnnotatedTableItem> mergeCandidates = new ArrayList<>();
+        for(AnnotatedTableItem item: (List<AnnotatedTableItem>)viewer.getInput()){
+            if(item.isMergeCandidate()){
+                mergeCandidates.add(item);
+            }
+        }
+        return mergeCandidates;
+    }
+
+    public AnnotatedTableItem getMergeTarget(){
+        for(AnnotatedTableItem item: (List<AnnotatedTableItem>)viewer.getInput()){
+            if(item.isMergeTarget()){
+                return item;
+            }
+        }
+        return null;
+    }
+
+    public void removeAllAnnotations(){
+        for(AnnotatedTableItem item: (List<AnnotatedTableItem>)viewer.getInput()){
+            item.setMergeCandidate(false);
+            item.setMergeTarget(false);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void update(CdmDataChangeMap arg0) {
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean canAttachMedia() {
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void changed(Object element) {
+    }
+
+    /**
+     * {@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..2d47fd1
--- /dev/null
@@ -0,0 +1,62 @@
+// $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.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+
+/**
+ * @author pplitzner
+ * @date 11.09.2017
+ *
+ */
+public class BulkEditorLabelProvider extends LabelProvider {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Image getImage(Object element) {
+        AnnotatedTableItem item = (AnnotatedTableItem)element;
+        try {
+            if(item.isMergeCandidate()){
+                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(item.isMergeTarget()){
+                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 getText(Object element) {
+        return super.getText(element);
+    }
+
+}
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..85a878e
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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 = "Search";
+
+       private static final String DEFAULT_TEXT = String.format("Use \'%s\' for wildcard searching", 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");
+               }
+       }
+
+
+       /**
+        * Creates the search textfield.
+        */
+       private void createSearchTextField(Composite parent, int style) {
+               final Label label = new Label(parent, SWT.NONE);
+               label.setText("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("");
+                               }
+                       }
+
+                       @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/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..83a309e
--- /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.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 org.eclipse.ui.IEditorInput;
+
+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;
+
+/**
+ *
+ * @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("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);
+
+        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){
+                       IEditorInput input = editor.getEditorInput();
+
+                       if(input instanceof AbstractBulkEditorInput){
+                               IEntityCreator<?> entityCreator = ((AbstractBulkEditorInput) 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..47cb572
--- /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";
+        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..328d705
--- /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.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.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
+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)AnnotatedTableItem item,
+            @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();
+            } else {
+                return;
+            }
+        }
+
+        Team team =null;
+        UpdateResult result = null;
+        try {
+            result = CdmStore.getService(IAgentService.class).convertPerson2Team(item.getElement().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)AnnotatedTableItem selection,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            MHandledMenuItem menuItem){
+        boolean canExecute = false;
+        canExecute = ((BulkEditorE4)activePart.getObject()).getEditorInput().isConvertingEnabled() && selection.getElement() 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..bd54325
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+* 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.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.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
+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)AnnotatedTableItem item,
+               @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();
+                       } else {
+                               return;
+                       }
+               }
+
+               Person person = null;
+               UpdateResult result = null;
+
+               try {
+                   result = CdmStore.getService(IAgentService.class).convertTeam2Person(item.getElement().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)AnnotatedTableItem selection,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            MHandledMenuItem menuItem){
+        boolean canExecute = false;
+        canExecute = ((BulkEditorE4)activePart.getObject()).getEditorInput().isConvertingEnabled() && selection.getElement() 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..0f22298
--- /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.bulkeditor.e4.handler;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.model.application.ui.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.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)Object object,
+            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+        DeleteConfiguratorBase config = null;
+        DeleteResult result = new DeleteResult();
+        String errorMessage= OBJECT;
+        if (object instanceof CdmBase){
+            CdmBase base = (CdmBase)object;
+            if (base.getId() != 0){
+                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(((CdmBase) 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() ){
+
+                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..10aeb78
--- /dev/null
@@ -0,0 +1,111 @@
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the 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.apache.log4j.Logger;
+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.widgets.Shell;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.strategy.merge.MergeException;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @date 11.09.2017
+ *
+ */
+public class MergeGroupHandlerE4 {
+    private static final Logger logger = Logger
+            .getLogger(MergeGroupHandlerE4.class);
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)Object object,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+        BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+
+        // Check whether there are any group annotations
+        List<AnnotatedTableItem> mergeCandidates = editor.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
+        AnnotatedTableItem mergeTarget = editor.getMergeTarget();
+        if (mergeTarget == null) {
+            MessageDialog.openWarning(shell,
+                    "No group merge target set", "No group merge target has been set.");
+            return;
+        }
+        Object targetEntity = mergeTarget.getElement();
+
+        TeamOrPersonBase teamOrPerson = null;
+        Reference ref = null;
+        if (targetEntity instanceof TeamOrPersonBase){
+            teamOrPerson = HibernateProxyHelper.deproxy(targetEntity, TeamOrPersonBase.class);
+        } else if(targetEntity instanceof Reference){
+            ref = HibernateProxyHelper.deproxy(targetEntity, Reference.class);
+        }
+        for (AnnotatedTableItem item : mergeCandidates) {
+            //first check whether entities are mergeable
+            try{
+                if (ref != null){
+                    Reference ref2 = HibernateProxyHelper.deproxy(item.getElement(), 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;
+                    }
+                }
+                if (teamOrPerson != null){
+                    TeamOrPersonBase teamOrPerson2 = HibernateProxyHelper.deproxy(item.getElement(), 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;
+                    }
+                }
+            }catch(MergeException e){
+
+            }
+            editor.removeAllAnnotations();
+            editor.refresh();
+            //                         ((BulkEditor) editor).removeAnnotatedLine(item);
+            //
+            //                         // Mark entity container for merging with target entity
+            //                         ((IEntityContainer) item).markAsMerged(targetEntity);
+            //                         logger.info("Merging " + item + " with " + targetAnnotation);
+            //
+            //                         // Remove annotation from model
+            //                         model.removeAnnotation(item);
+            //                 }
+            //
+            //                 model.removeTypeFromAllAnnotations(IBulkEditorConstants.TYPE_MERGE_CANDIDATE);
+            //                 model.removeTypeFromAllAnnotations(IBulkEditorConstants.TYPE_MERGE_TARGET);
+        }
+    }
+}
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..6dd6742
--- /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.bulkeditor.e4.handler;
+import org.eclipse.core.commands.ParameterizedCommand;
+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;
+
+import eu.etaxonomy.taxeditor.bulkeditor.AppModelId;
+import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+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) {
+           String inputTypeId = (String) command.getParameterMap().get(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID);
+               BulkEditorInputType inputType = BulkEditorInputType.getById(inputTypeId);
+
+               MPart part = partService.createPart(AppModelId.PARTDESCRIPTOR_BULKEDITOR_EDITOR);
+        partService.showPart(part, PartState.ACTIVATE);
+        BulkEditorE4 bulkEditor = (BulkEditorE4) part.getObject();
+        bulkEditor.init(AbstractBulkEditorInput.NewInstance(inputType));
+       }
+}
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..453bf7e
--- /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 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.bulkeditor.e4.AnnotatedTableItem;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class RemoveMergeCandidateHandlerE4  {
+
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)AnnotatedTableItem item,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+        BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+        item.setMergeCandidate(false);
+        editor.refresh();
+    }
+}
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..98a3adb
--- /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.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.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
+import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.bulkeditor.operation.SetMarkerFlagOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+
+/**
+ * <p>SetMarkerFlagTrueHandler class.</p>
+ *
+ * @author p.ciardelli
+ * @created 20.10.2009
+ * @version 1.0
+ */
+public class SetMarkerFlagHandlerE4 extends AbstractHandler {
+
+       /* (non-Javadoc)
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+        */
+       /** {@inheritDoc} */
+       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 
+                                       && 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/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..edc7bcf
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class SetMergeCandidateHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)AnnotatedTableItem item,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+        BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+        item.setMergeCandidate(true);
+        editor.refresh();
+    }
+}
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..77da3fa
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.Execute;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.services.IServiceConstants;
+
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
+
+/**
+ *
+ * @author pplitzner
+ * @date 12.09.2017
+ *
+ */
+public class SetMergeTargetHandlerE4 {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)AnnotatedTableItem item,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart) {
+        BulkEditorE4 editor = (BulkEditorE4) activePart.getObject();
+        item.setMergeTarget(true);
+        editor.refresh();
+       }
+}
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..508270eebecb637a83114cd28cbf3e377c35f0cd 100644 (file)
@@ -2,27 +2,43 @@ 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.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
 
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
-public class OpenBulkEditorForIdentifiableEntityE4 {
+public class OpenBulkEditorForIdentifiableEntityE4 extends DefaultOpenHandlerBaseE4<IdentifiableEntity>{
 
-       @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) {
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected IdentifiableEntity getEntity(UUID uuid) {
+        return CdmStore.getCommonService().find(IdentifiableEntity.class, uuid);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void open(IdentifiableEntity entity, Shell shell) {
+        try {
+            BulkEditorUtil.openEditor(entity);
+        } catch (PartInitException e) {
             MessagingUtils.error(this.getClass(), "Bulk Editor could not be opened for "+entity, e);
-               }
-       }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean canExecute(IdentifiableEntity entity) {
+        return true;
+    }
 
 }
index 8307781b14ade0829ede480496225ae37d16232f..b104636b85dd07f131d58f0ac24a294fc8950035 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.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
 
 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.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 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,7 +20,7 @@ public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<Ta
     }
 
     @Override
-    protected void open(ExecutionEvent event, TaxonNode entity) {
+    protected void open(TaxonNode entity, Shell shell) {
         try {
             BulkEditorUtil.openEditor(entity.getTaxon());
         } catch (PartInitException e) {
@@ -28,4 +28,12 @@ public class OpenBulkEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<Ta
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean canExecute(TaxonNode entity) {
+        return entity.getTaxon()!=null;
+    }
+
 }
index c87a2a01e6230a9c5017db21ebc6b8b122279cf5..5813dcdd789d9360082a7263bd232fd289104c82 100644 (file)
@@ -32,6 +32,7 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityCreator;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorSortProvider;
+import eu.etaxonomy.taxeditor.bulkeditor.e4.AnnotatedTableItem;
 import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.CdmBaseSortProvider;
 import eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider.TitleCacheComparator;
 import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
@@ -222,6 +223,14 @@ public abstract class AbstractBulkEditorInput<T extends ICdmBase> extends CdmEnt
                return model;
        }
 
+       public List<AnnotatedTableItem<T>> getWrappedModel() {
+           List<AnnotatedTableItem<T>> wrappetItems = new ArrayList<>();
+           for(T t:model){
+               wrappetItems.add(new AnnotatedTableItem<T>(t));
+           }
+           return wrappetItems;
+       }
+
        protected boolean replaceInModel(T entity) {
            int index = model.indexOf(entity);
            if(index >= 0) {
index 4cfa0860b4aeb146599d8626f5e5a51f13092695..f63d6b2e928221596f5a180eae71a9fc0ced066b 100644 (file)
@@ -7,11 +7,11 @@ 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.name.handler,
  eu.etaxonomy.taxeditor.editor.name.operation,
  eu.etaxonomy.taxeditor.editor.view.concept,
@@ -34,7 +34,8 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.e4.core.di,
  org.eclipse.e4.ui.model.workbench,
  org.eclipse.e4.ui.di,
- org.eclipse.e4.core.commands
+ org.eclipse.e4.core.commands,
+ org.eclipse.e4.core.services
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
index 92964b82faf5e09ce2cf9974c67bc77878bd5e46..ba8e652a6334e9d1bc9d8769e4b260811a53bfbf 100644 (file)
@@ -96,6 +96,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: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.descriptive.e4.FactualDataPartE4">
+      <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>
+    </elements>
   </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"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView">
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_tvph4EalEeeXMc6kSYO7Xg" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.characterEditor" label="Character Editor" command="_WPjpoDSnEeek0dKsFNy--Q">
       <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>
   </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_P9N9YJMkEeeR4YRjNqCKeA" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
+    <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"/>
+  </fragments>
 </fragment:ModelFragments>
index 9e38d50c715a890d3933a2741047f4c5b5418524..67a26b21f3b20dbf030b982cc520f01d1a95bd59 100644 (file)
       </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"
    </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"
          </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>
       
       
       
             </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">
             </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">
             </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">
             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.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
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..b31f1d60c7cece76c9ad99142e04d0fc7d69514b 100644 (file)
@@ -9,13 +9,15 @@
 
 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.ui.basic.MPart;
+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;
@@ -23,25 +25,24 @@ 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.e4.TaxonEditorInputE4;
 import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditor;
 import eu.etaxonomy.taxeditor.editor.group.authority.CdmAuthorityEditorInput;
 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.name.e4.TaxonNameEditorE4;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
@@ -80,19 +81,6 @@ public class EditorUtil extends AbstractUtility {
                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);
@@ -137,39 +125,37 @@ public class EditorUtil extends AbstractUtility {
         * @throws java.lang.Exception
         *             if any.
         */
-       public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
-               TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
-               open(input);
+       public static void openTaxonNodeE4(UUID taxonNodeUuid) throws Exception {
+           //FIXME E4 this can probably be removed when fully migrated
+        TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstance(taxonNodeUuid);
+        EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+        MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+        partService.showPart(part, PartState.ACTIVATE);
+        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+        editor.init(input);
        }
 
-       /**
-        * <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 {
+       public static void openTaxonBaseE4(UUID taxonBaseUuid) throws PartInitException{
+           //FIXME E4 this can probably be removed when fully migrated
            TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
-        if (taxonBase != null && taxonBase.isOrphaned()) {
-            if(taxonBase.isInstanceOf(Synonym.class)){
-                MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
-                return;
-            }
-            else{
-                MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInput.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
-                return;
-            }
-        }
-               TaxonEditorInput input = TaxonEditorInput
-                               .NewInstanceFromTaxonBase(taxonBaseUuid);
-               if(input!=null && input.getTaxonNode()!=null){
-                   open(input);
-               }
+
+           if (taxonBase != null && taxonBase.isOrphaned()) {
+               if(taxonBase.isInstanceOf(Synonym.class)){
+                   MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_ACCEPTED_TAXON_MESSAGE);
+                   return;
+               }
+               else{
+                   MessagingUtils.warningDialog(Messages.EditorUtil_ORPHAN_TAXON, TaxonEditorInputE4.class, Messages.EditorUtil_ORPHAN_TAXON_MESSAGE);
+                   return;
+               }
+           }
+
+           TaxonEditorInputE4 input = TaxonEditorInputE4.NewInstanceFromTaxonBase(taxonBaseUuid);
+           EPartService partService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+           MPart part = partService.createPart("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+           partService.showPart(part, PartState.ACTIVATE);
+           TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+           editor.init(input);
        }
 
        /**
@@ -199,13 +185,14 @@ public class EditorUtil extends AbstractUtility {
         * @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) throws PartInitException {
+               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("eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4");
+        partService.showPart(part, PartState.ACTIVATE);
+        TaxonNameEditorE4 editor = (TaxonNameEditorE4) part.getObject();
+        editor.init(input);
        }
 
        /**
@@ -231,86 +218,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 +257,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
@@ -435,38 +358,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..8527ebf
--- /dev/null
@@ -0,0 +1,377 @@
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the 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 org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+
+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.TaxonEditorInputFactory;
+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 IEditorInput, IConversationEnabled, IPersistableElement {
+
+    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);
+
+    }
+
+    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);
+
+                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);
+            }
+        }
+    }
+
+
+    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) throws Exception {
+        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);
+    }
+
+    @Override
+    public boolean exists() {
+        return taxonNode != null;
+    }
+
+    @Override
+    public ImageDescriptor getImageDescriptor() {
+        return null;
+    }
+
+    @Override
+    public String getName() {
+        if(getTaxon() == null){
+            return null;
+        }
+        TaxonName name = getTaxon().getName();
+        if (name == null || name.getTitleCache() == null) {
+            return Messages.TaxonEditorInput_NEW_TAXON;
+        } else {
+            return name.getTitleCache();
+        }
+    }
+
+    @Override
+    public IPersistableElement getPersistable() {
+        return null;
+    }
+
+    @Override
+    public String getToolTipText() {
+        return getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    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(){
+        Taxon taxon = CdmBase.deproxy(taxonNode.getTaxon(), Taxon.class);
+        return taxon;
+    }
+
+    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);
+    }
+
+    @Override
+    public String getFactoryId() {
+        return TaxonEditorInputFactory.getFactoryId();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void saveState(IMemento memento) {
+        TaxonEditorInputFactoryE4.saveState(memento, this);
+    }
+
+
+    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;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputFactoryE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/e4/TaxonEditorInputFactoryE4.java
new file mode 100644 (file)
index 0000000..aaf3c5f
--- /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.editor.e4;
+
+import java.util.UUID;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.taxeditor.editor.l10n.Messages;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+/**
+ *
+ * @author pplitzner
+ * @date Aug 24, 2017
+ *
+ */
+public class TaxonEditorInputFactoryE4 implements IElementFactory {
+
+    /**
+     * Factory id. The workbench plug-in registers a factory by this name
+     * with the "org.eclipse.ui.elementFactories" extension point.
+     */
+    private static final String ID_FACTORY = "eu.etaxonomy.taxeditor.editor.name.taxonEditorInputFactory"; //$NON-NLS-1$
+
+    /**
+     * Tag for the IFile.fullPath of the file resource.
+     */
+    private static final String TAXON_NODE_UUID = "uuid"; //$NON-NLS-1$
+
+       /** {@inheritDoc} */
+       @Override
+    public IAdaptable createElement(IMemento memento) {
+        // Get the uuid
+        String taxonNodeUuid = memento.getString(TAXON_NODE_UUID);
+        if(! CdmStore.isActive()){
+               return null;
+        }
+        if (taxonNodeUuid == null || CdmStore.getService(IClassificationService.class).getTaxonNodeByUuid(UUID.fromString(taxonNodeUuid)) == null) {
+               MessagingUtils.warn(this.getClass(), Messages.TaxonEditorInputFactory_NOT_FOUND_TAXON + taxonNodeUuid);
+               return null;
+        }
+        try {
+                       return TaxonEditorInputE4.NewInstance(UUID.fromString(taxonNodeUuid));
+               } catch (Exception e) {
+                       MessagingUtils.warningDialog(Messages.TaxonEditorInputFactory_COULD_NOT_CREATE, TaxonEditorInputFactoryE4.class, e.getMessage());
+               }
+               return null;
+       }
+
+    /**
+     * Returns the element factory id for this class.
+     *
+     * @return the element factory id
+     */
+    public static String getFactoryId() {
+        return ID_FACTORY;
+    }
+
+    /**
+     * Saves the state of the given file editor input into the given memento.
+     *
+     * @param memento the storage area for element state
+     * @param input the file editor input
+     */
+    public static void saveState(IMemento memento, TaxonEditorInputE4 input) {
+       String uuid = input.getTaxonNode().getUuid().toString();
+        memento.putString(TAXON_NODE_UUID, uuid);
+    }
+}
index 181a00cb041ffeae5189254e2dc8f5dde31266ee..1bd2d62accbcaf725f455a3d5cab259216045488 100644 (file)
@@ -39,7 +39,7 @@ public class EditNewTaxonHandler extends AbstractHandler implements IHandler {
                logger.debug("Handler called: " + this.getClass().getCanonicalName()); //$NON-NLS-1$
                
                try {
-                       EditorUtil.openEmpty(null);
+                       EditorUtil.openEmptyE4(null);
                } catch (PartInitException e) {
                        e.printStackTrace();
                }
index ed764a4d635b9bcdb7db483707375887efa6aff5..355a4b00d6c5854a8bf98e66a1a2ceb38b2e1d35 100644 (file)
@@ -16,7 +16,7 @@ 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);
         DerivateView derivateView = (DerivateView) part.getObject();
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 1c9fa15c9e7439cf52cfc9f735ffcc996ff247d9..9734f4be912e8857b13c9c2bb1225e536a55d45d 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) {
            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..c7a4afb1e716a16f358cefaeb413875bd296f03a 100644 (file)
@@ -1,19 +1,19 @@
 package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
 import java.util.UUID;
 
-import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.PartInitException;
 
 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.handler.defaultHandler.e4.DefaultOpenHandlerBaseE4;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 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 +21,20 @@ public class DefaultOpenTaxonEditorForTaxonBaseHandler extends DefaultOpenHandle
     }
 
     @Override
-    protected void open(ExecutionEvent event, TaxonBase entity) {
+    protected void open(TaxonBase entity, Shell shell) {
         try {
-            EditorUtil.openTaxonBase(entity.getUuid());
+            EditorUtil.openTaxonBaseE4(entity.getUuid());
         } catch (PartInitException e) {
             MessagingUtils.error(DefaultOpenTaxonEditorForTaxonBaseHandler.class, Messages.DefaultOpenTaxonEditorForTaxonBaseHandler_COULD_NOT_OPEN+entity, e);
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean canExecute(TaxonBase entity) {
+        return true;
+    }
+
 }
index b6c18e6ef5b791de2523708eb60861e340643df7..f11c26f4bdfe1662afbfa716833bcec8bbc150c5 100644 (file)
@@ -1,20 +1,18 @@
 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.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 +20,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) {
         try {
-            EditorUtil.open(input);
-        } catch (PartInitException e) {
-            MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, Messages.DefaultOpenTaxonEditorForTaxonNodeHandler_COULD_NOT_OPEN+input.getTaxon(), e);
+            EditorUtil.openTaxonNodeE4(entity.getUuid());
+        } 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 61e859296a41a8aa836d08b9f602187deb2fb076..6fe50e94bea98ac51a405d92ca85ea2d2adb37f1 100644 (file)
@@ -100,7 +100,7 @@ public class PolytomousKeyListEditor extends EditorPart implements
                            Taxon taxon = getItemTaxon(node);
                            if (taxon != null) {
                                try {
-                                   EditorUtil.openTaxonBase((taxon).getUuid());
+                                   EditorUtil.openTaxonBaseE4((taxon).getUuid());
                                } catch (PartInitException e) {
                                    MessagingUtils.error(getClass(), e);
                                }
index 187900a79d77e615ff01d9fab7634bd43f6dee19..7b31b38b35036356e02198c4917da6c7fc708c57 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.
  */
@@ -58,7 +58,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 +88,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
                        linkSelectionListener = new SelectionAdapter() {
                                /*
                                 * (non-Javadoc)
-                                * 
+                                *
                                 * @see
                                 * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org
                                 * .eclipse.swt.events.SelectionEvent)
@@ -99,7 +99,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
                                        if (data instanceof Taxon) {
                                                try {
-                                                       EditorUtil.openTaxonBase(((Taxon) data).getUuid());
+                                                       EditorUtil.openTaxonBaseE4(((Taxon) data).getUuid());
                                                } catch (PartInitException e1) {
                                                        // TODO Auto-generated catch block
                                                        e1.printStackTrace();
@@ -172,7 +172,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.forms.IFormPart#initialize(org.eclipse.ui.forms.IManagedForm
         * )
@@ -185,7 +185,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#isDirty()
         */
        @Override
@@ -195,7 +195,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
         */
        @Override
@@ -206,7 +206,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFormInput(java.lang.Object)
         */
        @Override
@@ -217,7 +217,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#setFocus()
         */
        @Override
@@ -228,7 +228,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#isStale()
         */
        @Override
@@ -239,7 +239,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#refresh()
         */
        @Override
@@ -250,7 +250,7 @@ public class PolytomousKeyListItem extends AbstractCdmFormElement implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.IFormPart#dispose()
         */
        @Override
@@ -265,7 +265,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/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));
-       }
-}
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..11b44a1
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.editor.name.e4;
+
+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();
+}
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..9326674
--- /dev/null
@@ -0,0 +1,694 @@
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the 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.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.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 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.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 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) {
+                                       selection = ((AbstractGroupedContainerE4) input).getData();
+
+                               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){
+               PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
+               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();
+               }
+               // commit the conversation and start a new transaction immediately
+               input.merge();
+
+               conversation.commit(true);
+
+               // Otherwise declare this step as done.
+               monitor.worked(1);
+
+               dirty.setDirty(false);
+           }
+
+           // Stop the progress monitor.
+           monitor.done();
+       }
+
+       public void init(TaxonEditorInputE4 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);
+               }
+
+               this.input = input;
+
+        createOrUpdateNameComposites();
+
+        setFocus();
+
+        createDragSupport();
+
+        setPartName();
+       }
+
+   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()) {
+                       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;
+       }
+
+       public boolean isDirty() {
+               return dirty.isDirty();
+       }
+
+       @PreDestroy
+       public void dispose() {
+        if(conversation!=null){
+            conversation.unregisterForDataStoreChanges(this);
+            conversation.close();
+        }
+       }
+
+       /** {@inheritDoc} */
+       @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+       }
+
+       public AbstractGroupedContainerE4 getSelectedContainer() {
+
+               TaxonBase selectedTaxonBase = null;
+
+               if (input.getInitiallySelectedTaxonBase() != null) {
+                       selectedTaxonBase = input.getInitiallySelectedTaxonBase();
+               } else {
+                       if (selection != null) {
+                               selectedTaxonBase = selection;
+                       }
+               }
+
+               return (selectedTaxonBase != null) ? getContainer(selectedTaxonBase)
+                               : 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.getActiveE4Part());
+       }
+
+    @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(taxon.toString());
+    }
+
+    @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 53%
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..c86eb9ab3039712845f67d18f3043dc46fb9d827 100644 (file)
@@ -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.ArrayList;
 import java.util.List;
@@ -20,45 +20,36 @@ 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 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;
        }
 
@@ -73,9 +64,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 +82,32 @@ 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 +119,23 @@ public abstract class AbstractGroup implements IDropTargetable{
                }
        }
 
-       /**
-        * <p>getNameEditor</p>
-        *
-        * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
-        */
        @Override
-    public TaxonNameEditor getEditor() {
+    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 +143,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 +155,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 +167,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 +175,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;
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.Assert;
 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 +41,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 +88,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 +103,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,24 +120,9 @@ 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(T taxonBase) {
                setData(taxonBase);
                parseHandler = ParseHandler.NewInstance(taxonBase.getName());
        }
@@ -149,7 +134,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                createLineWrapSupport();
                createLineBreakListener();
 
-               setMenu(getEditor().getMenu());
+               setMenu();
 
                setDraggableControl(new Control[] { getControl(),
                                getNameViewer().getRulerControl() });
@@ -163,11 +148,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                enableFreeText();
        }
 
-       /**
-        * <p>
-        * createListener
-        * </p>
-        */
        protected void createListener() {
                nameCompositeModifyListener = new ModifyListener() {
 
@@ -192,13 +172,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 +202,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 +223,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 +250,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,20 +287,12 @@ 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()));
        }
@@ -428,23 +330,12 @@ 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 +368,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 +408,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,38 +459,18 @@ 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);
 
@@ -666,19 +480,18 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                                if(!enabled){
                                        return;
                                }
-                               for (AbstractGroupedContainer container : getEditor()
+                               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 +503,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 +515,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 +543,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 +569,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 +579,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 +592,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 +620,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 +644,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 +651,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 +683,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));
                        }
@@ -1100,26 +773,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 +791,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 +823,6 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                }
        }
 
-       /**
-        * <p>
-        * storeCursor
-        * </p>
-        */
        public void storeCursor() {
                this.cursorPosition = getNameViewer().getCursorPosition();
        }
@@ -1186,60 +839,28 @@ 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) {
+       public void setGroup(AbstractGroupE4 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,31 +868,16 @@ 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;
@@ -1284,7 +890,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
 
        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);
@@ -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..783301e
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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(getEditor().getTaxon());
+               acceptedContainer.setGroup(this);
+
+               acceptedContainer.createContent();
+
+               createSynonymContainer();
+       }
+
+       @Override
+    protected void createSynonymContainer(){
+               for(Synonym synonym : getSynonyms()){
+                   SynonymContainerE4 container = new SynonymContainerE4(this, synonym);
+                       this.add(container);
+                       container.createContent();
+               }
+       }
+
+       public void setAcceptedNameContainer(AcceptedNameContainerE4 acceptedNameContainer) {
+               this.acceptedContainer = acceptedNameContainer;
+               acceptedContainer.setGroup(this);
+       }
+
+       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..e4e1d6e
--- /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.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> {
+
+       private AcceptedGroupE4 acceptedGroup;
+
+       public AcceptedNameContainerE4(Taxon taxon) {
+               super(taxon);
+       }
+
+       @Override
+    public void initializeComposite(){
+               setFont(getViewerFont());
+
+               initTextViewer();
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       protected Font getViewerFont() {
+               return AbstractUtility.getFont(Resources.ACCEPTED_TAXON_FONT);
+       }
+
+       public void setGroup(AcceptedGroupE4 group) {
+               this.acceptedGroup = group;
+       }
+
+       @Override
+       public AbstractGroupE4 getGroup() {
+               return acceptedGroup;
+       }
+
+       /** {@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) {
+       public MisapplicationContainerE4(AbstractGroupE4 group, Taxon misappliedName) {
                super(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) {
+       public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym) {
                super(synonym);
        }
-       
-       public SynonymContainer(AbstractHomotypicalGroupContainer group, Synonym synonym, int indent, Image icon){
+
+       public SynonymContainerE4(AbstractHomotypicalGroupContainerE4 group, Synonym synonym, int indent, Image icon){
                super(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,7 +1,7 @@
 /**
  *
  */
-package eu.etaxonomy.taxeditor.editor.name.dnd;
+package eu.etaxonomy.taxeditor.editor.name.e4.dnd;
 
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.swt.dnd.DND;
@@ -14,37 +14,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 +47,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 +77,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.getEditor().getConversationHolder().commit();
-               if (!target.equals(EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor())){
-                       ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).redraw();
-                       ((TaxonNameEditor)EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor()).getConversationHolder().commit();
+               if (!target.equals(EventUtility.getEditor())){
+                       ((TaxonNameEditorE4)EventUtility.getEditor()).redraw();
+                       ((TaxonNameEditorE4)EventUtility.getEditor()).getConversationHolder().commit();
 
                }
                target.getEditor().redraw();
@@ -103,25 +94,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 +120,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 +144,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 +162,7 @@ public class NameEditorDropTargetListener extends DropTargetAdapter {
                return null;
        }
 
-       /**
-        * @return
-        *
-        */
-       private TaxonNameEditor getEditor() {
-               return (TaxonNameEditor) EditorUtil.getActiveMultiPageTaxonEditor().getActiveEditor();
+       private TaxonNameEditorE4 getEditor() {
+               return (TaxonNameEditorE4) EventUtility.getEditor();
        }
 }
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..b7a7ec7
--- /dev/null
@@ -0,0 +1,148 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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 org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PartInitException;
+
+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.model.MessagingUtils;
+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;
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+        editor = (TaxonNameEditorE4) activePart.getObject();
+
+               IEditorInput input = editor.getEditorInput();
+
+               if (!(input instanceof TaxonEditorInputE4)) {
+                       logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
+                       return;
+               }
+
+               // 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 = ((TaxonEditorInputE4) input).getTaxon();
+
+               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, ((TaxonEditorInputE4) 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);
+               }
+
+       }
+
+       /** {@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;
+
+                       try {
+                               EditorUtil.openTaxonNodeE4(newNode.getUuid());
+                       } catch (PartInitException e) {
+                               e.printStackTrace();
+                       } catch (Exception e) {
+                               MessagingUtils.warningDialog(Messages.ChangeSynonymToAcceptedTaxonHandler_CREATE_FAILURE, this, e.getMessage());
+                       }
+               }
+               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..a34b5d7
--- /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.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.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) {
+
+        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);
+       }
+
+    @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..122562a
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        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);
+
+       }
+
+    @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..fd6b2da
--- /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.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.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) {
+
+        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);
+       }
+
+    @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..10bb5a2
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        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);
+       }
+
+    @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..f31da50
--- /dev/null
@@ -0,0 +1,66 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        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);
+       }
+
+
+    @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..dfc8677
--- /dev/null
@@ -0,0 +1,76 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        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);
+
+       }
+
+
+    @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..8b96934
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        editor = (TaxonNameEditorE4) activePart.getObject();
+
+               for(AbstractGroupedContainerE4 containerWithEmptyName : editor.getEmptyContainers()){
+                   editor.removeGroup(containerWithEmptyName.getGroup());
+                       doExecute(menuItem.getLocalizedLabel(), shell, editor, containerWithEmptyName.getData());
+               }
+
+       }
+
+    @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,16 @@
 * 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.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 +26,44 @@ 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;
 
-               Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
+       @Execute
+       public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+               @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+               @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+               MHandledMenuItem menuItem) {
 
-               doExecute(event, editor, selectedElement);
+           editor = (TaxonNameEditorE4) activePart.getObject();
+
+           doExecute(menuItem.getLocalizedLabel(), shell, editor, selection.getFirstElement());
 
-               return null;
        }
 
-       protected void doExecute(ExecutionEvent event, TaxonNameEditor editor, Object selectedElement) {
+       protected void doExecute(String commandName, Shell shell, TaxonNameEditorE4 editor, Object selectedElement) {
                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,19 +82,19 @@ 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);
                }
@@ -120,13 +114,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..a968202
--- /dev/null
@@ -0,0 +1,104 @@
+package eu.etaxonomy.taxeditor.editor.name.e4.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+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.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 org.eclipse.ui.IEditorInput;
+
+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;
+
+       @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
+            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
+
+        editor = (TaxonNameEditorE4) activePart.getObject();
+
+               IEditorInput input = editor.getEditorInput();
+
+               if (!EditorUtil.forceUserSaveE4Editor(editor, shell)) {
+                       return ;
+               }
+
+               if (!(input instanceof TaxonEditorInputE4)) {
+                       logger.error("Editor input is not TaxonEditorInput"); //$NON-NLS-1$
+                       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 = ((TaxonEditorInputE4)input).getTaxon();
+               List<UUID> excludeTaxa = new ArrayList<UUID>();
+               excludeTaxa.add(oldParent.getUuid());
+
+
+               TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell, editor.getConversationHolder(), Messages.MoveSynonymToAnotherAcceptedTaxonHandler_SELECT_ACC_TAXON, excludeTaxa,  ((TaxonEditorInputE4)input).getTaxonNode(), ((TaxonEditorInputE4)input).getTaxonNode().getClassification());
+
+               if(newParentNode!=null){
+                  MoveSynonymToAnotherAcceptedTaxonOperationE4 operation = new MoveSynonymToAnotherAcceptedTaxonOperationE4(Messages.MoveSynonymToAnotherAcceptedTaxonHandler_CHANGE_ACC_TAXON, EditorUtil.getUndoContext(),
+                           synonym.getUuid(), newParentNode.getTaxon(), editor, editor);
+
+                   AbstractUtility.executeOperation(operation);
+               }
+       }
+
+    @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() {
+               return false;
+       }
+
+}
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..ae24df9
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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) {
+
+        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);
+       }
+
+    @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..2a2cd90
--- /dev/null
@@ -0,0 +1,115 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the 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.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.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;
+
+    @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) {
+
+        this.activePart = activePart;
+        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);
+
+    }
+
+    @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());
+                } 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(synonym);
+       }
+
+       @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..bbb0fd5d36f1f20bdbbe25a03dca304ed2a48104 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.getEditor();
                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 a772e2b3e31ebb714c7555b15219fcbf09fe344f..12a11a82fb61fd575f9ff4e5a8c93e6d61762694 100644 (file)
@@ -22,7 +22,7 @@ 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;
@@ -66,8 +66,8 @@ public class CreateDescriptionHandler extends AbstractHandler {
                        }
                }
                // 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);
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 b76da194a54b46fd35774082db6b87e87fbf3406..6b2401a51d589ca009b35a460a897b4c8a1c49f5 100644 (file)
@@ -24,24 +24,22 @@ 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.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.detail.DetailsViewPart;
 import eu.etaxonomy.taxeditor.view.e4.AbstractCdmEditorPartE4;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
+import eu.etaxonomy.taxeditor.view.e4.details.DetailsPartE4;
+import eu.etaxonomy.taxeditor.view.e4.supplementaldata.SupplementalDataPartE4;
 
 /**
  *
@@ -65,7 +63,7 @@ implements IPartContentHasDetails, IPartContentHasSupplementalData{
 
         Object partObject = createPartObject(activePart);
 
-        if (partObject instanceof DetailsViewPart || partObject instanceof SupplementalDataViewPart) {
+        if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4) {
             // do not show empty page as these views are also used to edit the
             // description selected in this view
             return;
@@ -82,9 +80,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();
@@ -92,17 +92,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..c6edcb44a4fadef10a69387f531840cd0741cc07 100644 (file)
@@ -27,9 +27,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;
@@ -55,45 +53,45 @@ public class CreateConceptRelationHandlerE4 {
         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);
         }
-
-        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 +101,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..b35fbd8742121d0ba59db9e3f48ec0e700e2ab36 100644 (file)
@@ -24,9 +24,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;
@@ -45,29 +43,29 @@ public class DeleteConceptRelationHandlerE4 {
     public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
             @Optional@Named(IServiceConstants.ACTIVE_SELECTION) Object selection, MMenuItem menuItem) {
 
-        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);
+        }
     }
 
        @CanExecute
@@ -77,7 +75,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..0abbd192f152b5e995ec890985b014cbb7021d8a 100644 (file)
@@ -23,8 +23,8 @@ 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;
@@ -42,14 +42,14 @@ public class OpenRelatedConceptHandlerE4  {
     public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
             @Optional@Named(IServiceConstants.ACTIVE_SELECTION) TaxonRelationship taxonRelationship) {
 
-        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;
@@ -82,7 +82,7 @@ public class OpenRelatedConceptHandlerE4  {
      */
     protected void openConcept(TaxonBase<?> relatedTaxon) {
         try {
-            EditorUtil.openTaxonBase(relatedTaxon.getUuid());
+            EditorUtil.openTaxonBaseE4(relatedTaxon.getUuid());
         } catch (PartInitException e) {
             MessagingUtils.messageDialog(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN, getClass(),
                     String.format(Messages.OpenRelatedConceptHandler_COULD_NOT_OPEN_MESSAGE ,relatedTaxon), e);
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/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 e5d30a00095e724295b42e8a71894e24b8d72bff..999b258f1568dc13d054c329e81c0cd3ce3cd651 100644 (file)
@@ -55,8 +55,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;
@@ -507,8 +507,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 8440fada556137e79170d09c74b335202b92ce5d..23beb98a36d65b2343d6d0f52010e23d5ece5674 100644 (file)
@@ -3,10 +3,10 @@ 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;
@@ -16,12 +16,12 @@ import eu.etaxonomy.taxeditor.editor.AppModelId;
 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 +33,7 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle
     }
 
     @Override
-    protected void open(ExecutionEvent event, IndividualsAssociation entity) {
+    protected void open(IndividualsAssociation entity, Shell shell) {
        if(entity==null || entity.getAssociatedSpecimenOrObservation()==null){
                MessagingUtils.messageDialog(Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS, this, Messages.OpenDerivativeEditorForDescriptionElement_NO_SPECIMENS_MESSAGE);
                return;
@@ -42,12 +42,18 @@ public class OpenDerivativeEditorForDescriptionElement extends DefaultOpenHandle
         if(associatedSpecimenOrObservation!=null){
             UUID specimenUuid = associatedSpecimenOrObservation.getUuid();
             DerivateViewEditorInput input = new DerivateViewEditorInput(Collections.singletonList(specimenUuid));
-            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(IndividualsAssociation entity) {
+        return true;
+    }
 }
index bbab719babd1abe89ea22268b8c0655fc9cc5b8c..c3e821649e39e0d8aeda1e6565cadc11839bc45b 100644 (file)
@@ -2,10 +2,10 @@ 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;
@@ -13,11 +13,11 @@ import eu.etaxonomy.taxeditor.editor.AppModelId;
 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 +30,22 @@ public class OpenDerivativeEditorForSpecimenOrOBservationBase extends DefaultOpe
     }
 
     @Override
-    protected void open(ExecutionEvent event, SpecimenOrObservationBase<?> entity) {
+    protected void open(SpecimenOrObservationBase<?> entity, Shell shell) {
         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(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..0e4efb871952bb531b8e170364e532d63a746d22 100644 (file)
@@ -5,10 +5,10 @@ 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;
@@ -19,11 +19,11 @@ import eu.etaxonomy.taxeditor.editor.AppModelId;
 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 +33,7 @@ public class OpenDerivativeEditorForTaxonNode extends DefaultOpenHandlerBase<Tax
     }
 
     @Override
-    protected void open(ExecutionEvent event, TaxonNode entity) {
+    protected void open(TaxonNode entity, Shell shell) {
         FindOccurrencesConfigurator config = new FindOccurrencesConfigurator();
         UUID taxonUuid = entity.getTaxon().getUuid();
         config.setAssociatedTaxonUuid(taxonUuid);
@@ -43,10 +43,18 @@ 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(
+        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(TaxonNode entity) {
+        return entity.getTaxon()!=null;
+    }
+
 }
index 106ac2f1508a2025c31450435e8d9ff837d734eb..88e594591be114a4d7ab7196a1cc0759b1a866f8 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;
@@ -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 73ead02524d871fb2e4d2b83ac386f6233a06b76..557bc03cb1a3b2ad0cb7029ec88ab7a4e0c67cdc 100644 (file)
@@ -44,8 +44,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.descriptive.DescriptionElementDragListener;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
@@ -89,15 +89,18 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
 
     private DescriptiveContentProvider provider;
 
-    private ISelectionChangedListener selectionChangedListener;
+    protected ISelectionChangedListener selectionChangedListener;
 
     @Inject
-    private ESelectionService selService;
+    protected ESelectionService selService;
 
     @PostConstruct
-    public void create(Composite parent, EMenuService menuService) {
+    public void create(Composite parent, EMenuService menuService, MPart thisPart) {
         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());
@@ -124,6 +127,7 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
         //FIXME E4 implement toolbar
 //        createToolbar();
 
+        //FIXME E4 migrate drag and drop
     }
 
 //    protected void createToolbar() {
@@ -161,8 +165,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;
                 }
@@ -271,6 +275,7 @@ public class FactualDataPartE4 extends AbstractCdmEditorPartE4
     }
 
     public void toggleShowOnlyIndividualAssociations(){
+        //FIXME E4 migrate toggle menu icon
         provider.toggleShowOnlyIndividualAssociations();
         viewer.refresh();
     }
index 815c4581cd72680ed00581dca02aa956dfe9b437..20ed65f0af2daabca7f29f9d4c16f71eaee11d28 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,7 +160,7 @@ public class DescriptionsMenuPropertyTesterE4 extends PropertyTester {
        }
 
        private boolean isTaxonEditor() {
-           if(AbstractUtility.getActiveE4Editor() instanceof MultiPageTaxonEditor){
+           if(AbstractUtility.getActiveE4Editor() instanceof TaxonNameEditorE4){
                return true;
            }
            return false;
index edc94df8cbf8d439cfa7e4a8bdafa609de94518b..843ce33a5106a3267e5c5cc9ce50ca4419d83fa6 100644 (file)
@@ -38,10 +38,8 @@ 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;
@@ -62,7 +60,7 @@ import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
  */
 public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
     private UUID newAcceptedTaxonNodeUuid;
-    private TaxonNameEditor editor;
+    private TaxonNameEditorE4 editor;
 
     @Execute
     public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@@ -71,8 +69,8 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
 
         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,7 +125,7 @@ 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(),
@@ -150,11 +148,12 @@ public class MoveDescriptionElementsHandlerE4 implements IPostOperationEnabled{
                 //AbstractUtility.close(editor.getMultiPageTaxonEditor());
 
                 try {
-                    MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
-                    if(possibleOpenEditor != null){
-                        AbstractUtility.close(possibleOpenEditor);
-                    }
-                    EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+                    //FIXME E4 migrate
+//                    MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
+//                    if(possibleOpenEditor != null){
+//                        AbstractUtility.close(possibleOpenEditor);
+//                    }
+                    EditorUtil.openTaxonNodeE4(newAcceptedTaxonNodeUuid);
                 } catch (PartInitException e) {
                     MessagingUtils.error(this.getClass(), e);
                     throw new RuntimeException(e);
@@ -181,7 +180,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..f9c7a64c39ae47633a47bf5ad1c6209d25180cbe 100644 (file)
@@ -21,7 +21,6 @@ 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 +29,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,7 +51,7 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
     private MoveDescriptionToOtherTaxonOperation operation;
 
     private UUID newAcceptedTaxonNodeUuid;
-    private MultiPageTaxonEditor editor;
+    private TaxonNameEditorE4 editor;
 
     @Execute
     public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart,
@@ -64,13 +61,13 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
 
         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 +87,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,7 +117,7 @@ public class MoveDescriptionToOtherTaxonHandlerE4 implements IPostOperationEnabl
                     newAcceptedTaxonNode,
                     this,
                     editor,
-                    (ICdmEntitySessionEnabled)editor.getEditorInput());
+                    editor.getEditorInput());
             AbstractUtility.executeOperation(operation);
         }
 
@@ -135,17 +131,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);
+//                } 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 +166,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();
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/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 5348c7db59960b89fe0968322cfa397c7736b087..dffc96cb325b75272e3935089260c04c95163796 100644 (file)
@@ -26,9 +26,9 @@ 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.view.descriptive.DescriptiveViewPart;
+import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
+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.model.AbstractUtility;
@@ -54,8 +54,9 @@ public class MediaViewPartE4 extends AbstractCdmEditorPartE4
        private ESelectionService selService;
 
        @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));
 
@@ -82,7 +83,7 @@ public class MediaViewPartE4 extends AbstractCdmEditorPartE4
            Object partObject = createPartObject(activePart);
 
            if (partObject instanceof DetailsPartE4 || partObject instanceof SupplementalDataPartE4
-                   || partObject instanceof DescriptiveViewPart) {
+                   || partObject instanceof FactualDataPartE4) {
                // do not show empty page as these views are also used to edit the
                // description selected in this view
                return;
@@ -96,8 +97,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;
                    }
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..aebaa98
--- /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.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.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) {
+
+        this.thisPart = thisPart;
+
+        TreeViewer treeViewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
+                | SWT.V_SCROLL | SWT.FULL_SELECTION));
+        treeViewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
+        treeViewer.setLabelProvider(new UsesLabelProvider());
+        treeViewer.setAutoExpandLevel(2);
+
+        viewer = treeViewer;
+
+
+        //FIXME E4 migrate drag and drop
+        Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
+//      viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
+//              this));
+//      viewer.addDropSupport(dndOperations, transfers,
+//              new DescriptionElementDropAdapter(viewer));
+
+        // Propagate selection from viewer
+        selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
+        viewer.addSelectionChangedListener(selectionChangedListener);
+
+        //FIXME E4 migrate toggle actions
+//        showAllElementsAction = new ToggleDescriptionAction(false);
+//        hideAllElementsAction = new ToggleDescriptionAction(true);
+
+        //create context menu
+        menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.editor.popupmenu.usesView");
+
+        //FIXME E4 implement toolbar
+//        createToolbar();
+    }
+
+    @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 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 101ad1d688931b22d01b263c375faa20d3fd15c2..20684c3f3d3b655243c3f49dca538bee5db88151 100644 (file)
@@ -20,7 +20,12 @@ 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"
+ 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
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Import-Package: org.eclipse.core.resources,
  org.eclipse.core.runtime,
index f31de2d05301df44031a34fe1eeea604a8450f82..804722483296cb51a635c6021e649421720acc8a 100644 (file)
@@ -1,6 +1,72 @@
 <?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">
   <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="_-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>
+      <menus xsi:type="menu:PopupMenu" xmi:id="_XNXnkJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator">
+        <children xsi:type="menu:Menu" xmi:id="_yzFmYJIvEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menu.new" label="%menu.label">
+          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_7FKxUJIvEeeJAdt8ZUxyaw" coreExpressionId="isCdmStoreConnected"/>
+          <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="_mLjosJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.setsecforsubtree" label="%command.label.setSecForSubtree" command="_uFj1YJIxEeeJAdt8ZUxyaw"/>
+        <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:HandledMenuItem" xmi:id="_rWZV4JIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.import" visible="false" label="%command.label.8"/>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_wNp_wJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.export" visible="false" label="%command.label.9"/>
+        <children xsi:type="menu:MenuSeparator" xmi:id="_x0uEMJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.menuseparator.3" visible="false"/>
+        <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: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">
+          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_LmLlYJJYEee-eM8NeuXskA" coreExpressionId="isCdmStoreConnected"/>
+        </children>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_1JIbQJIwEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.navigation.handledmenuitem.copy" label="%command.label.12" command="_EJ-u0JIyEeeJAdt8ZUxyaw"/>
+      </menus>
+    </elements>
+  </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_wITZ8JIVEeeJAdt8ZUxyaw" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="">
+    <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">
+      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wITZ8pIVEeeJAdt8ZUxyaw" coreExpressionId="isCdmStoreConnected"/>
+      <command href="../eu.etaxonomy.taxeditor.store/fragment.e4xmi#_bnVKsCZxEeeQLpuomSmVoQ"/>
+      <parameters xmi:id="_wITZ85IVEeeJAdt8ZUxyaw" elementId="eu.etaxonomy.taxeditor.store.showView.parameter.detailsView" 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="_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"/>
+  </fragments>
 </fragment:ModelFragments>
index 7d33aed75713950766e926b18b3bb0f2a5054cb1..0744b6fff1780415f9f890d2113995b6b3cf19fa 100644 (file)
             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"
       </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"
    </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"
             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">
             </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>  
    <extension
          point="org.eclipse.ui.navigator.navigatorContent">
       <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">
index d6f3919b9e0515fc0878fd4441873afe57791477..b0b678b59d890fe501e431c459bb16b6ec193019 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
 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;
@@ -54,6 +53,7 @@ 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.navigation.navigator.e4.TaxonNavigatorE4;
 import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
@@ -95,14 +95,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, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
            }
            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){
                UUID entityUuid = selectedObject.getUuid();
                try {
                        if(selectedObject instanceof TaxonNode){
@@ -112,11 +112,11 @@ 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);
                            }
                        }else if(selectedObject instanceof TaxonBase){
                                TaxonBase taxonBase = (TaxonBase)selectedObject;
@@ -124,7 +124,7 @@ public class NavigationUtil extends AbstractUtility{
                                        openInBulkEditor(taxonBase);
                                }
                                else{
-                                       EditorUtil.openTaxonBase(entityUuid);
+                                       EditorUtil.openTaxonBaseE4(entityUuid);
                                }
                        }else if(selectedObject instanceof TaxonName){
                                openInBulkEditor(selectedObject);
@@ -178,7 +178,7 @@ public class NavigationUtil extends AbstractUtility{
         */
        public static void openEmpty(UUID parentNodeUuid) {
                try {
-                       EditorUtil.openEmpty(parentNodeUuid);
+                       EditorUtil.openEmptyE4(parentNodeUuid);
                } catch (PartInitException e) {
                        MessagingUtils.error(NavigationUtil.class, ERROR_OPENING_THE_EDITOR, e);
                }
@@ -312,7 +312,7 @@ public class NavigationUtil extends AbstractUtility{
 
        private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) {
                if(acceptedTaxa.size() == 1){
-                       openEditor(acceptedTaxa.iterator().next());
+                       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);
@@ -329,7 +329,7 @@ public class NavigationUtil extends AbstractUtility{
                        Set<TaxonNode> taxonNodes) {
 
                if(taxonNodes.size() == 1){
-                       openEditor(taxonNodes.iterator().next());
+                       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.");
@@ -348,23 +348,10 @@ public class NavigationUtil extends AbstractUtility{
                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();
+       public static TaxonNavigatorE4 getNavigator(boolean restore) {
+           //FIXME E4 migrate or delete
+           return null;
+//             return (TaxonNavigatorE4) getView(TaxonNavigator.ID, restore);
        }
 
        /**
index 0ec7431c9cf026e110b40767cdd0df19a89526de..bdbcf52928aa0433ddf7977cefeb52e5eb80bc23 100644 (file)
@@ -5,19 +5,16 @@ 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.navigation.navigator.e4.TaxonNavigatorE4;
 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,7 +22,7 @@ public class NavigatorStateManager extends ContextListenerAdapter {
         */
        @Override
        public void contextStart(IMemento memento, IProgressMonitor monitor) {
-               TaxonNavigator navigator = NavigationUtil.getNavigator(true);
+               TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
                if(navigator != null){
                        navigator.init();
                        if (PreferencesUtil.isStoreNavigatorState()){
@@ -33,21 +30,18 @@ public class NavigatorStateManager extends ContextListenerAdapter {
                        } 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);
+               TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(true);
                if(navigator != null){
                        navigator.refresh();
                }
        }
-       
+
        /**
         * {@inheritDoc}
         *
@@ -59,31 +53,29 @@ public class NavigatorStateManager extends ContextListenerAdapter {
                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);
-       
+
        }
-       
+
        /**
         * @param memento
         */
        private void saveNavigatorState(IMemento memento, IProgressMonitor monitor) {
-               TaxonNavigator navigator = NavigationUtil.getNavigator(false);
+               TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
                if(navigator != null){
-                       navigator.save(memento, monitor);
+                   //FIXME E4 migrate or delete
+//                     navigator.save(memento, monitor);
                }
        }
-       
+
        /**
         * Removes all content form the TaxonNavigator
         */
        private void clearNavigator() {
-               TaxonNavigator navigator = NavigationUtil.getNavigator(false);
+               TaxonNavigatorE4 navigator = NavigationUtil.getNavigator(false);
                if(navigator != null){
                        navigator.clear();
                }
index b539552d1e9fb8b1d4ee06b70736f44944f9c3a0..32461447357005eb038a5f14baa3f8a123b9b304 100644 (file)
@@ -19,6 +19,7 @@ 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 org.eclipse.ui.PlatformUI;
 
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
@@ -59,7 +60,7 @@ public class EditPolytomousKeyNodesHandler extends AbstractHandler {
 
                                                                @Override
                                                                public void run() {
-                                                                       NavigationUtil.openEditor((PolytomousKey) selectedObject);
+                                                                       NavigationUtil.openEditor((PolytomousKey) selectedObject, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
                                                                }
 
                                                        });
index a1b71ab146c0731845ebabd577c48f8056842fb2..15b1994efc7976bb512301050c385f5c5bd7c7d3 100644 (file)
@@ -30,11 +30,11 @@ import org.eclipse.jface.viewers.TreePath;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IViewSite;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 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;
@@ -137,7 +137,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 +166,8 @@ public class TaxonNavigator extends CommonNavigator implements
                    CdmApplicationState.getCurrentDataChangeService().register(this);
                }
                CdmStore.getLoginManager().addObserver(this);
-               
-               
+
+
        }
 
        /**
@@ -469,7 +469,7 @@ public class TaxonNavigator extends CommonNavigator implements
                if(selection instanceof IStructuredSelection){
                        Object firstElement = ((IStructuredSelection) selection).getFirstElement();
                        if(firstElement instanceof ICdmBase){
-                               NavigationUtil.openEditor((ICdmBase) firstElement);
+                               NavigationUtil.openEditor((ICdmBase) firstElement, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
                        }
                }
                // If the double click is passed up to the super-class it will
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 375c9ad82b5c8bc0569c653a9c0858f777169120..a4a93ad7b5a5dcb2812475d52eebea46d956e0aa 100644 (file)
@@ -35,10 +35,12 @@ 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.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.operation.e4.RemotingCdmHandlerE4;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -168,7 +170,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
        private IStatus moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) {
 
                TaxonNavigator taxonNavigator;
-               taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
+               taxonNavigator = (TaxonNavigator) AbstractUtility.showView(TaxonNavigator.ID);
 
                if(targetITaxonTreeNode instanceof TaxonNode){
 
@@ -195,7 +197,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
                        }
 
                        AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
-                       NavigationUtil.executeOperation(operation, null);
+                       AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
 
 
                        logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
@@ -213,7 +215,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
                                }
 
                                AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, (TaxonNode)targetITaxonTreeNode, MovingType.CHILD);
-                               NavigationUtil.executeOperation(operation, null);
+                               AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
 
 
                                logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
@@ -227,7 +229,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
                                TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
 
                                AbstractOperation operation = new RemotingMoveTaxonOperation(taxonNavigator, false, uuids, targetNode, MovingType.BEHIND);
-                               NavigationUtil.executeOperation(operation, null);
+                               AbstractUtility.executeOperation(operation, (RemotingCdmHandlerE4)null);
 
                                logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
                                return Status.OK_STATUS;
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..fc12306
--- /dev/null
@@ -0,0 +1,435 @@
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the 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.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.e4.ui.di.Focus;
+import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+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.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;
+
+/**
+ *
+ * @author pplitzner
+ * @since Sep 7, 2017
+ *
+ */
+public class TaxonNavigatorE4 implements
+               IPostOperationEnabled, IConversationEnabled, Observer,
+               ICdmEntitySessionEnabled, ICdmChangeListener, IContextListener {
+
+    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 ConversationHolder conversation;
+
+       private ICdmEntitySession cdmEntitySession;
+
+       private IDataChangeBehavior dataChangeBehavior;
+
+       private Root root;
+
+       private TreeViewer viewer;
+
+    @Inject
+    private ESelectionService selService;
+
+    private ISelectionChangedListener selectionChangedListener;
+
+       @Inject
+    public TaxonNavigatorE4() {
+           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(parent);
+           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());
+                }
+            }
+        });
+
+        //propagate selection
+        selectionChangedListener = (event -> selService.setSelection(event.getSelection()));
+        viewer.addSelectionChangedListener(selectionChangedListener);
+
+        //create context menu
+        menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.navigator.popupmenu.taxonnavigator");
+
+           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);
+               //FIXME E4 migrate linking with editor
+//        setLinkingEnabled(true);
+
+               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());
+       }
+
+       /**
+        * 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 = NavigationUtil
+                               .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());
+       }
+
+       @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();
+               }
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       public boolean postOperation(CdmBase objectAffectedByOperation) {
+               // nothing to do here
+               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){
+            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/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..a4b147e
--- /dev/null
@@ -0,0 +1,161 @@
+/**
+ *
+ */
+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.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 {
+
+       private UUID newAcceptedTaxonNodeUuid;
+
+    @Override
+    public void execute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection,
+            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
+            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
+            MHandledMenuItem menuItem) {
+
+        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);
+            }
+               } 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..11ef785
--- /dev/null
@@ -0,0 +1,70 @@
+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 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.NavigationUtil;
+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) {
+
+        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(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,
+                    NavigationUtil.getNavigator(false), NavigationUtil.getNavigator(false));
+
+            AbstractUtility.executeOperation(operation);
+            taxonNavigator.refresh();
+        }
+    }
+
+    @CanExecute
+    private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){
+        boolean canExecute = false;
+        canExecute = selection.getFirstElement() instanceof Classification && 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..932b3f5
--- /dev/null
@@ -0,0 +1,62 @@
+/**
+* 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.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) {
+
+        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);
+                       }
+               }
+       }
+
+    @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..67698da
--- /dev/null
@@ -0,0 +1,59 @@
+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.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) {
+
+        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);
+                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 Classification && 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.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) {
 
+        TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
 
                Iterator selectionIterator = selection.iterator();
                Set<ITaxonTreeNode> treeNodes = new HashSet<ITaxonTreeNode>();
@@ -105,19 +93,19 @@ public class DeleteHandler extends AbstractHandler{
 
                                //configNodes.setDeleteTaxon(false);
                                if (taxonNode instanceof Classification && 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(!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 Classification && !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);
 
                                                //}
                                }
 
 
 
-                       } 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);
 
                                }
-                       }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/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..8cda24a
--- /dev/null
@@ -0,0 +1,112 @@
+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.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) {
+
+        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)){
+                    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)){
+                        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,26 @@ 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.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.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.operation.MoveTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -39,24 +43,21 @@ 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) {
 
-               TreeSelection selection = (TreeSelection) HandlerUtil.getCurrentSelection(event);
+        TaxonNavigatorE4 taxonNavigator = (TaxonNavigatorE4) activePart.getObject();
 
                Iterator<?> selectionIterator = selection.iterator();
                Set<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
@@ -65,8 +66,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 +75,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 +84,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;
+                                       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);
                                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..d1fa6c8
--- /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.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.services.IServiceConstants;
+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) 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());
+                       }
+               }
+       }
+
+    @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();
 
@@ -97,12 +98,12 @@ public class RemotingDeleteTaxonNodeHandler extends RemotingCdmHandler {
                        if (taxonNode instanceof Classification) {
                                String message;
                                if (taxonNode.hasChildNodes()) {
-                                       message = DeleteHandler.DO_YOU_REALLY_WANT_TO_DELETE_THE_CLASSIFICATION+DeleteHandler.THE_TREE_HAS_CHILDREN_THEY_WILL_BE_DELETED_TOO;
+                                       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,
@@ -91,7 +88,7 @@ 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,
@@ -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,
@@ -120,13 +122,13 @@ public class RemotingMoveTaxonNodeHandler extends RemotingCdmHandler {
 
         if(parentTaxonNode != null){
             if(NavigationUtil.isDirty(parentTaxonNode)){
-                MessageDialog.openWarning(activeShell,
+                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() {
-        // TODO Auto-generated method stub
-
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @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..4ae898c
--- /dev/null
@@ -0,0 +1,135 @@
+/**
+ * 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.io.common.SetSecundumForSubtreeConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+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 SetSecundumForSubtreeConfigurator 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 SetSecundumForSubtreeConfigurator(taxonNode.getUuid());
+        SetSecundumForSubtreeConfigurationWizard wizard = new SetSecundumForSubtreeConfigurationWizard(configurator);
+
+        WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), 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(),
+                        false,
+                        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 8d49f3d..0000000
+++ /dev/null
@@ -1,137 +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.io.common.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.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);
-
-           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 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 d67198ce18dc20f6b64cf531f5c1a1eb95098f40..b3e636d2672696ba02271145a8987d3612e204da 100644 (file)
@@ -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,
index 539b541d8ace330ec80549e2af1c769dca935f88..44f1c551142c5ceaf2ce54163cc471eba784ad08 100644 (file)
@@ -1,5 +1,5 @@
 <?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="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"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="org.eclipse.e4.legacy.ide.application">
     <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
-    <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"/>
   </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">
       </children>
     </elements>
   </fragments>
+  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pVVyEJFJEeeDJpjGQES7gw" featurename="addons" parentElementId="org.eclipse.e4.legacy.ide.application">
+    <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>
 </fragment:ModelFragments>
index 615341c2c704cc25bc3b82445d49bcbf36efa1ae..ec9053362654336a944b10b47e2e43ef784138cc 100755 (executable)
             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">
       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
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..b96f8b2
--- /dev/null
@@ -0,0 +1,51 @@
+/**
+* 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 javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UIEventTopic;
+
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
+
+/**
+ * @author pplitzner
+ * @since Sep 4, 2017
+ *
+ */
+public class EventUtility {
+
+    private static ITaxonEditor editor;
+
+    @PostConstruct
+    public void create(){
+        //nothing
+    }
+
+    @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 getEditor() {
+        return editor;
+    }
+
+}
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";
+
+}
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;
     }
index 4b036b57de99ed1852ca4114fc3b4227cb273402..cab471f0f4f422f74d1a2fdc56467c41fa3d934f 100644 (file)
@@ -12,7 +12,7 @@ public class OpenReferencingObjectsView extends AbstractHandler {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-        TaxeditorStorePlugin.getDefault().getWorkbench().getService(EPartService.class).showPart(
+        TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().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/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..2e72ce0
--- /dev/null
@@ -0,0 +1,38 @@
+package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
+
+import java.util.UUID;
+
+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) {
+        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..eeaa44c
--- /dev/null
@@ -0,0 +1,44 @@
+package eu.etaxonomy.taxeditor.handler.defaultHandler.e4;
+
+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.menu.MHandledMenuItem;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.eclipse.swt.widgets.Shell;
+
+public abstract class DefaultOpenHandlerBaseE4 <T> {
+
+    @Execute
+    public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell, MHandledMenuItem menuItem) {
+        String commandId = menuItem.getCommand().getElementId();
+        Object transientData = menuItem.getTransientData().get(commandId+".uuid");
+        if(transientData instanceof UUID){
+            T entity = getEntity((UUID) transientData);
+            open(entity, shell);
+        }
+    }
+
+    @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);
+
+    protected abstract boolean canExecute(T entity);
+
+}
@@ -6,13 +6,12 @@
 * The contents of this file are subject to the 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.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 +23,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) {
+    protected void open(TaxonNode entity, Shell shell) {
         EditTaxonNodeWizard taxonNodeWizard = new EditTaxonNodeWizard();
         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
index 96d5b7485d11988040cdf1e08a31f3cb046d5bac..65849db589b65c8db33e5fdc533251a8bb7c94ad 100644 (file)
@@ -34,6 +34,7 @@ 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.workbench.modeling.EPartService;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.jface.operation.IRunnableWithProgress;
 import org.eclipse.jface.resource.ColorRegistry;
@@ -71,6 +72,7 @@ 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;
@@ -284,7 +286,15 @@ public abstract class AbstractUtility {
         return Status.OK_STATUS;
     }
 
+    public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandlerE4 handler) {
+        return executeOperation_internal(operation, handler);
+    }
+
     public static IStatus executeOperation(final AbstractOperation operation, final RemotingCdmHandler handler) {
+        return executeOperation_internal(operation, handler);
+    }
+
+    private static IStatus executeOperation_internal(final AbstractOperation operation, final Object handler) {
         if (getOperationHistory() == null) {
             throw new IllegalArgumentException(
                     "There is no operation history for this context");
@@ -305,8 +315,11 @@ public abstract class AbstractUtility {
                     operation.addContext(IOperationHistory.GLOBAL_UNDO_CONTEXT);
                     status = getOperationHistory().execute(operation, 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);
@@ -552,9 +565,14 @@ public abstract class AbstractUtility {
     }
 
     public static Object getActiveE4Editor() {
+        //FIXME E4 this can be simplified/removed when fully migrated
         if(getActivePage()!=null){
             IEditorPart activeEditor = getActivePage().getActiveEditor();
-            Object wrappedPart = WorkbenchUtility.getE4WrappedPart(getActivePage().getActivePart());
+            Object activePart = getActivePage().getActivePart();
+            if(activeEditor==null){
+                activePart = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class).getActivePart();
+            }
+            Object wrappedPart = WorkbenchUtility.getE4WrappedPart(activePart);
             return wrappedPart!=null?wrappedPart:activeEditor;
         }
         return null;
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..4965e1d
--- /dev/null
@@ -0,0 +1,92 @@
+/**
+* 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.Inject;
+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.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 {
+
+    private final String label;
+
+    @Inject
+    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) {
+        IStatus allowStatus = allowOperations(selection, shell, activePart, menuItem);
+        if(allowStatus.isOK()) {
+            AbstractOperation op = prepareOperation(selection, shell, activePart, menuItem);
+            if(op != null) {
+                AbstractUtility.executeOperation(op, this);
+            }
+        } 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();
+
+}
index 40d122bc13884c7248b3ac7a4dd96bdf56a1c1c7..7ac604fb06973a689ca84e2279ef7004141ca218 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.
 */
@@ -13,15 +13,12 @@ import java.util.Arrays;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
-import eu.etaxonomy.cdm.model.name.TaxonName;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.SynonymType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.event.EventUtility;
 import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -29,7 +26,6 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
@@ -45,29 +41,31 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<TaxonRelationship> {
 
        private TermComboElement<TaxonRelationshipTypeInverseContainer> combo_taxonRelationshipType;
-       
+
        private EntitySelectionElement<Taxon> selection_relatedTaxon;
        private CheckboxElement checkBoxDoubtful;
        protected ToggleableTextElement toggleable_cache;
        private  EntitySelectionElement<Reference> secReference;
        private  EntitySelectionElement<Reference> sensuReference;
        private TextWithLabelElement text_sensu_microreference;
-       
+
 
        private TextWithLabelElement text_secundum_microreference;
 
        private TextWithLabelElement text_appendedPhrase;
-       private TaxonDetailSection taxonElement;
-       
+
+       private CheckboxElement checkbox_published;
+
+       private SelectionArbitrator selectionArbitrator;
 
 
-       private Taxon taxon; 
+       private Taxon taxon;
+
+       private TaxonDetailSection taxonElement;
 
        public TaxonRelationshipDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
                super(formFactory, formElement);
-               
-               
        }
 
        @Override
@@ -75,51 +73,56 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                        TaxonRelationship entity, int style) {
                if (!entity.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
                        combo_taxonRelationshipType = formFactory.createTermComboElement(
-                                       TaxonRelationshipTypeInverseContainer.class, 
-                                       formElement, "Relationship Type", 
+                                       TaxonRelationshipTypeInverseContainer.class,
+                                       formElement, "Relationship Type",
                                        getTaxonRelationshipTypeInverseContainer(), style);
                        combo_taxonRelationshipType.setEnabled(false);
                        selection_relatedTaxon = formFactory.createSelectionElement(
-                                       Taxon.class, getConversationHolder(), 
-                                       formElement, "Related Taxon", getRelatedTaxon(), 
+                                       Taxon.class, getConversationHolder(),
+                                       formElement, "Related Taxon", getRelatedTaxon(),
                                        EntitySelectionElement.SELECTABLE, style);
                        checkBoxDoubtful = formFactory.createCheckbox(formElement, "Relation is doubtful", entity.isDoubtful(), style);
                }else{
                        taxon = entity.getFromTaxon();
+                       toggleable_cache = formFactory.createToggleableTextField(formElement,
+                                       "Title Cache", taxon.getTitleCache(),
+                                       taxon.isProtectedTitleCache(), style);
+
+                       text_appendedPhrase = formFactory.createTextWithLabelElement(
+                                       formElement, "Appended Phrase", taxon.getAppendedPhrase(),
+                                       SWT.WRAP);
+
+
                        taxonElement = formFactory.createTaxonDetailSection(getConversationHolder(), formElement, null, style);
                        taxonElement.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
                        addControl(taxonElement);
                        addElement(taxonElement);
-                       
+
                        sensuReference = formFactory.createSelectionElement(Reference.class,
                                getConversationHolder(), formElement, "Sensu",
                                taxon.getSec(), EntitySelectionElement.ALL,
                                style);
-       
+
                        text_sensu_microreference = formFactory.createTextWithLabelElement(
                                        formElement, "Detail",
                                        taxon.getSecMicroReference(),null,
                                        SWT.WRAP);
-       
-                       
-               
-               
-                       
-                               
+
+                       checkbox_published = formFactory.createCheckbox(formElement,
+                                               "Published", taxon.isPublish(), style);
+
                        secReference = formFactory.createSelectionElement(Reference.class,
                                        getConversationHolder(), formElement, "Misappl. Sec.",
                                        entity.getCitation(), EntitySelectionElement.ALL,
                                        style);
-               
+
                        text_secundum_microreference = formFactory.createTextWithLabelElement(
                            formElement, "Detail",
                            entity.getCitationMicroReference(),null,
                            SWT.WRAP);
-                       
                }
-               
        }
-       
+
        private Taxon getRelatedTaxon() {
                return TaxonRelationshipTypeInverseContainer.RelatedTaxon(getSourceTaxon(), getEntity());
        }
@@ -127,10 +130,13 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
        private TaxonRelationshipTypeInverseContainer getTaxonRelationshipTypeInverseContainer(){
                return TaxonRelationshipTypeInverseContainer.CreateFromSource(getSourceTaxon(), getEntity());
        }
-       
+
        private Taxon getSourceTaxon(){
-               IEditorInput editorInput = StoreUtil.getActiveEditorInput();
-               return (Taxon) editorInput.getAdapter(Taxon.class);
+           IEditorInput input = StoreUtil.getActiveEditorInput();
+           if(input!=null){
+               return input.getAdapter(Taxon.class);
+           }
+               return EventUtility.getCurrentTaxon();
        }
 
        @Override
@@ -157,17 +163,42 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                        }else if(eventSource==checkBoxDoubtful){
                            getEntity().setDoubtful(checkBoxDoubtful.getSelection());
                        }
-               }       
+               }
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
-       
-       
-        
-        
+
+       protected void handleToggleableCacheField() {
+        boolean pushedState = toggleable_cache.getState();
+
+        taxon.setTitleCache(toggleable_cache.getText(), pushedState);
+        setIrrelevant(pushedState, Arrays.asList(new Object[] { toggleable_cache, checkbox_published}));
+        updateToggleableCacheField();
+    }
+
+        public void updateToggleableCacheField() {
+                if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+               if (toggleable_cache != null){
+                   if (!taxon.isProtectedTitleCache()) {
+                       toggleable_cache.setText(taxon.generateTitle());
+                   }
+               }
+                }
+           }
+
+        @Override
+               protected void updateContent() {
+                super.updateContent();
+                if (getEntity().getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
+
+                       toggleable_cache.setEnabled(taxon.isProtectedTitleCache());
+                       setIrrelevant(toggleable_cache.getState(),
+                                       Arrays.asList(new Object[] { toggleable_cache, checkbox_published}));
+                }
+               }
         @Override
            protected void updateControlStates() {
                super.updateControlStates();
-              
+
            }
         @Override
         protected void handleTitleCacheRelevantChange(PropertyChangeEvent event) {
@@ -177,11 +208,11 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                        super.handleTitleCacheRelevantChange(event);
                 }
         }
-        
+
        @Override
        public void refresh(){
                 updateContent();
-               
+
         }
 
        @Override
@@ -190,7 +221,7 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                if (taxonElement!=null) {
                        taxonElement.setEntity(entity.getFromTaxon());
         }
-       
+
        }
-       
+
 }
index 4e472e4a40dd4f47ac2e25d0a67b7ff1cfca73ee..0510c35a333b84b29e449eaac4ebca44518f295c 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;
 
@@ -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 24e37eb3700ee827599fbcb4d790c23587af2678..0fea877323aa635fad9801999d4f9192a299b0b3 100644 (file)
@@ -117,6 +117,8 @@ public abstract class AbstractCdmEditorPartE4
 
     protected Viewer viewer;
 
+    protected MPart thisPart;
+
     protected MPart selectionProvidingPart;
 
     /** {@inheritDoc} */
@@ -134,6 +136,20 @@ public abstract class AbstractCdmEditorPartE4
                 }
             }
         }
+        if(object!=null){
+            createPartTitle(object);
+        }
+    }
+
+    protected void createPartTitle(Object selectedObject){
+        if(thisPart!=null){
+            if(selectedObject!=null){
+                thisPart.setLabel(getViewName()+": "+selectedObject); //$NON-NLS-1$
+            }
+            else{
+                thisPart.setLabel(getViewName());
+            }
+        }
     }
 
     public Viewer getViewer() {
@@ -169,6 +185,7 @@ public abstract class AbstractCdmEditorPartE4
                 }
                viewer.setInput(element);
 
+               createPartTitle(element);
 
             }
             selectionProvidingPart = activePart;
@@ -185,7 +202,7 @@ public abstract class AbstractCdmEditorPartE4
     }
 
     protected void showEmptyPage() {
-        if(viewer!=null){
+        if(viewer!=null && viewer.getControl()!=null && viewer.getControl().isDisposed()){
             viewer.setInput(null);
         }
         selectionProvidingPart = null;
index ddb03224210006c34b872da708653dc52d7ffb38..696fc7c2396b1a6b4f149ba75f427507f70bbda7 100644 (file)
@@ -45,7 +45,10 @@ public class DetailsPartE4 extends AbstractCdmEditorPartE4 implements IPartConte
     }
 
     @PostConstruct
-    public void create(Composite parent) {
+    public void create(Composite parent, MPart thisPart) {
+
+        this.thisPart = thisPart;
+
         viewer = new DetailsViewerE4(parent, this);
 
         // Propagate selection from viewer
index b9f10b6fe5866493ff481cbb61eae6e28bec82e7..2ebe1c6e02cd3a62d4b8d4676b97033982e51894 100644 (file)
@@ -45,8 +45,11 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
     }
 
        @PostConstruct
-       public void create(Composite parent) {
-               viewer = new SupplementalDataViewerE4(parent, this);
+       public void create(Composite parent, MPart thisPart) {
+
+           this.thisPart = thisPart;
+
+           viewer = new SupplementalDataViewerE4(parent, this);
        }
 
     @Override
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