merge from trunk
authorCherian Mathew <c.mathew@bgbm.org>
Wed, 3 Dec 2014 16:06:09 +0000 (16:06 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Wed, 3 Dec 2014 16:06:09 +0000 (16:06 +0000)
79 files changed:
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/remotingApplicationContext.xml
eu.etaxonomy.taxeditor.editor/icons/link_obj.gif [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.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/OpenTaxonEditorHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientAgentService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientCollectionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientDescriptionService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientNameService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientReferenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTermService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveContentProvider.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/handler/ToggleShowOnlyIndividualAssociationsHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/TaxonParameterConverter.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ExportManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExportToFileDestinationWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDerivedUnitFacadePart.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/MessagingUtils.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationPrimerWizardPage.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewAmplificationWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewDerivedUnitBaseWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/LanguageStringWithLabelElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/MultilanguageTextElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/PrimerGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SequenceGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SingleReadGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EditFromSelectionWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/TranslationWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchCompositeController.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/org/eclipse/wb/swt/ResourceManager.java
eu.etaxonomy.taxeditor.store/src/main/java/org/eclipse/wb/swt/SWTResourceManager.java

index dc55ce09b913620d98ccfa909fc87a6f3d820a14..88eb8d38c64f55652d3e5ba1373dd02a285b0ce5 100644 (file)
@@ -357,6 +357,7 @@ eu.etaxonomy.taxeditor.editor/icons/derivate_view-16x16-32.png -text
 eu.etaxonomy.taxeditor.editor/icons/edit_16x16.gif -text
 eu.etaxonomy.taxeditor.editor/icons/emblem-photos.png -text
 eu.etaxonomy.taxeditor.editor/icons/leaf_detail.png -text
+eu.etaxonomy.taxeditor.editor/icons/link_obj.gif -text
 eu.etaxonomy.taxeditor.editor/icons/xper64.png -text
 eu.etaxonomy.taxeditor.editor/p2.inf -text
 eu.etaxonomy.taxeditor.editor/plugin.xml -text
@@ -385,8 +386,10 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handle
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenParentHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveAllHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/SaveTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewNameHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewPersonHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewReferenceHandler.java -text
@@ -537,7 +540,9 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/DerivateViewContextMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/SingleReadSequenceContextMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java -text
@@ -552,6 +557,7 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/ToggleShowOnlyIndividualAssociationsHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/AddDerivedUnitFacadeMediaOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateDescriptionElementOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/CreateSpecimenDescriptionOperation.java -text
@@ -955,6 +961,7 @@ eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigatio
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewClassificationHandler.java -text
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/NewTaxonNodeHandler.java -text
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/RefreshTreeHandler.java -text
+eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/TaxonParameterConverter.java -text
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/ChangeAcceptedTaxonToSynonymOperation.java -text
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/CopyOperation.java -text
 eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/DeleteOperation.java -text
@@ -1302,6 +1309,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/Abst
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExcelImportWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractExportWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbstractImportWizard.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/DarwinCoreArchiveExportWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/EndnoteImportWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java -text
@@ -1337,6 +1345,7 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/FeatureN
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ICdmEditorHandle.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IContextListener.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDataChangeBehavior.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDerivedUnitFacadePart.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDirtyMarkable.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IElementHasDetails.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IPartChangeListener.java -text
@@ -1361,7 +1370,6 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/Abst
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationCloningWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationGelPhotoWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationGeneralWizardPage.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationPrimerWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/ExternalReferenceServiceWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewAmplificationWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/NewClassificationWizard.java -text
@@ -1697,6 +1705,8 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SourceCollectionDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/SpecimenCollectionDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenAbstractDeterminationEventDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenCurrentDeterminationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/derivedUnit/PreservedSpecimenDetailElement.java -text
@@ -1737,12 +1747,8 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SingleReadPherogramCollectionDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java -text
index 48e604b2dfa5827112b73199ebd58b4c68cb387a..c05e3483c3c164e4b3de53ff0a795e3ac1030c69 100644 (file)
@@ -34,7 +34,9 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.texteditor.ITextEditorActionConstants;
 
 import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineDocumentProvider;
@@ -42,9 +44,10 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -57,8 +60,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @created 07.07.2009
  * @version 1.0
  */
-public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IPartContentHasMedia,
-        IDirtyMarkable {
+public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails,
+        IDirtyMarkable, IDerivedUnitFacadePart {
 
        /** Constant <code>ID="bulkeditor.editor"</code> */
        public static final String ID = "bulkeditor.editor";
@@ -267,7 +270,8 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
            }
        }
 
-       public void forceDirty(){
+       @Override
+    public void forceDirty(){
            isDirty = true;
            firePropertyChange(PROP_DIRTY);
        }
@@ -278,7 +282,20 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
        @Override
        public void doSave(IProgressMonitor progressMonitor) {
            isDirty = false;
+           IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+                           .findView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects");
+           if (part != null){
+                       ((ReferencingObjectsView)part).dispose();
+               }
            super.doSave(progressMonitor);
+
+           selectFirstItem();
+           if (part != null){
+                       ((ReferencingObjectsView)part).refresh();
+
+               }
+               getSourceViewer().getTextWidget().setFocus();
+
        }
 
        /** {@inheritDoc} */
index dbe390743330598982811dc0a9a6ee9ecf9be97a..8f87f7d2ba2b6841160c07d859a7fca309870b06 100644 (file)
@@ -19,8 +19,11 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.IWorkbenchPage;
 
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IAgentService;
@@ -45,6 +48,8 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityPersistenceService;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
+import eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView;
+
 
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
@@ -129,7 +134,7 @@ public class DeleteHandler extends AbstractHandler {
                                        } catch (Exception e){
                                                MessagingUtils.messageDialog("Exception occured. Could not delete", getClass(), e.getMessage(), null);
                                        }
-                                       if (result.isError()){
+                                       if (result.isError() || !result.getExceptions().isEmpty()){
                                                if (!result.getExceptions().isEmpty()) {
                                                        MessagingUtils.messageDialog("Could not delete", getClass(), result.getExceptions().get(0).getMessage(), null);
                                                }else{
@@ -137,10 +142,9 @@ public class DeleteHandler extends AbstractHandler {
                                                        
                                                }
                                        }
-                                       if (result.isOk()){
+                                       if (result.isOk() && result.getExceptions().isEmpty()){
                                                ((BulkEditor) editor).removeAnnotatedLine(annotation);
-                                               
-                                               System.out.println("Test");
+
                                        }
                                }                               
                        }
index 450bc705229e64c2ee9e16d4697d17fcbd65aa2d..df5ba8d8d222d35627f77fb0b5c38610ffb749f7 100644 (file)
@@ -39,6 +39,7 @@ import eu.etaxonomy.cdm.api.service.IAgentService;
 import eu.etaxonomy.cdm.api.service.ICommonService;
 import eu.etaxonomy.cdm.api.service.IIdentifiableEntityService;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
@@ -112,7 +113,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
                
                final Display display = Display.getCurrent();
                
-       //      Job job = new Job("Update Referencing Objects") {
+               //Job job = new Job("Update Referencing Objects") {
 //                     
 //                     @Override
 //                     protected IStatus run(IProgressMonitor monitor) {
@@ -146,17 +147,18 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
         try {
                if(entity instanceof CdmBase){
                        referencedObject = (CdmBase) entity;
-                       if (referencedObject instanceof AgentBase){
+                       if (referencedObject instanceof TeamOrPersonBase){
                                referencedObject = CdmStore.getService(IAgentService.class).load(referencedObject.getUuid());
                        }
                        //referencedObject =(CdmBase) CdmStore.getService(IIdentifiableEntityService.class).load(referencedObject.getUuid());
                        Set<CdmBase> setOfReferencingObjects = CdmStore.getService(ICommonService.class).getReferencingObjects(referencedObject);
-                       
-                       List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);                     
-                       
-                       Collections.sort(referencingObjects, new ReferencingClassComparator());
-                       
-                       return referencingObjects;
+                       if (setOfReferencingObjects != null){
+                               List<CdmBase> referencingObjects = new ArrayList<CdmBase>(setOfReferencingObjects);                     
+                               
+                               Collections.sort(referencingObjects, new ReferencingClassComparator());
+                               
+                               return referencingObjects;
+                       }
                }
         } catch (Exception e) {
             logger.error("Error retrieving referencing objects", e);
@@ -233,6 +235,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                super.dispose();
+               
        }
 
        /* (non-Javadoc)
@@ -261,6 +264,14 @@ public class ReferencingObjectsView extends AbstractCdmViewPart implements INull
        public boolean onComplete() {
                return false;
        }
+       
+       public void refresh(){
+               selectionService.removePostSelectionListener(this);
+               selectionService.removeSelectionListener(this);
+               selectionService.addPostSelectionListener(this);
+               selectionService.addSelectionListener(this);
+               
+       }
 
 
 }
index 86c822eedfa5d158510fbe37bed66ee5da24fea5..1885ddd71b96957a52b9e0716dfa326cb2345f39 100644 (file)
@@ -55,6 +55,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.cdm.io.common.events,
  eu.etaxonomy.cdm.io.common.mapping,
  eu.etaxonomy.cdm.io.common.mapping.out,
+ eu.etaxonomy.cdm.io.csv.redlist.demo,
  eu.etaxonomy.cdm.io.csv.redlist.out,
  eu.etaxonomy.cdm.io.dwca,
  eu.etaxonomy.cdm.io.dwca.in,
index 6be6919246bfc5ea792d8b1528afe39b20897e0f..f122d18eb3dc948b16be3a74afea317ebdf08f2a 100644 (file)
@@ -10,11 +10,11 @@ import eu.etaxonomy.cdm.model.common.CdmBase;
 
 /**
  * Class which uses CDM services to cache cdm entities
- * 
- * FIXME: Currently only handles terms entities. It would be 
+ *
+ * FIXME: Currently only handles terms entities. It would be
  *        interesting to have a generic method which finds the
  *        correct service to load / cache the entity.
- * 
+ *
  * @author cmathew
  *
  * @param <T>
@@ -24,10 +24,19 @@ public class CdmServiceCacher<T extends CdmBase> extends CdmCacher<T> {
 
        @Autowired
        ITermService termService;
-       
+
        @Override
        protected T findByUuid(UUID uuid) {
                return (T)termService.findWithoutFlush(uuid);
        }
 
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.cache.CdmCacher#setup()
+     */
+    @Override
+    protected void setup() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
index 66be8d6e19cc46652413a952b5bf558e326af0ed..d1bb5ee32f8e836f684323ae5059ad38fd953b75 100644 (file)
@@ -18,7 +18,7 @@
     \r
        <import resource="classpath:/eu/etaxonomy/cdm/remoting_services_security.xml"/>         \r
        \r
-       <bean id="cdmServiceCacher" class="eu.etaxonomy.cdm.api.cache.CdmServiceCacher"/>\r
+       <bean id="cdmTermCacher" class="eu.etaxonomy.cdm.api.cache.CdmTermCacher"/>\r
        \r
        \r
        <!-- EditGeoService was moved to ext. Therefore it will not be found by the default component scan.
diff --git a/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif b/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif
new file mode 100644 (file)
index 0000000..5fd9c94
Binary files /dev/null and b/eu.etaxonomy.taxeditor.editor/icons/link_obj.gif differ
index 8788f3911b4eea20de1ca748fa26495ea7683b9f..86f824d1fed26ffe08f5dab5c83ca0b934d85ca3 100644 (file)
             </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="Show Only Individuals Associations">
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup?after=taxeditor-navigation.separator2">
+         <command
+               commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+               label="Open Associated Derivates"
+               style="push">
+         </command>
+         <separator
+               name="eu.etaxonomy.taxeditor.editor.separator1"
+               visible="true">
+         </separator>
+      </menuContribution>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
             </with>
          </activeWhen>
       </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.OpenDerivateEditorForTaxonHandler"
+            commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView">
+         <activeWhen>
+            <with
+                  variable="activePartId">
+               <equals
+                     value="eu.etaxonomy.taxeditor.navigation.navigator">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.ToggleShowOnlyIndividualAssociationsHandler"
+            commandId="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations">
+      </handler>
    </extension>
    <extension
          name="%extension.name"
             id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
             name="%command.name.39">
       </command>
+      <command
+            id="eu.etaxonomy.taxeditor.editor.handler.showOnlyIndividualAssociations"
+            name="Show Only Individual Associations">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenTaxonEditorHandler"
+            id="eu.etaxonomy.taxeditor.editor.openTaxonEditor"
+            name="Open Taxon Editor">
+         <commandParameter
+               id="eu.etaxonomy.taxeditor.editor.taxonParameter"
+               name="taxonUUID"
+               optional="false"
+               typeId="eu.etaxonomy.taxeditor.editor.taxonParameterType">
+         </commandParameter>
+      </command>
+      <commandParameterType
+            converter="eu.etaxonomy.taxeditor.editor.handler.TaxonParameterConverter"
+            id="eu.etaxonomy.taxeditor.editor.taxonParameterType"
+            type="eu.etaxonomy.cdm.model.taxon.TaxonBase">
+      </commandParameterType>
    </extension>
    <extension
          point="org.eclipse.core.expressions.definitions">
index d3f414a0334e9c9f93ee75f1216c7e1ea9d12b9a..c9350145261000221c842ae1127f8c5d96779a32 100644 (file)
@@ -27,16 +27,18 @@ import org.eclipse.ui.IEditorReference;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
+import eu.etaxonomy.cdm.api.service.ITaxonService;
 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.TaxonBase;
 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.view.checklist.ChecklistEditorInput;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditor;
+import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
 import eu.etaxonomy.taxeditor.editor.view.dataimport.BioCaseEditorInput;
 import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditor;
 import eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportEditorInput;
@@ -46,6 +48,8 @@ import eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportEditor;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * Utility for the editor package
@@ -157,6 +161,11 @@ public class EditorUtil extends AbstractUtility {
         */
        public static void openTaxonBase(UUID taxonBaseUuid)
                        throws PartInitException {
+           TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
+        if (taxonBase != null && taxonBase.isOrphaned()) {
+                MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
+                return;
+        }
                TaxonEditorInput input = TaxonEditorInput
                                .NewInstanceFromTaxonBase(taxonBaseUuid);
                open(input);
@@ -433,4 +442,15 @@ 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());
+        }
+    }
 }
index b331b88f5d9ffd68c6809371900c98d2d7e1d91b..3f79f3a00a4566070076ad876293795714767a58 100644 (file)
@@ -48,9 +48,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPersistableElement {
 
-       private ConversationHolder conversation;
+       private final ConversationHolder conversation;
 
-       private TaxonNode taxonNode;
+       private final TaxonNode taxonNode;
 
        private TaxonEditorInputDataChangeBehaviour dataChangeBehavior;
 
@@ -111,16 +111,13 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
 
        TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
        if (taxonBase != null){
-               if(taxonBase.isOrphaned()) {
-                       MessagingUtils.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
-               }
-               else if(taxonBase.isInstanceOf(Taxon.class)){
+               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("trying to open Mispplied Name ");
-       
+
                                Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
                                Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
                                for(TaxonRelationship relation : relations){
@@ -129,13 +126,13 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
                                        }
                                }
                                input =  getInputForMultipleTaxa(conversation, acceptedTaxa);
-       
+
                        }else{
                                input = getInputForMultipleNodes(conversation, taxon.getTaxonNodes());
                        }
                }else if(taxonBase instanceof Synonym){
                        Synonym synonym = (Synonym) taxonBase;
-       
+
                        Set<Taxon> taxa = synonym.getAcceptedTaxa();
                        input = getInputForMultipleTaxa(conversation, taxa);
                }
@@ -143,7 +140,7 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
                        input.setInitiallySelectedTaxonBase(taxonBase);
                }
        }
-       
+
 
        return input;
     }
index d6f0df7e6295919e1ff516db44d7c115dfe021f8..fcac2fc731672486bebd5e020129b56ee3e1fc5c 100644 (file)
@@ -1,5 +1,10 @@
 package eu.etaxonomy.taxeditor.editor.handler;
 
+import java.util.HashSet;
+import java.util.Iterator;
+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;
@@ -22,18 +27,22 @@ public class OpenDerivateViewHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
         if(currentSelection instanceof IStructuredSelection){
-            Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
-            if(selectedElement instanceof SpecimenOrObservationBase<?>){
-
-                DerivateViewEditorInput input = new DerivateViewEditorInput(((SpecimenOrObservationBase<?>) selectedElement).getUuid());
-                try {
-                    EditorUtil.open(input);
-                } catch (PartInitException e) {
-                    MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open DerivateView", e);
-                } catch (NullPointerException npe){
-                    MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open DerivateView. The derivate hierarchy is corrupted!", npe);
+            Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
+            Set<UUID> selectedElementUUIDs = new HashSet<UUID>();
+            while(selectionIterator.hasNext()){
+                Object object = selectionIterator.next();
+                if(object instanceof SpecimenOrObservationBase<?>){
+                    selectedElementUUIDs.add(((SpecimenOrObservationBase<?>) object).getUuid());
                 }
             }
+            DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs);
+            try {
+                EditorUtil.open(input);
+            } catch (PartInitException e) {
+                MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivate Editor", e);
+            } catch (NullPointerException npe){
+                MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivate Editor. The derivate hierarchy is corrupted!", npe);
+            }
         }
         return null;
     }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java
new file mode 100644 (file)
index 0000000..b416726
--- /dev/null
@@ -0,0 +1,32 @@
+package eu.etaxonomy.taxeditor.editor.handler;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.ParameterType;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+
+public class OpenTaxonEditorHandler extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        Object object = event.getObjectParameterForExecution("eu.etaxonomy.taxeditor.editor.taxonParameter");
+
+        try {
+            ParameterType parameterType = event.getCommand().getParameterType("eu.etaxonomy.taxeditor.editor.taxonParameter");
+            if(parameterType.isCompatible(object)){
+                EditorUtil.openTaxonEditor(object);
+            }
+        } catch (NotDefinedException e) {
+            MessagingUtils.error(this.getClass(), "Parameter type not defined", e);
+        } catch (PartInitException e) {
+            MessagingUtils.error(OpenTaxonEditorHandler.class, "Error opening the editor", e);
+        }
+        return null;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java
new file mode 100644 (file)
index 0000000..0283f4d
--- /dev/null
@@ -0,0 +1,30 @@
+package eu.etaxonomy.taxeditor.editor.handler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class TaxonParameterConverter extends AbstractParameterValueConverter {
+
+    public TaxonParameterConverter() {
+    }
+
+    @Override
+    public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+        return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
+    }
+
+    @Override
+    public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+        if(parameterValue instanceof TaxonBase<?>){
+            return ((TaxonBase<?>) parameterValue).getUuid().toString();
+        }
+        return null;
+    }
+
+}
index e67171560099bf670e115849a818eab07ecaeb84..603473942a74f86cd57698b8b39e5d8d2d40a16b 100644 (file)
@@ -361,7 +361,9 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                        if (text.length() < start + length) {
                                length = text.length() - start;
                        }
-
+                       if (length<0){
+                               return null;
+                       }
                        return new Position(start, length);
                }
                return null;
index 0f8bd8ad8bd01b3060dd220739ab9ffb05902b75..eb6962944a98b2b5015d45bb42bf619ae164db2b 100644 (file)
@@ -739,7 +739,7 @@ public class TransientAgentService implements IAgentService {
     }
 
        @Override
-       public List<String> isDeletable(AgentBase object,
+       public DeleteResult isDeletable(AgentBase object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index 89116165b5973eff378cb68cb553ec010b99373d..a5e586377cb149569505b3fa6e1facbd4a5d45d7 100644 (file)
@@ -916,7 +916,7 @@ public class TransientClassificationService implements IClassificationService {
     }
 
        @Override
-       public List<String> isDeletable(Classification object,
+       public DeleteResult isDeletable(Classification object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index ea7b1e39b5162b931287cc1911eabaf7e1b4bf2b..b5c5e6f17c3ee42f52776c2a9e08fae9e9523d6f 100644 (file)
@@ -376,7 +376,7 @@ public class TransientCollectionService implements ICollectionService {
      * @see eu.etaxonomy.cdm.api.service.IVersionableService#isDeletable(eu.etaxonomy.cdm.model.common.VersionableEntity, eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase)
      */
     @Override
-    public List<String> isDeletable(Collection object, DeleteConfiguratorBase config) {
+    public DeleteResult isDeletable(Collection object, DeleteConfiguratorBase config) {
         return defaultService.isDeletable(object, config);
     }
 
index 3a5e1fdfbb6da399e4e5cad36fe0d9ae0ba172eb..28d143ab711454bdf347cded8e4ab026be6ff580 100644 (file)
@@ -1096,7 +1096,7 @@ public class TransientDescriptionService implements IDescriptionService {
     }
 
        @Override
-       public List<String> isDeletable(DescriptionBase object,
+       public DeleteResult isDeletable(DescriptionBase object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index 759e214c5996764f59be66692e77bac0c4142e6d..c676f03eeaf230290942e6a2bde124865611b488 100644 (file)
@@ -1135,7 +1135,7 @@ public class TransientNameService implements INameService {
     }
 
        @Override
-       public List<String> isDeletable(TaxonNameBase object,
+       public DeleteResult isDeletable(TaxonNameBase object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index 0bb16deea2dc1214ee84fd731d0d4488303ca593..ac721ba2d580f7dbe63b50da21860e887eb0ff00 100644 (file)
@@ -899,7 +899,7 @@ public class TransientOccurenceService implements IOccurrenceService {
     }
 
        @Override
-       public List<String> isDeletable(SpecimenOrObservationBase object,
+       public DeleteResult isDeletable(SpecimenOrObservationBase object,
                        DeleteConfiguratorBase config) {
                return defaultService.isDeletable(object, config);
        }
@@ -959,4 +959,23 @@ public class TransientOccurenceService implements IOccurrenceService {
         return defaultService.delete(specimen, config);
     }
 
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listAssociatedTaxa(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
+     */
+    @Override
+    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit,
+            Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {
+        return defaultService.listAssociatedTaxa(specimen, limit, start, orderHints, propertyPaths);
+    }
+
+    /* (non-Javadoc)
+     * @see eu.etaxonomy.cdm.api.service.IOccurrenceService#listTypedTaxa(eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase, java.lang.Integer, java.lang.Integer, java.util.List, java.util.List)
+     */
+    @Override
+    public Collection<TaxonBase<?>> listTypedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start,
+            List<OrderHint> orderHints, List<String> propertyPaths) {
+        return defaultService.listTypedTaxa(specimen, limit, start, orderHints, propertyPaths);
+    }
+
 }
index 528813557d1bf74e84c94f9ec343977621f8c47f..9a8602bcdc16a5ca552f92e7a36df91ed869684e 100644 (file)
@@ -692,7 +692,7 @@ public class TransientReferenceService implements IReferenceService {
     }
 
        @Override
-       public List<String> isDeletable(Reference object,
+       public DeleteResult isDeletable(Reference object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index bf2c7ae39f6725469fe2a9c1496ad9f5510ca9fd..28bce02f5683ee6152b8e4d29ae3417ce7e0fb1e 100644 (file)
@@ -1392,7 +1392,7 @@ public class TransientTaxonService implements ITaxonService {
     }
 
        @Override
-       public List<String> isDeletable(TaxonBase object,
+       public DeleteResult isDeletable(TaxonBase object,
                        DeleteConfiguratorBase config) {
                // TODO Auto-generated method stub
                return null;
index 578205af6b9fbf2ea94365554d1161b249e4dd86..4ef033f969f482b265dd7b29bb7eb763a7ac6c6e 100644 (file)
@@ -845,7 +845,7 @@ public class TransientTermService implements ITermService {
     }
 
        @Override
-       public List<String> isDeletable(DefinedTermBase object,
+       public DeleteResult isDeletable(DefinedTermBase object,
                        DeleteConfiguratorBase config) {
                return defaultTermService.isDeletable(object, config);
        }
index 1e1da7b5bde030cb6e32e859edfdf8541fd86672..023d217fe6d72aa596ad31e8fbe230a877775a1b 100644 (file)
@@ -1,10 +1,10 @@
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeNode;
@@ -34,17 +34,17 @@ public class DerivateContentProvider implements ITreeContentProvider {
 
        @Override
        public Object[] getElements(Object inputElement) {
-           SpecimenOrObservationBase<?> rootElement = null;
+           List<TreeNode> rootElements = new ArrayList<TreeNode>();
            if(inputElement instanceof DerivateViewEditorInput){
-               rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) inputElement).getRootElementUUID());
-           }
-
-           if(rootElement!=null){
-               //show topmost element in the derivate hierarchy if no field unit was found
-               TreeNode node = new TreeNode(rootElement);
-            return Collections.singleton(node).toArray();
+               Set<UUID> rootUUIDs = ((DerivateViewEditorInput) inputElement).getRootUUIDs();
+               for (UUID uuid : rootUUIDs) {
+                   SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(uuid);
+                if(rootElement!=null){
+                    rootElements.add(new TreeNode(rootElement));
+                }
+            }
            }
-           return null;
+           return rootElements.toArray();
        }
 
        @Override
index d9a10fe892d5c6bd67b694dbbe61e315cde7a395..e5148ff67db0b187cbdd377c87d89f87205265e8 100644 (file)
@@ -9,23 +9,16 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.ViewerDropAdapter;
 import org.eclipse.swt.dnd.TransferData;
 
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
-import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  * @author pplitzner
@@ -36,9 +29,6 @@ public class DerivateDropListener extends ViewerDropAdapter {
 
     private final DerivateView derivateView;
 
-    /**
-     * @param derivateView
-     */
     protected DerivateDropListener(DerivateView derivateView) {
         super(derivateView.getViewer());
         this.derivateView = derivateView;
@@ -57,30 +47,10 @@ public class DerivateDropListener extends ViewerDropAdapter {
         if(target instanceof TreeNode && data instanceof DerivateViewSelection){
             DerivateViewSelection derivateViewSelection = (DerivateViewSelection)data;
             TreeNode targetNode = (TreeNode) target;
-            TreeNode draggednode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
-            if(draggednode!=null){
-                if(moveTreeNode(draggednode, targetNode)){
-                    //update DerivateView
-                    derivateView.getConversationHolder().commit();
-                    derivateView.refreshTree();
-
-                    // update source DerivateView if dragging between different views occurred
-                    DerivateView sourceDerivateView = derivateViewSelection.getDerivateView();
-                    if(sourceDerivateView!=derivateView){
-                        sourceDerivateView.getConversationHolder().commit();
-                        sourceDerivateView.refreshTree();
-                    }
-
-                    //FIXME: way too much overhead for just refreshing the other DerivateView
-//                    CdmStore.getContextManager().notifyContextRefresh();
-                    LocalSelectionTransfer.getTransfer().setSelection(null);
-                    return true;
-                }
-                else{
-                    DerivateLabelProvider derivateLabelProvider = new DerivateLabelProvider();
-                    derivateLabelProvider.setConversation(derivateView.getConversationHolder());
-                    MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateLabelProvider.getDerivateText(draggednode)+"\" to \""+derivateLabelProvider.getDerivateText(targetNode)+"\" is not possible!");
-                }
+            TreeNode draggedNode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
+            if(draggedNode!=null){
+                MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation("Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\"", EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
+                return AbstractUtility.executeOperation(moveDerivateOperation).equals(Status.OK_STATUS)?true:false;
             }
         }
         return false;
@@ -94,48 +64,4 @@ public class DerivateDropListener extends ViewerDropAdapter {
         return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
     }
 
-    /**
-     * @param value
-     * @return
-     */
-    private boolean moveTreeNode(TreeNode draggedNode, TreeNode targetNode) {
-        Object draggedNodeValue = draggedNode.getValue();
-        Object targetNodeValue = targetNode.getValue();
-        TreeNode fromParentNode = draggedNode.getParent();
-        Object fromParentSpecimen = null;
-        if(fromParentNode!=null){
-            fromParentSpecimen = fromParentNode.getValue();
-        }
-
-        // drag'n'drop for SpecimenOrObservationBase
-        IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
-        if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
-            DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
-            SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
-            //check if type is a sub derivate type
-            if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
-            && fromParentNode!=null
-            && !fromParentNode.equals(targetNode)){//don't drag on direct parent node)
-                return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
-            }
-        }
-
-        // drag'n'drop for SingleRead
-        else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
-            SingleRead singleRead = (SingleRead) draggedNodeValue;
-            if(fromParentSpecimen instanceof Sequence){
-                return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
-            }
-        }
-
-        // drag'n'drop for Sequence
-        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-            Sequence sequence = (Sequence)draggedNodeValue;
-            if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-                return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
-            }
-        }
-        return false;
-    }
-
 }
index 963cd911fb11615a7d962ff2abe1953a7e7fb145..68445078d0e23e189d5822ff05a32bc6e8b67e7e 100644 (file)
@@ -4,6 +4,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.UUID;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.MenuManager;
@@ -52,7 +53,7 @@ import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
  *
  */
 public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkable,
-        IConversationEnabled, IPartContentHasDetails, IPartContentHasMedia, IPartContentHasSupplementalData,
+        IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IPartContentHasMedia,
         ISelectionChangedListener, IPostOperationEnabled {
 
     public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
@@ -104,11 +105,15 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         labelProvider.setMultiLinkSingleReads(multiLinkSingleReads);
         IEditorInput editorInput = getEditorInput();
         viewer.setInput(editorInput);
+        //set selection to selected derivate if only one was selected
         if(editorInput instanceof DerivateViewEditorInput){
-            SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getDerivateUUID());
-            SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getRootElementUUID());
-            setPartName(labelProvider.getDerivateText(rootElement));
-            viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+            Set<UUID> derivateUUIDs = ((DerivateViewEditorInput) editorInput).getDerivateUUIDs();
+            if(derivateUUIDs.size()==1){
+                SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(derivateUUIDs.iterator().next());
+                if(specimen!=null){
+                    viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+                }
+            }
         }
 
         //add drag'n'drop support
@@ -122,7 +127,12 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      */
     @Override
     public void doSave(IProgressMonitor monitor) {
-        monitor.beginTask("Saving Derivates", 3);
+        String taskName = "Saving hierarchy";
+        if(getEditorInput() instanceof DerivateViewEditorInput){
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+            taskName += " "+derivateViewEditorInput.getName();
+        }
+        monitor.beginTask(taskName, 3);
         if (!conversation.isBound()) {
             conversation.bind();
         }
@@ -151,6 +161,10 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      */
     @Override
     public String getTitleToolTip() {
+        if(getEditorInput() instanceof DerivateViewEditorInput){
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+            return derivateViewEditorInput.getName();
+        }
         return "Derivate View";
     }
 
@@ -162,7 +176,9 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         setSite(site);
         setInput(input);
         if(input instanceof DerivateViewEditorInput){
-            conversation = ((DerivateViewEditorInput) input).getConversationHolder();
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) input;
+            conversation = derivateViewEditorInput.getConversationHolder();
+            setPartName(derivateViewEditorInput.getName());
         }
     }
 
@@ -290,13 +306,14 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         this.selection  = event.getSelection();
     }
 
-    /**
-     * @return the selection
-     */
     public ISelection getSelection() {
         return selection;
     }
 
+    public DerivateLabelProvider getLabelProvider() {
+        return labelProvider;
+    }
+
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
      */
@@ -304,19 +321,9 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
     public boolean postOperation(CdmBase objectAffectedByOperation) {
         refreshTree();
         if(objectAffectedByOperation!=null){
-            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
-            if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getRootElementUUID())){
-                // TODO close derivate view if root element is deleted
-//                this.getViewer().setEditorSite().getPage().close();
-                return true;
-            }
-            else if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getDerivateUUID())){
-                derivateViewEditorInput.setRootAsDerivate();
-            }
             changed(objectAffectedByOperation);
-            return true;
         }
-        return false;
+        return true;
     }
 
     /* (non-Javadoc)
index c323cb3f0621f4e74b88a409a45499e2a0cab642..0d677cd096f6738ac89c2d2b26d8428aacd90a06 100644 (file)
@@ -9,6 +9,8 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
+import java.util.HashSet;
+import java.util.Set;
 import java.util.UUID;
 
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -23,6 +25,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  * Editor input for the {@link DerivateView} which holds the currently selected derivate for which
@@ -35,38 +38,43 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class DerivateViewEditorInput implements IEditorInput{
 
     /**
-     * The selected derivate {@link UUID}
+     * The selected derivate {@link UUID}s
      */
-    private UUID derivateUUID;
+    private Set<UUID> derivateUUIDs;
     /**
-     * The {@link UUID} of the root of the hierarchy (may be the same object as the derivate)
+     * List of the {@link UUID}s of the root elements of the hierarchy (may be the same objects as the derivates)
      */
-    private UUID rootUUID;
+    private Set<UUID> rootUUIDs;
 
     private final ConversationHolder conversationHolder;
 
     /**
-     * Creates an editor input for the {@link DerivateView} with the currently selected derivate and the
-     * corresponding {@link FieldUnit} (both may be the same object).
-     * @param derivateUuid the {@link UUID} of the derivate for which the derivate hierarchy should be shown
-     * @param rootUUID the root of the hierarchy
+     * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
+     * corresponding {@link FieldUnit}s (both may be the same object).
+     * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
+     * @param rootUUIDs the root of the hierarchy
      */
-    public DerivateViewEditorInput(UUID derivateUuid) {
+    public DerivateViewEditorInput(Set<UUID> derivateUuids) {
         super();
         this.conversationHolder = CdmStore.createConversation();
-        this.derivateUUID = derivateUuid;
-        SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(derivateUuid);
-        if(derivate instanceof FieldUnit){
-            this.rootUUID = derivateUUID;
-        }
-        else if(derivate instanceof DerivedUnit){
-            SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
-            rootUUID = topMostDerivate==null?null:topMostDerivate.getUuid();
-            if(rootUUID==null){
-                rootUUID = derivateUUID;
+        this.derivateUUIDs = derivateUuids;
+        this.rootUUIDs = new HashSet<UUID>();
+        for (UUID uuid : derivateUuids) {
+            SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(uuid);
+            if(derivate instanceof FieldUnit){
+                rootUUIDs.add(uuid);
+            }
+            else if(derivate instanceof DerivedUnit){
+                SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
+                if(topMostDerivate!=null){
+                    rootUUIDs.add(topMostDerivate.getUuid());
+                }
             }
         }
-        if(rootUUID==null){
+        if(rootUUIDs.isEmpty()){
+            rootUUIDs = derivateUUIDs;
+        }
+        if(rootUUIDs.isEmpty()){
             MessagingUtils.messageDialog("Failed initializing editor", DerivateViewEditorInput.class, "No root element found!");
         }
     }
@@ -102,7 +110,7 @@ public class DerivateViewEditorInput implements IEditorInput{
      */
     @Override
     public String getName() {
-        return derivateUUID.toString();
+        return getEditorName();
     }
 
     /* (non-Javadoc)
@@ -118,19 +126,35 @@ public class DerivateViewEditorInput implements IEditorInput{
      */
     @Override
     public String getToolTipText() {
-        return derivateUUID.toString();
+        return getEditorName();
+    }
+
+    private String getEditorName() {
+        String name = null;
+        for(UUID uuid:rootUUIDs){
+            SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(uuid);
+            if(specimen!=null){
+                if(name==null){
+                    name = DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+                }
+                else{
+                    name += " + "+DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+                }
+            }
+        }
+        return name;
     }
 
-    public UUID getDerivateUUID() {
-        return derivateUUID;
+    public Set<UUID> getRootUUIDs() {
+        return rootUUIDs;
     }
 
-    public UUID getRootElementUUID() {
-        return rootUUID;
+    public Set<UUID> getDerivateUUIDs() {
+        return derivateUUIDs;
     }
 
     public void setRootAsDerivate(){
-        this.derivateUUID = this.rootUUID;
+        this.derivateUUIDs = this.rootUUIDs;
     }
 
     public ConversationHolder getConversationHolder() {
@@ -144,7 +168,7 @@ public class DerivateViewEditorInput implements IEditorInput{
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((rootUUID == null) ? 0 : rootUUID.hashCode());
+        result = prime * result + ((rootUUIDs == null) ? 0 : rootUUIDs.hashCode());
         return result;
     }
 
@@ -163,14 +187,15 @@ public class DerivateViewEditorInput implements IEditorInput{
             return false;
         }
         DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
-        if (rootUUID == null) {
-            if (other.rootUUID != null) {
+        if (rootUUIDs == null) {
+            if (other.rootUUIDs != null) {
                 return false;
             }
-        } else if (!rootUUID.equals(other.rootUUID)) {
+        } else if (!rootUUIDs.equals(other.rootUUIDs)) {
             return false;
         }
         return true;
     }
 
+
 }
index 7a38d5936199b5310d1aa4a86be70157c1d745cc..69b9b20d54d9973673faedf942bc29d8c82d53bd 100644 (file)
@@ -20,6 +20,8 @@ import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
@@ -30,6 +32,7 @@ import eu.etaxonomy.taxeditor.editor.view.derivate.operation.DeleteDerivateOpera
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  *
@@ -59,12 +62,14 @@ public class DeleteDerivateHandler extends AbstractHandler {
                 Object object = selection.iterator().next();
 
                 if(object instanceof TreeNode){
-                    TreeNode treeNode = (TreeNode)object;
                     Object value = ((TreeNode) object).getValue();
                     if(value instanceof SpecimenOrObservationBase<?> || value instanceof Sequence || value instanceof SingleRead){
+                        if(postOperationEnabled instanceof IConversationEnabled){
+                            ConversationHolder conversationHolder = ((IConversationEnabled) postOperationEnabled).getConversationHolder();
+                            label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder);
+                        }
                         SpecimenDeleteConfigurator config = new SpecimenDeleteConfigurator();
                         config.setDeleteChildren(false);
-                        config.setShiftHierarchyUp(false);
                         DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled, config);
                         AbstractUtility.executeOperation(deleteDerivateOperation);
                     }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/OpenDerivateEditorForTaxonHandler.java
new file mode 100644 (file)
index 0000000..ab74d55
--- /dev/null
@@ -0,0 +1,79 @@
+// $Id$
+/**
+* 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.derivate.handler;
+
+import java.util.HashSet;
+import java.util.Iterator;
+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 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.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+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.handler.OpenDerivateViewHandler;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateViewEditorInput;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date Nov 25, 2014
+ *
+ */
+public class OpenDerivateEditorForTaxonHandler extends AbstractHandler {
+
+    /* (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){
+            Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
+            Set<UUID> derivateUuids = new HashSet<UUID>();
+            while(selectionIterator.hasNext()){
+                Object object = selectionIterator.next();
+                if(object instanceof TaxonNode){
+                    TaxonNode node = (TaxonNode)object;
+                    Taxon taxon = node.getTaxon();
+                     List<SpecimenOrObservationBase> listByAssociatedTaxon = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(null, null, taxon, null, null, null, null, null);
+                     for (SpecimenOrObservationBase specimenOrObservationBase : listByAssociatedTaxon) {
+                         derivateUuids.add(specimenOrObservationBase.getUuid());
+                    }
+                }
+            }
+            if(derivateUuids.isEmpty()){
+                MessagingUtils.warningDialog("Could not open Derivate Editor", this, "No Derivates found");
+                return null;
+            }
+            DerivateViewEditorInput input = new DerivateViewEditorInput(derivateUuids);
+            try {
+                EditorUtil.open(input);
+            } catch (PartInitException e) {
+                MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open Derivate Editor", e);
+            } catch (NullPointerException npe){
+                MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open Derivate Editor. The derivate hierarchy is corrupted!", npe);
+            }
+        }
+        return null;
+    }
+
+}
index 5032dde4168c692c542897a6675c5be41ed89a75..b480a0f83cd27dd8cd55c462180f8746a03391f6 100644 (file)
@@ -14,11 +14,14 @@ 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.core.runtime.Status;
+import org.eclipse.ui.ISaveablePart;
 
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -56,17 +59,34 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        if(getPostOperationEnabled() instanceof ISaveablePart){
+            if(!MessagingUtils.confirmDialog("Confirm deletion", "Do you really want to delete the selected element?")){
+                return Status.CANCEL_STATUS;
+            }
+            if(((ISaveablePart) getPostOperationEnabled()).isDirty()){
+                MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+                return Status.CANCEL_STATUS;
+            }
+        }
         DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
-        if(!deleteResult.isOk()){
+        if(deleteResult.isOk()){
+            if(getPostOperationEnabled() instanceof DerivateView){
+                DerivateView derivateView = (DerivateView) getPostOperationEnabled();
+                //update DerivateView
+                derivateView.getConversationHolder().commit();
+                return postExecute(null);
+            }
+        }
+        else{
             String exceptionMessage = "";
             for(Exception exception:deleteResult.getExceptions()){
                 exceptionMessage += exception.getLocalizedMessage();
             }
             //TODO: add method to DeleteResult to sum up exceptions
             MessagingUtils.warningDialog("Deletion failed", this, exceptionMessage);
-            return postExecute(null);
+            return Status.CANCEL_STATUS;
         }
-        return postExecute(element);
+        return Status.OK_STATUS;
     }
 
     /*
@@ -79,7 +99,8 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-        return execute(monitor, info);
+        //no redo possible
+        return Status.CANCEL_STATUS ;
     }
 
     /*
@@ -92,6 +113,7 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-        return postExecute(element);
+        //no undo possible
+        return Status.CANCEL_STATUS;
     }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java
new file mode 100644 (file)
index 0000000..9605489
--- /dev/null
@@ -0,0 +1,147 @@
+// $Id$
+/**
+* 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.derivate.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 org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.TreeNode;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date Nov 18, 2014
+ *
+ */
+public class MoveDerivateOperation extends AbstractPostOperation<CdmBase>  {
+
+    private final TreeNode draggedNode;
+    private TreeNode fromNode;
+    private TreeNode targetNode;
+
+    public MoveDerivateOperation(String label, IUndoContext undoContext,
+            IPostOperationEnabled postOperationEnabled, TreeNode draggedNode, TreeNode targetNode) {
+            super(label, undoContext, null, postOperationEnabled);
+        this.draggedNode = draggedNode;
+        this.targetNode = targetNode;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        DerivateView derivateView = null;
+        if(getPostOperationEnabled() instanceof DerivateView){
+            derivateView = (DerivateView) getPostOperationEnabled();
+        }
+        if(derivateView==null){
+            MessagingUtils.operationDialog(this, new NullPointerException("DerivateView was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
+            return Status.CANCEL_STATUS;
+        }
+        if(derivateView.isDirty()){
+            MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+            return Status.CANCEL_STATUS;
+        }
+
+        fromNode = draggedNode.getParent();
+        if(moveTreeNode(draggedNode, fromNode, targetNode)){
+            //update DerivateView
+            derivateView.getConversationHolder().commit();
+            LocalSelectionTransfer.getTransfer().setSelection(null);
+            return postExecute(null);
+        }
+        else{
+            MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\" is not possible!");
+        }
+        return Status.CANCEL_STATUS;
+    }
+
+    private boolean moveTreeNode(TreeNode draggedNode, TreeNode fromNode, TreeNode targetNode) {
+        Object draggedNodeValue = draggedNode.getValue();
+        Object targetNodeValue = targetNode.getValue();
+        Object fromParentSpecimen = null;
+        if(fromNode!=null){
+            fromParentSpecimen = fromNode.getValue();
+        }
+
+        // drag'n'drop for SpecimenOrObservationBase
+        IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
+        if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
+            DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
+            SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
+            //check if type is a sub derivate type
+            if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
+            && fromNode!=null
+            && !fromNode.equals(targetNode)){//don't drag on direct parent node)
+                return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
+            }
+        }
+
+        // drag'n'drop for SingleRead
+        else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
+            SingleRead singleRead = (SingleRead) draggedNodeValue;
+            if(fromParentSpecimen instanceof Sequence){
+                return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
+            }
+        }
+
+        // drag'n'drop for Sequence
+        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+            Sequence sequence = (Sequence)draggedNodeValue;
+            if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
+            }
+        }
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        //swap fromNode and targetNode
+        this.targetNode = this.fromNode;
+        return execute(new NullProgressMonitor(), null);
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        //swap fromNode and targetNode
+        this.targetNode = this.fromNode;
+        return execute(new NullProgressMonitor(), null);
+    }
+
+}
index 6238071e9c65bbe5e502c5c6e385a82fb8bb2378..ddbb3525abc1c795239678ee843aa39b4dae0983 100644 (file)
@@ -15,9 +15,11 @@ import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.model.common.Marker;
 import eu.etaxonomy.cdm.model.common.MarkerType;
 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.FeatureTree;
 import eu.etaxonomy.cdm.model.description.IDescribable;
+import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
@@ -36,14 +38,19 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
 
        protected static final Object[] NO_CHILDREN = new Object[0];
        protected Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache;
+       private boolean showOnlyIndividualAssociations;
 
+       public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
+           this(featureNodeContainerCache, false);
+       }
        /**
         * <p>Constructor for DescriptiveContentProvider.</p>
         *
         * @param featureNodeContainerCache a {@link java.util.Map} object.
         */
-       public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache) {
+       public DescriptiveContentProvider(Map<DescriptionBase<?>, FeatureNodeContainerTree> featureNodeContainerCache, boolean showOnlyIndividualAssociations) {
                this.featureNodeContainerCache = featureNodeContainerCache;
+               this.showOnlyIndividualAssociations = showOnlyIndividualAssociations;
        }
 
        /* (non-Javadoc)
@@ -60,14 +67,31 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                            DescriptionBase<?> description = (DescriptionBase<?>) parentElement;
 
                                FeatureNodeContainerTree containerTree = getContainerTreeForDesription(description);
-
-                               return containerTree.getRoot().getChildren().toArray();
+                               List<FeatureNodeContainer> children = containerTree.getRoot().getChildren();
+                               //filter out containers with no children
+                               List<FeatureNodeContainer> childrenWithChildren = new ArrayList<FeatureNodeContainer>();
+                               for (FeatureNodeContainer featureNodeContainer : children) {
+                                   if(getChildren(featureNodeContainer).length>0){
+                                       childrenWithChildren.add(featureNodeContainer);
+                                   }
+                }
+                               return childrenWithChildren.toArray();
                        }
                }
                else if (parentElement instanceof FeatureNodeContainer){
                        FeatureNodeContainer container = (FeatureNodeContainer) parentElement;
                        if(container.isLeaf()){
-                               return container.getDescriptionElements().toArray();
+                               List<DescriptionElementBase> descriptionElements = container.getDescriptionElements();
+                               if(showOnlyIndividualAssociations){
+                                   List<DescriptionElementBase> filteredDescriptionElements = new ArrayList<DescriptionElementBase>();
+                                   for (DescriptionElementBase descriptionElement : descriptionElements) {
+                                       if(descriptionElement instanceof IndividualsAssociation){
+                                           filteredDescriptionElements.add(descriptionElement);
+                                       }
+                                   }
+                                   descriptionElements = filteredDescriptionElements;
+                               }
+                return descriptionElements.toArray();
                        }else{
                                return container.getChildren().toArray();
                        }
@@ -187,4 +211,8 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
        @Override
     public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
 
+       public void toggleShowOnlyIndividualAssociations() {
+           showOnlyIndividualAssociations = !showOnlyIndividualAssociations;
+    }
+
 }
index db2d4a174cf8125a974a8cbdff929023d536c111..4951bc8f944175bcd67ccf9fad829bf159cf94c5 100644 (file)
@@ -82,12 +82,15 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
 
        protected int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;
 
+    private DescriptiveContentProvider provider;
+
        /** {@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 DescriptiveContentProvider(featureNodeContainerCache));
+               provider = new DescriptiveContentProvider(featureNodeContainerCache);
+        viewer.setContentProvider(provider);
                viewer.setLabelProvider(new DescriptiveLabelProvider());
                viewer.setSorter(new DescriptiveViewerSorter());
                viewer.setAutoExpandLevel(2);
@@ -279,4 +282,9 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
     public boolean onComplete() {
                return false;
        }
+
+       public void toggleShowOnlyIndividualAssociations(){
+           provider.toggleShowOnlyIndividualAssociations();
+           viewer.refresh();
+       }
 }
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
new file mode 100644 (file)
index 0000000..5298ffa
--- /dev/null
@@ -0,0 +1,40 @@
+// $Id$
+/**
+* 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;
+    }
+
+}
index 940095c9c62ec9ceb132fb2177d10368ae27743a..29f6b8d33e6dd60c36c16e585534c201091c23ef 100644 (file)
          
       </menuContribution>
    </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <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.navigator.handler.NewClassificationHandler"
-            id="eu.etaxonomy.taxeditor.navigation.create.classification"
-            name="%command.name.0">
-      </command>
-   </extension>
    <extension
          point="org.eclipse.ui.commands">
       <command
             id="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
             name="%command.name.5">
       </command>
-   </extension>
-   <extension
-         point="org.eclipse.ui.commands">
+      <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"
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/TaxonParameterConverter.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/TaxonParameterConverter.java
new file mode 100644 (file)
index 0000000..c166012
--- /dev/null
@@ -0,0 +1,30 @@
+package eu.etaxonomy.taxeditor.navigation.navigator.handler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class TaxonParameterConverter extends AbstractParameterValueConverter {
+
+    public TaxonParameterConverter() {
+    }
+
+    @Override
+    public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+        return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
+    }
+
+    @Override
+    public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+        if(parameterValue instanceof TaxonBase<?>){
+            return ((TaxonBase) parameterValue).getUuid().toString();
+        }
+        return null;
+    }
+
+}
index 18331fd65c4b45520fbb3c083dd4614bb8485acf..44d489e5a759533a2f63881b7fa8d69902a4d258 100644 (file)
             </visibleWhen>
          </command>
       </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView">
+         <command
+               commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+               label="Open in Derivate Editor"
+               style="push">
+         </command>
+      </menuContribution>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
          </activeWhen>
       </handler>
    </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
-            id="eu.etaxonomy.taxeditor.datasource.connect"
-            name="Connect">
-      </command>
-   </extension>
    <extension
          name="Popup Menu Commands"
          point="org.eclipse.ui.commands">
             id="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"
             name="Open Distribution Editor Wizard">
       </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
+            id="eu.etaxonomy.taxeditor.datasource.connect"
+            name="Connect">
+      </command>
    </extension>
    <extension
          point="org.eclipse.ui.importWizards">
             id="eu.etaxonomy.taxeditor.io.export.dwca"
             name="%wizard.name.9">
       </wizard>
+      <wizard
+            category="eu.etaxonomy.taxeditor.export.category.cdm"
+            class="eu.etaxonomy.taxeditor.io.wizard.CsvExportWizard"
+            id="eu.etaxonomy.taxeditor.io.export.csv"
+            name="CSV">
+      </wizard>
    </extension>
    <extension
          point="org.eclipse.ui.newWizards">
index c7b7acc9cf0dc737a853c706c0daa85d3af1e075..e3fbfe9ab2862d0159f4d3fd7577bf3a40b31c06 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IWorkbenchPart;
 
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.io.common.CdmDefaultExport;
@@ -34,7 +33,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * <p>
  * ExportHandler class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Sep 11, 2009
  * @version 1.0
@@ -42,7 +41,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 public class ExportManager extends AbstractIOManager<IExportConfigurator> {
 
        /**
-        * 
+        *
         * @param applicationConfiguration
         */
        private ExportManager(ICdmApplicationConfiguration applicationConfiguration) {
@@ -53,7 +52,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
         * <p>
         * NewInstance
         * </p>
-        * 
+        *
         * @param applicationConfiguration
         *            a
         *            {@link eu.etaxonomy.cdm.api.application.CdmApplicationController}
@@ -69,7 +68,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
         * <p>
         * createIOJob
         * </p>
-        * 
+        *
         * @param configurator
         *            a {@link eu.etaxonomy.cdm.io.common.IExportConfigurator}
         *            object.
@@ -89,23 +88,25 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
                                                "Exporting database. This will take some time.", 100);
                                monitor.worked(10);
 
-                               display.asyncExec(new Runnable() {
-
-                                       @Override
-                                       public void run() {
-                                               // terminate any open transactions
-                                               IConversationEnabled activePart = (IConversationEnabled) StoreUtil
-                                                               .getActivePage().getActivePart();
-                                               activePart.getConversationHolder().commit(false);
-                                       }
-                               });
-
-                               monitor.worked(10);
+                           /** see ticket # 4456 and */
+//                             display.asyncExec(new Runnable() {
+//
+//                                     @Override
+//                                     public void run() {
+//
+//                                         // terminate any open transactions
+//                                             IConversationEnabled activePart = (IConversationEnabled) StoreUtil
+//                                                             .getActivePage().getActivePart();
+//                                             activePart.getConversationHolder().commit(false);
+//                                     }
+//                             });
+
+//                             monitor.worked(10);
 
                                CdmDefaultExport<IExportConfigurator> exporter = new CdmDefaultExport<IExportConfigurator>();
                                configurator.setProgressMonitor(CdmProgressMonitorAdapter
                                                .CreateSubMonitor(monitor, 80));
-                               exporter.setCdmAppController((ICdmApplicationConfiguration) applicationConfiguration);
+                               exporter.setCdmAppController(applicationConfiguration);
                                monitor.worked(10);
 
                                try {
@@ -133,11 +134,11 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
                                                        // trigger
                                                        // change listener
                                                        // TODO verify correct behaviour
-                                                       
+
                                                        try{
                                                                conversationEnabled.getConversationHolder()
                                                                        .startTransaction();
-                                                       
+
                                                                conversationEnabled.getConversationHolder()
                                                                        .commit();
                                                        }catch(RuntimeException e){
@@ -178,7 +179,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
         * <p>
         * JaxbConfigurator
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.io.jaxb.JaxbExportConfigurator} object.
         */
        public final JaxbExportConfigurator JaxbConfigurator() {
@@ -189,7 +190,7 @@ public class ExportManager extends AbstractIOManager<IExportConfigurator> {
         * <p>
         * SddConfigurator
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.io.sdd.out.SDDExportConfigurator}
         *         object.
         */
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/CsvExportWizard.java
new file mode 100644 (file)
index 0000000..744876e
--- /dev/null
@@ -0,0 +1,117 @@
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
+
+package eu.etaxonomy.taxeditor.io.wizard;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.ui.IWorkbench;
+
+import eu.etaxonomy.cdm.io.csv.redlist.demo.CsvDemoExportConfigurator;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author a.oppermann
+ * @created Nov. 11, 2014
+ * @version 1.0
+ */
+public class CsvExportWizard extends AbstractExportWizard<CsvDemoExportConfigurator> {
+
+       private CsvDemoExportConfigurator configurator;
+       private ExportToFileDestinationWizardPage page;
+
+       private final String description = "Export the contents of the currently selected database into Comma Separated Value format.";
+       /*
+        * (non-Javadoc)
+        *
+        * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+        * org.eclipse.jface.viewers.IStructuredSelection)
+        */
+       @Override
+       public void init(IWorkbench workbench, IStructuredSelection selection) {
+               configurator = CsvDemoExportConfigurator.NewInstance(null, null);
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see
+        * eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#getConfigurator()
+        */
+       @Override
+       public CsvDemoExportConfigurator getConfigurator() {
+               return configurator;
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see org.eclipse.jface.wizard.Wizard#performFinish()
+        */
+       @Override
+       public boolean performFinish() {
+               String urlString = page.getFolderText() + File.separator
+                               + page.getExportFileName();
+
+               final Combo combo = page.getCombo();
+               final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+               if(combo != null){
+                   int selectionIndex = combo.getSelectionIndex();
+                   HashSet<UUID> set = new HashSet<UUID>();
+                   if(selectionIndex == -1){
+                       for(Classification c:listClassifications){
+                           set.add(c.getUuid());
+                       }
+                   }else{
+                       for(Classification c:listClassifications){
+                           if(c.getTitleCache().equalsIgnoreCase(combo.getItem(selectionIndex))){
+                               set.add(c.getUuid());
+                           }
+                       }
+                       configurator.setClassificationUuids(set);
+                       configurator.setDoTaxa(true);
+                       configurator.setHasHeaderLines(true);
+                       configurator.setClassification(true);
+                       configurator.setTaxonName(true);
+                       configurator.setAuthor(true);
+                       configurator.setRank(true);
+                       configurator.setLastChange(true);
+                   }
+               }
+               configurator.setDestination(new File(urlString));
+
+               CdmStore.getExportManager().run(configurator);
+
+               return true;
+       }
+
+       /*
+        * (non-Javadoc)
+        *
+        * @see eu.etaxonomy.taxeditor.io.wizard.AbstractExportWizard#addPages()
+        */
+       @Override
+       public void addPages() {
+           //TODO create page with drop down menu for export for single classification.
+//             super.addPages();
+
+
+               //standard page
+               page =  ExportToFileDestinationWizardPage.Csv();
+
+               addPage(page);
+       }
+}
index 5fed8fbafab4d931f03460e22119f0342acb4843..580bf1f0dc7bb3dfc572d244f70cce2dfeefe7c4 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * European Distributed Institute of Taxonomy
  * http://www.e-taxonomy.eu
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License Version 1.1
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.io.wizard;
 
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.List;
 
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -20,19 +21,22 @@ import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.DirectoryDialog;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.remote.CdmRemoteSourceException;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * <p>
  * ExportToFileDestinationWizardPage class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created 15.06.2009
  * @version 1.0
@@ -53,10 +57,16 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
 
        public static final String DWCA_EXPORT = "DWCA_EXPORT";
 
+       public static final String CSV_EXPORT = "CSV_EXPORT";
+
        public static final String XML = "xml";
 
+       public static final String CSV = "csv";
+
        public static final String ZIP = "zip";
 
+    private static boolean csvExport = false;
+
        private DirectoryDialog folderDialog;
        private Text text_exportFileName;
 
@@ -66,11 +76,13 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
 
        private final String extension;
 
+    private Combo comboBox;
+
        /**
         * @param pageName
         * @param selection
         */
-       private ExportToFileDestinationWizardPage(String pageName, String type,
+       protected ExportToFileDestinationWizardPage(String pageName, String type,
                        String title, String description, String extension) {
                super(pageName);
 
@@ -84,7 +96,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
         * <p>
         * Jaxb
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
         *         object.
@@ -102,7 +114,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
         * <p>
         * Tcs
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
         *         object.
@@ -120,7 +132,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
         * <p>
         * Sdd
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.io.wizard.ExportToFileDestinationWizardPage}
         *         object.
@@ -146,15 +158,31 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
                                ZIP);
        }
 
+
+
+    /**
+     * @return
+     */
+    public static ExportToFileDestinationWizardPage Csv() {
+        csvExport = true;
+        return new ExportToFileDestinationWizardPage(
+                CSV_EXPORT,
+                "csv",
+                "CSV Export",
+                "Export the contents of the currently selected database into Comma Separated Value format.",
+                CSV);
+    }
+
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
         * .Composite)
         */
        /** {@inheritDoc} */
-       public void createControl(Composite parent) {
+       @Override
+    public void createControl(Composite parent) {
 
                setPageComplete(false);
 
@@ -163,6 +191,15 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
                gridLayout.numColumns = 3;
                composite.setLayout(gridLayout);
 
+
+               if(csvExport){
+                   Label comboBoxLabel = new Label(composite, SWT.NONE);
+                   comboBoxLabel.setText("Classification");
+                   Combo comboBox = addComboBox(composite);
+                   comboBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
+                               true, false, 2, 1));
+               }
+
                Label fileLabel = new Label(composite, SWT.NONE);
                fileLabel.setText("File");
 
@@ -187,7 +224,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
                button.addSelectionListener(new SelectionAdapter() {
                        /*
                         * (non-Javadoc)
-                        * 
+                        *
                         * @see
                         * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
                         * .swt.events.SelectionEvent)
@@ -207,7 +244,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
                setControl(composite);
        }
 
-       private String generateFilename() {
+       protected String generateFilename() {
                StringBuffer buffer = new StringBuffer();
 
                Calendar cal = Calendar.getInstance();
@@ -233,7 +270,7 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
         * <p>
         * getExportFileName
         * </p>
-        * 
+        *
         * @return the exportFileName
         */
        public String getExportFileName() {
@@ -244,11 +281,29 @@ public class ExportToFileDestinationWizardPage extends WizardPage {
         * <p>
         * getFolderText
         * </p>
-        * 
+        *
         * @return the folderText
         */
        public String getFolderText() {
                return text_folder.getText();
        }
 
+       private Combo addComboBox(Composite composite){
+
+           comboBox = new Combo(composite, SWT.DROP_DOWN);
+           comboBox.setText("Choose Classification");
+
+           final List<Classification> listClassifications = CdmStore.getCurrentApplicationConfiguration().getClassificationService().listClassifications(null, null, null, null);
+
+           for(Classification c : listClassifications){
+               comboBox.add(c.getTitleCache());
+           }
+
+           return comboBox;
+       }
+
+       public Combo getCombo(){
+           return comboBox;
+       }
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDerivedUnitFacadePart.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/IDerivedUnitFacadePart.java
new file mode 100644 (file)
index 0000000..a773b8b
--- /dev/null
@@ -0,0 +1,26 @@
+// $Id$
+/**
+* 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.model;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+
+/**
+ * Clients implementing this interface indicate, that they use {@link DerivedUnitFacade}s
+ * for specimen data instead of {@link DerivedUnit}s and {@link FieldUnit}s themselves.
+ *
+ * @author pplitzner
+ * @date Dec 3, 2014
+ *
+ */
+public interface IDerivedUnitFacadePart {
+
+}
index 959e49d92df4715109cbf5ca0e329b6139c91b6e..e9033c3925ca875a46b6840bd22b1ebcd6482f8a 100644 (file)
@@ -29,6 +29,7 @@ import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 public class MessagingUtils {
     public final static String UNEXPECTED_ERROR_MESSAGE = "This is an unexpected error.";
     public final static String CONTACT_MESSAGE = System.getProperty("line.separator") +  "Please contact EDIT Support (EditSupport@bgbm.org) with the error trace below (click on the 'Details' button).";
+    public final static String DEFAULT_MESSAGE = "Error thrown but no associated message";
 
     /**
      * Gets the Log4J logger for a given class
@@ -197,19 +198,30 @@ public class MessagingUtils {
 
     public static String getStackTraceAndContextInfo(Throwable t, List<String> contextInfo)  {
         StringBuffer stackTraceAndContextInfo = new StringBuffer();
+        Throwable throwable = t;
 
         for(String infoItem : contextInfo) {
             stackTraceAndContextInfo.append(infoItem + System.getProperty("line.separator"));
         }
 
         StringWriter sw = new StringWriter();
-        t.printStackTrace(new PrintWriter(sw));
+
+        if(throwable == null) {
+            throwable = getDefaultThrowable();
+        }
+        throwable.printStackTrace(new PrintWriter(sw));
 
         stackTraceAndContextInfo.append(sw.toString());
 
         return stackTraceAndContextInfo.toString();
     }
 
+    private static Throwable getDefaultThrowable() {
+        return new Throwable("Error thrown but no associated exception");
+    }
+
+
+
     /**
      * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
      *
@@ -263,7 +275,7 @@ public class MessagingUtils {
             final Throwable t,
             boolean addContactMesg) {
 
-
+        Throwable throwable = t;
         StringBuffer sbStackTrace = new StringBuffer();
 
         // We need to build a MultiStatus object since the simple
@@ -277,16 +289,20 @@ public class MessagingUtils {
             childStatuses.add(new Status(IStatus.ERROR, pluginId, infoItem));
         }
 
+        if(throwable == null) {
+            throwable = getDefaultThrowable();
+        }
+
         // add main execption
-        for (StackTraceElement ste : t.getStackTrace()) {
+        for (StackTraceElement ste : throwable.getStackTrace()) {
             childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
         }
 
         // add cause
-        if(t.getCause() != null) {
+        if(throwable.getCause() != null) {
             childStatuses.add(new Status(IStatus.ERROR, pluginId, ""));
-            childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + t.getCause().toString()));
-            for (StackTraceElement ste : t.getCause().getStackTrace()) {
+            childStatuses.add(new Status(IStatus.ERROR, pluginId, "Caused by : " + throwable.getCause().toString()));
+            for (StackTraceElement ste : throwable.getCause().getStackTrace()) {
                 // build & add status
                 childStatuses.add(new Status(IStatus.ERROR, pluginId, "at " + ste.toString()));
             }
@@ -295,7 +311,7 @@ public class MessagingUtils {
         String finalMessage = message;
 
         if(finalMessage == null || finalMessage.isEmpty()) {
-            finalMessage = "";
+            finalMessage = DEFAULT_MESSAGE;
         }
 
         if(addContactMesg) {
@@ -306,37 +322,10 @@ public class MessagingUtils {
         MultiStatus ms = new MultiStatus(pluginId,
                 IStatus.ERROR,
                 childStatuses.toArray(new Status[] {}),
-                t.toString(),
-                t);
+                throwable.toString(),
+                throwable);
 
-        errorDialog(title, source, t, contextInfo, finalMessage, ms);
-    }
-
-    /**
-     * Displays a {@link eu.etaxonomy.taxeditor.model.CdmErrorDialog}.
-     *
-     * @param title
-     *            a {@link java.lang.String} object.
-     * @param source
-     *            a {@link java.lang.Object} object.
-     * @param status
-     *            a {@link org.eclipse.core.runtime.IStatus} object.
-     */
-    private static void errorDialog(final String title,
-            final Object source,
-            final String message,
-            final IStatus status) {
-
-        Display.getDefault().asyncExec(new Runnable() {
-
-            @Override
-            public void run() {
-                CdmErrorDialog ced = new CdmErrorDialog(AbstractUtility.getShell(), title, message, status);
-                ced.open();
-                Class<? extends Object> clazz = source != null ? source.getClass() : this.getClass();
-                error(clazz, status);
-            }
-        });
+        errorDialog(title, source, throwable, contextInfo, finalMessage, ms);
     }
 
     /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationPrimerWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/newWizard/AmplificationPrimerWizardPage.java
deleted file mode 100644 (file)
index a63a0ca..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id$
-/**
- * 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.newWizard;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.model.molecular.Amplification;
-import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationPrimerDetailElement;
-
-/**
- * @author pplitzner
- * @date 11.03.2014
- *
- */
-public class AmplificationPrimerWizardPage extends AbstractCdmEntityWizardPage<Amplification> {
-
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param entity
-     */
-    public AmplificationPrimerWizardPage(CdmFormFactory formFactory,
-            ConversationHolder conversation, Amplification entity) {
-        super(formFactory, conversation, entity);
-        setTitle("Amplification Primer Data");
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.forms.AbstractCdmEntityWizardPage#checkComplete()
-     */
-    @Override
-    protected void checkComplete() {
-        setPageComplete(true);
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage#createElement(eu.etaxonomy.taxeditor.forms.ICdmFormElement)
-     */
-    @Override
-    public AbstractCdmDetailElement<Amplification> createElement(ICdmFormElement rootElement) {
-        AmplificationPrimerDetailElement detailElement = formFactory.createAmplificationPrimerDetailElement(rootElement);
-        detailElement.setEntity(getEntity());
-        checkComplete();
-        return detailElement;
-    }
-
-}
index fb2682fb9a8d71bf186412a5d4decd62ca21490b..fddcbbdc210d8ae245bbf8ba78a6bff3cc2ca1b1 100644 (file)
@@ -21,7 +21,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class NewAmplificationWizard  extends AbstractNewEntityWizard<Amplification> {
 
     private AmplificationGeneralWizardPage amplificationGeneralPage;
-    private AmplificationPrimerWizardPage amplificationPrimerPage;
     private AmplificationCloningWizardPage amplificationCloningPage;
     private AmplificationGelPhotoWizardPage amplificationGelPhotoWizardPage;
 
@@ -30,8 +29,6 @@ public class NewAmplificationWizard  extends AbstractNewEntityWizard<Amplificati
     public void addPages() {
         amplificationGeneralPage = new AmplificationGeneralWizardPage(formFactory, getConversationHolder(), getEntity());
         addPage(amplificationGeneralPage);
-        amplificationPrimerPage = new AmplificationPrimerWizardPage(formFactory, getConversationHolder(), getEntity());
-        addPage(amplificationPrimerPage);
         amplificationCloningPage = new AmplificationCloningWizardPage(formFactory, getConversationHolder(), getEntity());
         addPage(amplificationCloningPage);
         amplificationGelPhotoWizardPage = new AmplificationGelPhotoWizardPage(formFactory, getConversationHolder(), getEntity());
@@ -55,7 +52,6 @@ public class NewAmplificationWizard  extends AbstractNewEntityWizard<Amplificati
     public void setEntity(Amplification entity) {
         super.setEntity(entity);
         amplificationGeneralPage.getDetailElement().setEntity(entity);
-        amplificationPrimerPage.getDetailElement().setEntity(entity);
         amplificationCloningPage.getDetailElement().setEntity(entity);
         amplificationGelPhotoWizardPage.getDetailElement().setEntity(entity);
     }
index c7c6cf5639c9f0b4a45a7f1928c5683f4a48eb58..e9967a006000d04c56ac0cb3ee379710d48b2d7d 100644 (file)
@@ -18,6 +18,7 @@ import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseWizardPage;
@@ -33,7 +34,7 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventWizardPage;
  * @created Jun 16, 2010
  * @version 1.0
  */
-public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> {
+public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<SpecimenOrObservationBase> implements IDerivedUnitFacadePart{
        private SpecimenOrObservationType specOrObsType = null;
 
        public NewDerivedUnitBaseWizard() {
index 08bc4d8256d1d9855a5548c9a90c87cc5d535ca5..a748e14c661f218e2d57a50206435585dccc5286 100644 (file)
@@ -119,6 +119,9 @@ public interface IPreferenceKeys {
 
     public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
 
+    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
+
+    public static final String SHOW_TAXON_ASSOCIATIONS = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations";
 
     public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
 
index f217610d4d4999a3fd3fad28eb900a33d3178564..9c9bd5aee17d34aaf503280f48c7394b1a51b4bd 100644 (file)
@@ -37,6 +37,12 @@ public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage
         addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
                 "Taxon determination only on FieldUnit level",
                 getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
+                "Show \"Collecting Areas\" in \"General\" section of details view",
+                getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
+                "Show taxon associations of a specimen in the details view",
+                getFieldEditorParent()));
 
     }
 
index 03f76ed7ce5a57d1fe595afa9768eed9e01d7775..e4b2e38747b2f401072b435a986e435e19600bc9 100644 (file)
@@ -224,6 +224,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.SourceCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenCollectionDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenCurrentDeterminationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
@@ -261,12 +263,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailS
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
@@ -722,63 +720,20 @@ public class CdmFormFactory extends FormToolkit {
                return element;
        }
 
-    /**
-     * <p>
-     * createLanguageStringWithLabelElement
-     * </p>
-     *
-     * @param parentElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-     *            object.
-     * @param labelString
-     *            a {@link java.lang.String} object.
-     * @param languageString
-     *            a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
-     * @param style
-     *            a int.
-     * @return a
-     *         {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
-     *         object.
-     */
     public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
             String labelString, LanguageString languageString, int style) {
-        LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
-                languageString, style);
-        adapt(element);
-        parentElement.addElement(element);
-        return element;
+        return createLanguageStringWithLabelElement(parentElement, labelString, languageString, null, false, style);
     }
 
-    /**
-     * <p>
-     * createLanguageStringWithLabelElement
-     * </p>
-     *
-     * @param parentElement
-     *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
-     *            object.
-     * @param labelString
-     *            a {@link java.lang.String} object.
-     * @param languageString
-     *            a {@link eu.etaxonomy.cdm.model.common.LanguageString} object.
-     * @param height
-     *            a int.
-     * @param style
-     *            a int.
-     * @return a
-     *         {@link eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement}
-     *         object.
-     */
     public LanguageStringWithLabelElement createLanguageStringWithLabelElement(ICdmFormElement parentElement,
-            String labelString, LanguageString languageString, int height, int style) {
+            String labelString, LanguageString languageString, Integer height, boolean isMultiLine, int style) {
         LanguageStringWithLabelElement element = new LanguageStringWithLabelElement(this, parentElement, labelString,
-                languageString, height, style);
+                languageString, height, isMultiLine, style);
         adapt(element);
         parentElement.addElement(element);
         return element;
     }
 
-
     /**
      * <p>
      * createKeyValueViewerElement
@@ -1639,6 +1594,12 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
+    public TaxonAssociationDetailSection createTaxonAssociationDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
+        TaxonAssociationDetailSection section = new TaxonAssociationDetailSection(this, conversation, parentElement, selectionProvider, style);
+        addAndAdaptSection(parentElement, section);
+        return section;
+    }
+
     public OriginalLabelDataSection createOriginalLabelDataSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         OriginalLabelDataSection section = new OriginalLabelDataSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -1777,18 +1738,6 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public SpecimenScanGeneralDetailSection createSpecimenScanGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        SpecimenScanGeneralDetailSection section = new SpecimenScanGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
-    public LivingPlantPhotoGeneralDetailSection createLivingPlantPhotoGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        LivingPlantPhotoGeneralDetailSection section = new LivingPlantPhotoGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
     public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -2061,6 +2010,12 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
+    public TaxonAssociationDetailElement createTaxonAssociationDetailElement(ICdmFormElement parentElement){
+        TaxonAssociationDetailElement element = new TaxonAssociationDetailElement(this, parentElement);
+        addAndAdaptElement(parentElement, element);
+        return element;
+    }
+
     public PreservedSpecimenGeneralDetailElement createPreservedSpecimenGeneralDetailElement(ICdmFormElement parentElement){
         PreservedSpecimenGeneralDetailElement element = new PreservedSpecimenGeneralDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
@@ -2127,18 +2082,6 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public SpecimenScanGeneralDetailElement createSpecimenScanGeneralDetailElement(ICdmFormElement parentElement){
-        SpecimenScanGeneralDetailElement element = new SpecimenScanGeneralDetailElement(this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
-
-    public LivingPlantPhotoGeneralDetailElement createLivingPlantPhotoGeneralDetailElement(ICdmFormElement parentElement){
-        LivingPlantPhotoGeneralDetailElement element = new LivingPlantPhotoGeneralDetailElement(this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
-
     public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
         MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
index a9f326ccbe293a18da1f2f2b12cc70a5a8785c53..084e57634898a1c62b232015b441ad2413d5b0d7 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -25,7 +25,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class LanguageStringWithLabelElement extends TextWithLabelElement {
 
        private LanguageString languageString;
-       
+
        /**
         * <p>Constructor for LanguageStringWithLabelElement.</p>
         *
@@ -40,7 +40,7 @@ public class LanguageStringWithLabelElement extends TextWithLabelElement {
                        LanguageString languageString, int style) {
                this(formFactory, parentElement, labelString, languageString, null, style);
        }
-       
+
        /**
         * <p>Constructor for LanguageStringWithLabelElement.</p>
         *
@@ -54,11 +54,18 @@ public class LanguageStringWithLabelElement extends TextWithLabelElement {
        protected LanguageStringWithLabelElement(CdmFormFactory formFactory,
                        ICdmFormElement parentElement, String labelString,
                        LanguageString languageString, Integer height, int style) {
-               super(formFactory, parentElement, labelString, null, height, style);
-               
-               setLanguageString(languageString);
+               this(formFactory, parentElement, labelString, languageString, height, true, style);
        }
-               
+
+       protected LanguageStringWithLabelElement(CdmFormFactory formFactory,
+               ICdmFormElement parentElement, String labelString,
+               LanguageString languageString, Integer height, boolean isMultiLine, int style) {
+           super(formFactory, parentElement, labelString, null, height, isMultiLine, style);
+
+           setLanguageString(languageString);
+
+       }
+
        /**
         * <p>Getter for the field <code>languageString</code>.</p>
         *
@@ -67,18 +74,18 @@ public class LanguageStringWithLabelElement extends TextWithLabelElement {
        public LanguageString getLanguageString() {
                return languageString;
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void modifyText(ModifyEvent e) {
                if(languageString == null){
                        languageString = LanguageString.NewInstance("", CdmStore.getDefaultLanguage());
                }
-               
+
                languageString.setText(text.getText());
                super.modifyText(e);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void setText(String text) {
index ad379c37098de347e440b7f640c389d7b8621129..bc2fe8be8386bdf016fac18990643e582f7e7a52 100644 (file)
@@ -119,7 +119,7 @@ public class MultilanguageTextElement extends AbstractCdmFormElement implements
 
                element_languageString = this.formFactory
                                .createLanguageStringWithLabelElement(formElement, labelString,
-                                               null, textHeight, style);
+                                               null, textHeight, true, style);
 
                if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
                        createMultilanguageTextEditingElements(formElement,
index 769964958be8d65e48f67975e3b502a676d9cf4a..e5e90cc801bbc9a9d93d3a251815825959cd80d7 100644 (file)
@@ -65,11 +65,10 @@ public class MediaDetailElement extends AbstractCdmDetailElement<Media>{
     public void setEntity(Media entity) {
         super.setEntity(entity);
         if(singleMediaRepresentationPart==null){
-            singleMediaRepresentationPart = MediaUtils.initFirstMediaRepresentationPart(entity);
+            singleMediaRepresentationPart = MediaUtils.initFirstMediaRepresentationPart(entity, true);
         }
         initIsAdvancedMediaView();
         showAdvancedView();
-
     }
 
     /* (non-Javadoc)
index 78960e311d49f68f4dcea6823ee8fe19cadd4762..eca547b688d4c9bd6e72f16641ef13adaf5cadfd 100644 (file)
@@ -71,7 +71,7 @@ public class MediaMetaElement extends AbstractEntityCollectionElement<Media> {
     public void createControls(ICdmFormElement element, int style) {
         text_title = formFactory.createLanguageStringWithLabelElement(element, "Title", null, style);
         selection_artist = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), element, "Artist", null, EntitySelectionElement.ALL, style);
-        text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, style);
+        text_description = formFactory.createLanguageStringWithLabelElement(element, "Description", null, 100, true, style);
         mediaDetailElement = formFactory.createMediaDetailElement(element);
     }
 
index 97207a2babd51d458d8e3e61580928f74bcdea31..e67aaaf80293886b14adaeddef50f59d5a338a4c 100644 (file)
@@ -40,8 +40,6 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class DerivedUnitBaseDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
-    private TextWithLabelElement textOriginalLabelData;
-
        private TextWithLabelElement text_derivedUnitDefinitions;
 
        private TextWithLabelElement text_barcode;
@@ -84,9 +82,6 @@ public class DerivedUnitBaseDetailElement extends
                // "Specimen Definition",
                // facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()),
                // style);
-           //FIXME map original label data to corresponding model field
-           //commented because we do not use this yet in the trunk
-//         textOriginalLabelData = formFactory.createTextWithLabelElement(formElement, "Original Label Data", null, style);
         text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
         text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style);
 
index a2be5ed29e1f1417ad5bb9efae318074bb3b323a..acd4690a3b9b01856249247e6bf24790eaae012c 100644 (file)
@@ -16,6 +16,8 @@ import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
@@ -75,29 +77,33 @@ public class DerivedUnitGeneralDetailElement extends
                toggleableText_titleCache = formFactory.createToggleableTextField(
                                formElement, "Title Cache", entity.getTitleCache(),
                                entity.isProtectedTitleCache(), style);
+               if((AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
+                   combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
+                   combo_specorobstype.setSelection(entity.getType());
+                   selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
+                           formElement, "Country",
+                           entity.getCountry(), EntitySelectionElement.NOTHING, style);
+                   languageText_locality = formFactory
+                           .createLanguageStringWithLabelElement(formElement, "Locality",
+                                   entity.getLocality(), style);
+                   element_point = formFactory.createPointElement(formElement,
+                           entity.getExactLocation(), style);
+                   element_elevation = formFactory.createGatheringEventUnitElement(
+                           formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
 
-        combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
-               combo_specorobstype.setSelection(entity.getType());
-               selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
-                               formElement, "Country",
-                               entity.getCountry(), EntitySelectionElement.NOTHING, style);
-               languageText_locality = formFactory
-                               .createLanguageStringWithLabelElement(formElement, "Locality",
-                                               entity.getLocality(), style);
-               element_point = formFactory.createPointElement(formElement,
-                               entity.getExactLocation(), style);
-               element_elevation = formFactory.createGatheringEventUnitElement(
-                               formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-
-               element_date = formFactory.createTimePeriodElement(formElement, "Date",
-                               entity.getGatheringPeriod(), style);
-               selection_collector = formFactory
-                               .createSelectionElement(AgentBase.class,
-                                               getConversationHolder(), formElement, "Collector",
-                                               entity.getCollector(), EntitySelectionElement.ALL,
-                                               style);
-               text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
-                               "Collecting number", entity.getFieldNumber(), style);
+                   element_date = formFactory.createTimePeriodElement(formElement, "Date",
+                           entity.getGatheringPeriod(), style);
+                   selection_collector = formFactory
+                           .createSelectionElement(AgentBase.class,
+                                   getConversationHolder(), formElement, "Collector",
+                                   entity.getCollector(), EntitySelectionElement.ALL,
+                                   style);
+                   text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
+                           "Collecting number", entity.getFieldNumber(), style);
+               }
+               else{
+                   toggleableText_titleCache.setEnabled(false);
+               }
                selection_collection = formFactory
                                .createSelectionElement(Collection.class,
                                                getConversationHolder(), formElement, "Collection",
index e68552eb8649dca1603261beef1fe56d181f1b42..e127f9dd8b9aad7111a113a9a9627383ad8bf05f 100644 (file)
@@ -9,16 +9,21 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.PointElement;
@@ -38,6 +43,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
     private ToggleableTextElement toggleableText_titleCache;
     private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
     private EntitySelectionElement<NamedArea> selection_country;
+    private CollectingAreasDetailSection section_collectingAreas;
     private LanguageStringWithLabelElement languageText_locality;
     private PointElement element_point;
     private NumberWithLabelElement number_elevation;
@@ -70,6 +76,12 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         combo_specorobstype.setSelection(entity.getType());
         selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
                 "Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
+        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
+
         languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
                 entity.getLocality(), style);
         element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);
index 73af807ee5d6cb342285672fd45d1379466f9443..cf19f5b32ac77071481322125b8e5b8ca1f0de1b 100644 (file)
@@ -13,6 +13,8 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -36,9 +38,9 @@ public class GatheringEventDetailElement extends
        private GatheringEventUnitElement element_elevation;
 
        private GatheringEventUnitElement element_distToGround;
-       
+
        private GatheringEventUnitElement element_distToWater;
-       
+
        private TextWithLabelElement text_collectingMethod;
 
        private TextWithLabelElement text_gatheringEventDescription;
@@ -65,30 +67,24 @@ public class GatheringEventDetailElement extends
        /** {@inheritDoc} */
        @Override
        protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-               
-
-               // collectingArea
-
-
-        text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
 
+           text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
 
-               // exactLocation
         text_gatheringEventDescription = formFactory.createTextWithLabelElement(
                        formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
-//             element_elevation = formFactory.createGatheringEventUnitElement(
-//                             formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-               
-               
+
                element_distToGround = formFactory.createGatheringEventUnitElement(
                                formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND,  style);
-               
+
                element_distToWater = formFactory.createGatheringEventUnitElement(
                                formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
-               
-        section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
-        section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-               section_collectingAreas.setEntity(entity);
+
+
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
 
        }
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java
new file mode 100644 (file)
index 0000000..eacf2c6
--- /dev/null
@@ -0,0 +1,142 @@
+// $Id$
+/**
+ * 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.ui.section.occurrence.association;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.NotEnabledException;
+import org.eclipse.core.commands.NotHandledException;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author pplitzner
+ * @date Dec 1, 2014
+ *
+ */
+public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> implements IDoubleClickListener{
+
+
+    private TableViewer associationsViewer;
+    private TableViewer typeDesignationViewer;
+
+    public TaxonAssociationDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
+        super(formFactory, formElement);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
+
+        //TODO add context menu for deleting associations
+
+        Label associationsLabel = formFactory.createLabel(getLayoutComposite(), "Individuals Associations");
+        associationsLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+        associationsViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+        associationsViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        associationsViewer.setContentProvider(new ArrayContentProvider());
+        Collection<TaxonBase<?>> associatedTaxa = CdmStore.getService(IOccurrenceService.class).listAssociatedTaxa(entity.innerDerivedUnit(), null, null, null, null);
+        associationsViewer.setInput(associatedTaxa);
+        associationsViewer.addDoubleClickListener(this);
+
+        Label typeLabel = formFactory.createLabel(getLayoutComposite(), "Type Designations");
+        typeLabel.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+
+        typeDesignationViewer = new TableViewer(getLayoutComposite(), SWT.FULL_SELECTION);
+        typeDesignationViewer.getTable().setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        typeDesignationViewer.setContentProvider(new ArrayContentProvider());
+        Collection<TaxonBase<?>> typedTaxa = CdmStore.getService(IOccurrenceService.class).listTypedTaxa(entity.innerDerivedUnit(), null, null, null, null);
+        typeDesignationViewer.setInput(typedTaxa);
+        typeDesignationViewer.addDoubleClickListener(this);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void handleEvent(Object eventSource) {
+        //empty
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
+     */
+    @Override
+    public void doubleClick(DoubleClickEvent event) {
+        if(associationsViewer.getSelection() instanceof IStructuredSelection){
+            Object firstElement = ((IStructuredSelection) associationsViewer.getSelection()).getFirstElement();
+            if(firstElement instanceof TaxonBase<?>){
+                TaxonBase<?> taxonBase = (TaxonBase<?>)firstElement;
+                String commandId = "eu.etaxonomy.taxeditor.editor.openTaxonEditor";
+
+
+                ArrayList parameters = new ArrayList();
+                IParameter iparam = null;
+
+                //get the command from plugin.xml
+                IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+                ICommandService cmdService = (ICommandService)window.getService(ICommandService.class);
+                Command cmd = cmdService.getCommand(commandId);
+
+                //get the parameter
+                try {
+                    iparam = cmd.getParameter("eu.etaxonomy.taxeditor.editor.taxonParameter");
+                } catch (NotDefinedException e1) {
+                    MessagingUtils.error(this.getClass(), "Command not defined", e1);
+                }
+                Parameterization params = new Parameterization(iparam, (taxonBase).getUuid().toString());
+                parameters.add(params);
+
+                //build the parameterized command
+                ParameterizedCommand pc = new ParameterizedCommand(cmd, (Parameterization[]) parameters.toArray(new Parameterization[parameters.size()]));
+
+                //execute the command
+                IHandlerService handlerService = (IHandlerService)window.getService(IHandlerService.class);
+                try {
+                    handlerService.executeCommand(pc, null);
+                } catch (ExecutionException e) {
+                    MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+                } catch (NotDefinedException e) {
+                    MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+                } catch (NotEnabledException e) {
+                    MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+                } catch (NotHandledException e) {
+                    MessagingUtils.error(TaxonAssociationDetailElement.class, e);
+                }
+            }
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailSection.java
new file mode 100644 (file)
index 0000000..26999ef
--- /dev/null
@@ -0,0 +1,53 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence.association;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.IDerivedUnitFacadeDetailSection;
+
+/**
+ *
+ * @author pplitzner
+ * @date Dec 1, 2014
+ *
+ */
+public class TaxonAssociationDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection{
+
+       public TaxonAssociationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               super(formFactory, conversation, parentElement, selectionProvider, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
+        */
+       /** {@inheritDoc} */
+       @Override
+       public String getHeading() {
+               return "Taxon Associations";
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+        */
+       @Override
+       protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
+           return formFactory.createTaxonAssociationDetailElement(parentElement);
+       }
+}
index 6b335ba22a4ba093f42b6233855a343b0927eed6..c4ee24e2102497fd9e8161b4bc63369cfeba60ca 100644 (file)
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TimePeriod;
 import eu.etaxonomy.cdm.model.molecular.Amplification;
-import eu.etaxonomy.cdm.model.occurrence.MaterialOrMethodEvent;
+import eu.etaxonomy.cdm.model.molecular.Primer;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -31,21 +33,14 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<Amplification> {
 
-    private TextWithLabelElement textDescription;
+    private TextWithLabelElement textDesignation;
+    private TextWithLabelElement textNotes;
     private TermComboElement<DefinedTerm> comboMarker;
     private TimePeriodElement dateAmplification;
+    private EntitySelectionElement<Institution> selectionInstitution;
     private EntitySelectionElement<AgentBase> selectionAmplificationStaff;
-    private CheckboxElement checkBoxAmplificationSuccess;
-    private TextWithLabelElement textAmplificationSuccessDetails;
-    private TermComboElement<DefinedTerm> comboAmplificationMaterialOrMethod;
-
-    private NumberWithLabelElement numberGelVoltage;
-    private NumberWithLabelElement numberGelConcentration;
-    private NumberWithLabelElement numberGelRunningTime;
-    private TextWithLabelElement textLadderUsed;
-
-    private TermComboElement<DefinedTerm> comboPurificationMaterialOrMethod;
-
+    private EntitySelectionElement<Primer> selectionPrimerFW;
+    private EntitySelectionElement<Primer> selectionPrimerRW;
 
     /**
      * @param formFactory
@@ -64,19 +59,73 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
      */
     @Override
     protected void createControls(ICdmFormElement formElement, Amplification entity, int style) {
-        textDescription = formFactory.createTextWithLabelElement(formElement, "Description", entity.getDescription(), style);
+        textDesignation = formFactory.createTextWithLabelElement(formElement, "Designation", entity.getDescription(), style);
+        textDesignation.setEnabled(false);
+        //TODO institution
+//        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", entity.getInstitution(), EntitySelectionElement.ALL, style);
+        selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
+        dateAmplification = formFactory.createTimePeriodElement(formElement, "Date", entity.getTimeperiod(), style);
         comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
-//        dateAmplification = formFactory.createTimePeriodElement(formElement, "Amplification Date", entity.getTimeperiod(), style);
-//        selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
-//        checkBoxAmplificationSuccess = formFactory.createCheckbox(formElement, "Amplification Success", entity.getSuccessful(), style);
-//        textAmplificationSuccessDetails = formFactory.createTextWithLabelElement(formElement, "Ampl. Success Details", entity.getSuccessText(), style);
-//        comboAmplificationMaterialOrMethod = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Ampl. Mat. & Meth.", entity.get, style)
-//        numberGelVoltage = formFactory.createNumberTextWithLabelElement(formElement, "Gel Voltage (V)", entity.getElectrophoresisVoltage(), style);
-//        numberGelConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Gel Concentration", entity.getGelConcentration(), style);
-//        numberGelRunningTime = formFactory.createNumberTextWithLabelElement(formElement, "Gel Ruinning Time (Min)", entity.getGelRunningTime(), style);
-//        textLadderUsed = formFactory.createTextWithLabelElement(formElement, "Ladder Used", entity.getLadderUsed(), style);
-        comboPurificationMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Purification Mat. & Meth.",
-                entity.getPurification()==null?null:entity.getPurification().getDefinedMaterialOrMethod(), style);
+        selectionPrimerFW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer FW", entity.getForwardPrimer(), EntitySelectionElement.ALL, style);
+        selectionPrimerRW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer RW", entity.getReversePrimer(), EntitySelectionElement.ALL, style);
+
+        AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+        annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        annotationSection.setEntity(entity);
+
+        updateDesignationText();
+    }
+
+    private void updateDesignationText(){
+        String institutionName = "";
+        String staffName = "";
+        String dnaMarkerString = "";
+        String dateString = "";
+
+        //retrieve data
+        //TODO institution
+//        Institution selection = selectionInstitution.getSelection();
+//        if(selection!=null){
+//            institutionName = selection.getName();
+//        }
+        AgentBase staff = selectionAmplificationStaff.getSelection();
+        if(staff!=null){
+            staffName = staff.getTitleCache();
+        }
+        DefinedTerm dnaMarker = comboMarker.getSelection();
+        if(dnaMarker!=null){
+            dnaMarkerString = dnaMarker.generateTitle();
+        }
+        TimePeriod timePeriod = dateAmplification.getTimePeriod();
+        if(timePeriod!=null){
+            dateString = timePeriod.toString()!=null?timePeriod.toString():"";
+        }
+
+        //assemble string
+        String designation = "";
+        if(!institutionName.equals("")){
+            designation += institutionName;
+        }
+        if(!staffName.equals("")){
+            if(!designation.equals("")){
+                designation += "_";
+            }
+            designation += staffName;
+        }
+        if(!dnaMarkerString.equals("")){
+            if(!designation.equals("")){
+                designation += "_";
+            }
+            designation += dnaMarkerString;
+        }
+        if(!dateString.equals("")){
+            if(!designation.equals("")){
+                designation += "_";
+            }
+            designation += dateString;
+        }
+        textDesignation.setText(designation);
+        getEntity().setDescription(designation);
     }
 
     /*
@@ -88,46 +137,31 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
      */
     @Override
     public void handleEvent(Object eventSource) {
-        if(eventSource==textDescription){
-            getEntity().setDescription(textDescription.getText());
+        if(eventSource==textNotes){
+            getEntity().setDescription(textNotes.getText());
         }
         else if(eventSource==comboMarker){
             getEntity().setDnaMarker(comboMarker.getSelection());
+            updateDesignationText();
         }
         else if(eventSource==dateAmplification){
             getEntity().setTimeperiod(dateAmplification.getTimePeriod());
+            updateDesignationText();
         }
         else if(eventSource==selectionAmplificationStaff){
             getEntity().setActor(selectionAmplificationStaff.getEntity());
+            updateDesignationText();
         }
-        else if(eventSource==checkBoxAmplificationSuccess){
-            getEntity().setSuccessful(checkBoxAmplificationSuccess.getSelection());
+        else if(eventSource==selectionInstitution){
+            //TODO institution
+//            getEntity().setInstitution(selectionInstitution.getSelection());
+            updateDesignationText();
         }
-        else if(eventSource==textAmplificationSuccessDetails){
-            getEntity().setSuccessText(textAmplificationSuccessDetails.getText());
+        else if(eventSource==selectionPrimerFW){
+            getEntity().setForwardPrimer(selectionPrimerFW.getSelection());
         }
-        else if(eventSource==comboAmplificationMaterialOrMethod){
-
-        }
-        else if(eventSource==numberGelVoltage){
-            getEntity().setElectrophoresisVoltage(numberGelVoltage.getDouble());
-        }
-        else if(eventSource==numberGelConcentration){
-            getEntity().setGelConcentration(numberGelConcentration.getDouble());
-        }
-        else if(eventSource==numberGelRunningTime){
-            getEntity().setGelRunningTime(numberGelRunningTime.getDouble());
-        }
-        else if(eventSource==textLadderUsed){
-            getEntity().setLadderUsed(textLadderUsed.getText());
-        }
-        else if(eventSource==comboPurificationMaterialOrMethod){
-            MaterialOrMethodEvent purification = getEntity().getPurification();
-            if(purification==null){
-                purification = MaterialOrMethodEvent.NewInstance();
-                getEntity().setPurification(purification);
-            }
-            purification.setDefinedMaterialOrMethod(comboPurificationMaterialOrMethod.getSelection());
+        else if(eventSource==selectionPrimerRW){
+            getEntity().setReversePrimer(selectionPrimerRW.getSelection());
         }
     }
 }
\ No newline at end of file
index 039f2f745c00364d16aab23fcaad5a05bf2634a6..b790953560aab56433c37980439a89bbb8f52e2e 100644 (file)
@@ -11,7 +11,8 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import org.joda.time.DateTime;
 
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.OrderedTerm;
+import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.molecular.DnaQuality;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -29,14 +30,11 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
-    //TODO: add vocabulary
-//    private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
-
     private TextWithLabelElement textPurificationMethod;
     private NumberWithLabelElement numberRatioOfAbsorbance260_280;
     private NumberWithLabelElement numberRatioOfAbsorbance260_230;
     private NumberWithLabelElement numberConcentration;
-    private TermComboElement<DefinedTerm> comboQualityTerm;
+    private TermComboElement<OrderedTerm> comboQualityTerm;
     private DateElement dateQualityCheck;
 
     /**
@@ -64,13 +62,13 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
         Double ratioOfAbsorbance260_230 = dnaQuality.getRatioOfAbsorbance260_230();
         Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
         Double concentration = dnaQuality.getConcentration();
-        DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
+        OrderedTerm qualityTerm = dnaQuality.getQualityTerm();
 
-//        textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "Purification Method", dnaQuality.getPurificationMethod(), style);
+        textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "DNA Purification Details", dnaQuality.getPurificationMethod(), style);
         numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
         numberRatioOfAbsorbance260_230 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-230", ratioOfAbsorbance260_230, style);
         numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
-//        comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
+        comboQualityTerm = formFactory.createDefinedTermComboElement(TermType.DnaQualityType, formElement, "Quality Term", qualityTerm, style);
         dateQualityCheck = formFactory.createDateElement(formElement, "Quality Check", dnaQuality.getQualityCheckDate(), style);
     }
 
@@ -85,8 +83,7 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
     public void handleEvent(Object eventSource) {
         DnaQuality dnaQuality = getEntity().getDnaQuality();
         if(eventSource==textPurificationMethod){
-            //TODO
-//            dnaQuality.setPurificationMethod(textPurificationMethod.getText());
+            dnaQuality.setPurificationMethod(textPurificationMethod.getText());
         }
         else if(eventSource==numberRatioOfAbsorbance260_230){
             dnaQuality.setRatioOfAbsorbance260_230(numberRatioOfAbsorbance260_230.getDouble());
index 3b5dc4d88b17fb69ed89ac15cfa7e0f4b5e96eed..dd1faa70e9e7c599c5ec2a82f04d548752947bb8 100644 (file)
@@ -10,6 +10,7 @@
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.common.TimePeriod;
@@ -31,8 +32,9 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
+    private EntitySelectionElement<Institution> selectionInstitution;
+    private EntitySelectionElement<AgentBase> selectionStaff;
     private TimePeriodElement datePreservationDate;
-    private EntitySelectionElement<AgentBase> selectionPreparedBy;
     private NumberWithLabelElement numberPreservationTemperature;
     private TermComboElement<DefinedTerm> comboMaterialOrMethods;
     private TextWithLabelElement textBarcode;
@@ -54,22 +56,27 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
      */
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
-        TimePeriod timePeriod = null;
-        AgentBase<?> actor = null;
+        Institution institution = null;
+        AgentBase<?> staff = null;
+        TimePeriod preparationDate = null;
+        if(entity.getDerivedFrom()!=null){
+//            institution = entity.getDerivedFrom().getInstitution();
+            staff = entity.getDerivedFrom().getActor();
+            preparationDate = entity.getDerivedFrom().getTimeperiod();
+        }
+
         Double temperature = null;
         DefinedTerm definedMaterialOrMethod = null;
         if(entity.getPreservation()!=null){
-            timePeriod= entity.getPreservation().getTimeperiod();
-            actor = entity.getPreservation().getActor();
             temperature = entity.getPreservation().getTemperature();
             definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
         }
-        datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preservation date", timePeriod, style);
-        selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", actor, EntitySelectionElement.ALL, style);
+        //TODO institution
+//        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", staff, EntitySelectionElement.ALL, style);
+        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
+        datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
         numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
         comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
-        //TODO preparation date
-        //TODO sample type
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
 
     }
@@ -86,8 +93,8 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
         if(eventSource==datePreservationDate){
             addPreservationMethod().setTimeperiod(datePreservationDate.getTimePeriod());
         }
-        else if(eventSource==selectionPreparedBy){
-            addPreservationMethod().setActor(selectionPreparedBy.getSelection());
+        else if(eventSource==selectionStaff){
+            addPreservationMethod().setActor(selectionStaff.getSelection());
         }
         else if(eventSource==numberPreservationTemperature){
             addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
index 3ec0627e43e062282c7d4089ee45a31441690c44..da429331e916ea70ce080e7f115b1afefd4d1f19 100644 (file)
@@ -9,13 +9,17 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.molecular.Primer;
 import eu.etaxonomy.cdm.model.molecular.SequenceString;
 import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -27,10 +31,11 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
 
 
     private TextWithLabelElement textPrimerName;
-    //TODO we are using a basic text field which is backed up by a Sequence object modelwise.
+    // we are using a basic text field which is backed up by a Sequence object modelwise.
     // This is a bit of a overhead as we may just need the sequence string. This may change in future in both directions:
     // either extending this view to support the remaining fields of Sequence or by switching to the more basic SequenceString model element
     private TextWithLabelElement textPrimerSequence;
+    private TermComboElement<DefinedTerm> comboMarker;
     private EntitySelectionElement<Reference> selectionReference;
 
     /**
@@ -57,11 +62,18 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
         }
         textPrimerSequence = formFactory.createTextWithLabelElement(formElement, "Primer seq. 5'->3'", sequenceString, style);
 
+        //TODO dnaMarker
+//        comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
+
         selectionReference = formFactory
                 .createSelectionElement(Reference.class,
                         getConversationHolder(), formElement, "Reference",
                         entity.getPublishedIn(),
                         EntitySelectionElement.ALL, style);
+
+        AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+        annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        annotationSection.setEntity(entity);
     }
 
     /*
@@ -76,6 +88,10 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
         if(eventSource==textPrimerName){
             getEntity().setLabel(textPrimerName.getText());
         }
+        else if(eventSource==comboMarker){
+            //TODO dnaMarker
+//            getEntity().setDnaMarker(comboMarker.getSelection());
+        }
         else if(eventSource==textPrimerSequence){
             SequenceString sequenceString = getEntity().getSequence();
             if(sequenceString==null){
index 10fb8e3c5259781dc118b01a65c00ec48964dd17..e4ac9865c715f234b0ac01e570261d92d2d84045 100644 (file)
@@ -37,7 +37,6 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
     private TermComboElement<DefinedTerm> comboMarker;
     private TextWithLabelElement textConsensusSequence;
     private NumberWithLabelElement textConsensusSequenceLength;
-    private TextWithLabelElement textBarcodeSequence;
     private TextWithLabelElement textGeneticAccessNo;
     private UriWithLabelElement textNCBIUri;
     private UriWithLabelElement textENAUri;
@@ -63,10 +62,7 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
     @Override
     protected void createControls(ICdmFormElement formElement, Sequence entity, int style) {
         comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
-//        textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
-//        textConsensusSequenceLength = formFactory.createNumberTextWithLabelElement(formElement, "Consensus Seq. Length", entity.getConsensusSequence().getLength(), style);
-//        ((Text) textConsensusSequenceLength.getMainControl()).setEditable(false);
-        textBarcodeSequence = formFactory.createTextWithLabelElement(formElement, "Barcode Sequence 5'->3'", entity.getBarcodeSequencePart()==null?"":entity.getBarcodeSequencePart().getString(), style);
+        textConsensusSequence = formFactory.createTextWithLabelElement(formElement, "Consensus Sequence 5'->3'", entity.getConsensusSequence().getString(), style);
 
         URI genBankUri = null;
         URI emblUri = null;
@@ -115,14 +111,6 @@ public class SequenceGeneralDetailElement extends AbstractCdmDetailElement<Seque
             getEntity().setConsensusSequence(consensusSequence);
             textConsensusSequenceLength.setNumber(consensusSequence.getLength());
         }
-        else if(eventSource==textBarcodeSequence){
-            SequenceString barcodeSequencePart = getEntity().getBarcodeSequencePart();
-            if(barcodeSequencePart==null){
-                barcodeSequencePart = SequenceString.NewInstance();
-            }
-            barcodeSequencePart.setString(textBarcodeSequence.getText());
-            getEntity().setBarcodeSequencePart(barcodeSequencePart);
-        }
         else if(eventSource==textGeneticAccessNo){
             textGeneticAccessNo.setBackground(getPersistentBackground());
             getEntity().setGeneticAccessionNumber(textGeneticAccessNo.getText());
index 54f33c6fac6e0315550b92c0da3bc2f83c23b295..4c85ed548547f5e3230df15a836e59c37d687133 100644 (file)
@@ -14,7 +14,9 @@ import eu.etaxonomy.cdm.model.molecular.Primer;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -46,6 +48,10 @@ public class SingleReadGeneralDetailElement extends AbstractCdmDetailElement<Sin
     protected void createControls(ICdmFormElement formElement, SingleRead entity, int style) {
         selectionPrimer = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer", entity.getPrimer(), EntitySelectionElement.ALL, style);
         selectionAmplification = formFactory.createSelectionElement(Amplification.class, getConversationHolder(), formElement, "Amplification", entity.getAmplification(), EntitySelectionElement.ALL, style);
+
+        AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+        annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        annotationSection.setEntity(entity);
     }
 
     /*
index f3e5de673c20b711b09a0793408e6d67d9c1e876..ea72fbadf2ca383eabbc212bbda48a0dfde23667 100644 (file)
@@ -36,10 +36,10 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
     static private final Logger logger = Logger.getLogger(TissueSampleGeneralDetailElement.class);
 
     private TermComboElement<DefinedTerm> comboKindOfTissue;
+    private EntitySelectionElement<AgentBase> selectionInstitution;
+    private EntitySelectionElement<AgentBase> selectionStaff;
     private TimePeriodElement datePreparation;
-    private EntitySelectionElement<AgentBase> selectionPreparedBy;
     private TermComboElement<DefinedTerm> comboPreservationMedium;
-    private TimePeriodElement datePreservation;
     private EntitySelectionElement<Collection> selectionCollection;
     private TextWithLabelElement textAccessionNumber;
     private TextWithLabelElement textBarcode;
@@ -64,19 +64,20 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
         //TODO handle all parameters here and in handleEvent()
         comboKindOfTissue = formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Tissue", entity.getKindOfUnit(), style);
-
-        TimePeriod preservationDate = null;
+        //TODO: institute
+        TimePeriod preparationDate = null;
         DefinedTerm preservationMedium = null;
-//        TimePeriod preparationDate = null;
-//        AgentBase preparedBy = null;
+        AgentBase<?> staff = null;
+        if(entity.getDerivedFrom()!=null){
+            staff = entity.getDerivedFrom().getActor();
+            preparationDate = entity.getDerivedFrom().getTimeperiod();
+        }
         if(entity.getPreservation()!=null){
-            preservationDate = entity.getPreservation().getTimeperiod();
             preservationMedium = entity.getPreservation().getMedium();
         }
-//        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
-//        selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared By", preparedBy, EntitySelectionElement.ALL, style);
+        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL,style);
+        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
         comboPreservationMedium = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Preservation medium", preservationMedium, style);
-        datePreservation = formFactory.createTimePeriodElement(formElement, "Preservation date", preservationDate, style);
         selectionCollection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
         textAccessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
@@ -92,18 +93,13 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
      */
     @Override
     public void handleEvent(Object eventSource) {
+        //TODO: institute
         if(eventSource==comboKindOfTissue) {
             getEntity().setKindOfUnit(comboKindOfTissue.getSelection());
         }
-        else if(eventSource==selectionPreparedBy) {
-            addPreservationMethod().setActor(selectionPreparedBy.getSelection());
-        }
         else if(eventSource==comboPreservationMedium) {
             addPreservationMethod().setMedium(comboPreservationMedium.getSelection());
         }
-        else if (eventSource==datePreservation) {
-            addPreservationMethod().setTimeperiod(datePreservation.getTimePeriod());
-        }
         else if(eventSource==selectionCollection){
             getEntity().setCollection(selectionCollection.getSelection());
         }
@@ -113,6 +109,16 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
         else if(eventSource==textBarcode){
             getEntity().setBarcode(textBarcode.getText());
         }
+        else if(eventSource==datePreparation){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setTimeperiod(datePreparation.getTimePeriod());
+            }
+        }
+        else if(eventSource==selectionStaff){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
+            }
+        }
     }
 
     private PreservationMethod addPreservationMethod(){
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java
deleted file mode 100644 (file)
index 523f297..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param formElement
-     */
-    public LivingPlantPhotoGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
-        super(formFactory, formElement);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */
-    @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-     * .lang.Object)
-     */
-    @Override
-    public void handleEvent(Object eventSource) {
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java
deleted file mode 100644 (file)
index b1b8974..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param parentElement
-     * @param selectionProvider
-     * @param style
-     */
-    public LivingPlantPhotoGeneralDetailSection(CdmFormFactory formFactory,
-            ConversationHolder conversation, ICdmFormElement parentElement,
-            ISelectionProvider selectionProvider, int style) {
-        super(formFactory, conversation, parentElement, selectionProvider, style);
-    }
-
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-     */
-    @Override
-    public String getHeading() {
-        return "General";
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-     */
-    @Override
-    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-        return formFactory.createLivingPlantPhotoGeneralDetailElement(parentElement);
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java
deleted file mode 100644 (file)
index fada3bb..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class SpecimenScanGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param formElement
-     */
-    public SpecimenScanGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
-        super(formFactory, formElement);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */
-    @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-     * .lang.Object)
-     */
-    @Override
-    public void handleEvent(Object eventSource) {
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java
deleted file mode 100644 (file)
index 497d96a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class SpecimenScanGeneralDetailSection  extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param parentElement
-     * @param selectionProvider
-     * @param style
-     */
-    public SpecimenScanGeneralDetailSection(CdmFormFactory formFactory,
-            ConversationHolder conversation, ICdmFormElement parentElement,
-            ISelectionProvider selectionProvider, int style) {
-        super(formFactory, conversation, parentElement, selectionProvider, style);
-    }
-
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-     */
-    @Override
-    public String getHeading() {
-        return "General";
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-     */
-    @Override
-    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-        return formFactory.createSpecimenScanGeneralDetailElement(parentElement);
-    }
-}
index 57a93c87389dd80ed4dc8fadfe9aa0fefde90ebb..018b6c754f91369740eb6316531a443e740d4415 100644 (file)
@@ -38,7 +38,6 @@ import eu.etaxonomy.taxeditor.model.TextHelper;
 import eu.etaxonomy.taxeditor.newWizard.AmplificationCloningWizardPage;
 import eu.etaxonomy.taxeditor.newWizard.AmplificationGelPhotoWizardPage;
 import eu.etaxonomy.taxeditor.newWizard.AmplificationGeneralWizardPage;
-import eu.etaxonomy.taxeditor.newWizard.AmplificationPrimerWizardPage;
 import eu.etaxonomy.taxeditor.newWizard.PrimerWizardPage;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -145,9 +144,6 @@ public class EditFromSelectionWizard extends Wizard implements
             addPage(new AmplificationGeneralWizardPage(formFactory,
                     selectionElement.getConversationHolder(),
                     (Amplification) entity));
-            addPage(new AmplificationPrimerWizardPage(formFactory,
-                    selectionElement.getConversationHolder(),
-                    (Amplification) entity));
             addPage(new AmplificationCloningWizardPage(formFactory,
                     selectionElement.getConversationHolder(),
                     (Amplification) entity));
index 49a46a7dc39034f251cf9b6799d91f6fa29ed627..526f9eeac832786400c7cb0131506ef0ea184f7e 100644 (file)
@@ -147,7 +147,7 @@ public class TranslationWizardPage extends WizardPage{
 
                LanguageString preferredLanguageString = MultilanguageTextHelper.getPreferredLanguageString(multilanguageText, getLanguages());
 
-               text_source = formFactory.createLanguageStringWithLabelElement(element, null, preferredLanguageString, TEXT_HEIGHT, SWT.NULL);
+               text_source = formFactory.createLanguageStringWithLabelElement(element, null, preferredLanguageString, TEXT_HEIGHT, true, SWT.NULL);
 
 //             text_source.setEnabled(false);
 
@@ -186,7 +186,7 @@ public class TranslationWizardPage extends WizardPage{
                        }
                });
 
-               text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, SWT.NULL);
+               text_target = formFactory.createLanguageStringWithLabelElement(element, null, null, TEXT_HEIGHT, true, SWT.NULL);
 
                //
                // The automated translation did rely on the Google Translate API. Unfortunately this service is not free anymore.
index 2d06fd31650d5461ff1bfef90095c9eef95f6da9..5719782bebcd1f37a35bc2b0cddbdb10738ab8ec 100644 (file)
@@ -58,6 +58,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
     private static DefinedTerm detailImageTerm = null;
     private static DefinedTerm sampleDesignationTerm = null;
 
+    //FIXME: move static term getters to new singleton utility class
     private static void initializeTerms() {
         List<DefinedTerm> preferredTerms = CdmStore.getTermManager().getPreferredTerms(DefinedTerm.class);
         for (DefinedTerm definedTerm : preferredTerms) {
@@ -134,12 +135,11 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         this.conversation = conversation;
     }
 
-    /**
-     *
-     * @param derivate
-     * @return
-     */
     public String getDerivateText(Object element){
+        return getDerivateText(element, conversation);
+    }
+
+    public static String getDerivateText(Object element, ConversationHolder conversation){
         //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
         TreeNode parentNode = null;
         TreeNode node = null;
@@ -187,6 +187,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
                 label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
             }
             label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
+            label += mediaSpecimen.getBarcode()!=null?mediaSpecimen.getBarcode()+separator:emptyString;
         }
         //TissueSample + DnaSample
         else if(derivate instanceof DnaSample){
@@ -265,8 +266,11 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
                     label += NO_SAMPLE_DESIGNATION+separator;
                 }
                 label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
-                if(sequence!=null){
-                    label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
+                if(sequence!=null && sequence.getDnaMarker()!=null){
+                    label += sequence.getDnaMarker()+separator;
+                }
+                if(singleRead.getAmplification()!=null && singleRead.getAmplification().getDescription()!=null){
+                    label += singleRead.getAmplification().getDescription()+separator;
                 }
             }
         }
index 60bc2a1c4472182457dcba856b82f9086a149134..0db71df83aec3b4933db863b847953dc7a368e7b 100644 (file)
@@ -11,6 +11,8 @@ package eu.etaxonomy.taxeditor.view.derivateSearch;
 
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -21,6 +23,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.wb.swt.ResourceManager;
 
 /**
  * The widgets of the {@link DerivateSearchView}<br>
@@ -34,6 +37,11 @@ public class DerivateSearchComposite extends Composite {
     private final Combo comboDerivateType;
     private final Button buttonSearch;
     private final Button btnFilterUndeterminedSpecimen;
+    private final Text textTaxonName;
+    private final Button btnBrowseTaxa;
+    private final Label lblTaxon;
+    private final Label lblDerivateType;
+    private final Button btnClearTaxon;
 
     /**
      * Create the composite.
@@ -42,37 +50,52 @@ public class DerivateSearchComposite extends Composite {
      */
     public DerivateSearchComposite(Composite parent, int style) {
         super(parent, style);
-        setLayout(new GridLayout(6, false));
+        setLayout(new GridLayout(4, false));
 
-        Label lblDerivateType = new Label(this, SWT.NULL);
-        lblDerivateType.setText("Derivate Filter");
+        lblTaxon = new Label(this, SWT.NONE);
+        lblTaxon.setText("Taxon");
+
+        textTaxonName = formToolkit.createText(this, "New Text", SWT.NONE);
+        textTaxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+        textTaxonName.setEnabled(false);
+        textTaxonName.setText("");
+
+        btnBrowseTaxa = formToolkit.createButton(this, "", SWT.NONE);
+        btnBrowseTaxa.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
+
+        btnClearTaxon = formToolkit.createButton(this, "", SWT.NONE);
+        btnClearTaxon.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+        btnClearTaxon.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
+
+        lblDerivateType = new Label(this, SWT.NULL);
+        lblDerivateType.setText("Derivate Type");
 
         comboDerivateType = new Combo(this, SWT.READ_ONLY);
-        comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+        comboDerivateType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
         formToolkit.paintBordersFor(comboDerivateType);
 
         btnFilterUndeterminedSpecimen = new Button(this, SWT.CHECK);
-        btnFilterUndeterminedSpecimen.setText("Only undetermined specimen");
-        btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
-        new Label(this, SWT.NONE);
-        new Label(this, SWT.NONE);
-        new Label(this, SWT.NONE);
-
-        searchField = formToolkit.createText(this, "New Text", SWT.NONE);
-        searchField.setText("");
-        searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-
-        buttonSearch = new Button(this, SWT.NONE);
-        buttonSearch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
-        formToolkit.adapt(buttonSearch, true, true);
-        buttonSearch.setText("Search");
-        new Label(this, SWT.NONE);
-        new Label(this, SWT.NONE);
-        new Label(this, SWT.NONE);
-
-        resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
-        table = resultViewer.getTable();
-        table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 6, 4));
+        btnFilterUndeterminedSpecimen.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+        btnFilterUndeterminedSpecimen.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+            }
+        });
+        btnFilterUndeterminedSpecimen.setText("Determined");
+
+                buttonSearch = new Button(this, SWT.NONE);
+                formToolkit.adapt(buttonSearch, true, true);
+                buttonSearch.setText("Search");
+
+                searchField = formToolkit.createText(this, "New Text", SWT.NONE);
+                searchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+                searchField.setText("");
+                new Label(this, SWT.NONE);
+                new Label(this, SWT.NONE);
+
+                resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
+                table = resultViewer.getTable();
+                table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
 
     }
 
@@ -102,8 +125,20 @@ public class DerivateSearchComposite extends Composite {
         comboDerivateType.setEnabled(enabled);
         buttonSearch.setEnabled(enabled);
         btnFilterUndeterminedSpecimen.setEnabled(enabled);
+        btnBrowseTaxa.setEnabled(enabled);
+        lblTaxon.setEnabled(enabled);
+        lblDerivateType.setEnabled(enabled);
     }
     public Button getBtnFilterUndeterminedSpecimen() {
         return btnFilterUndeterminedSpecimen;
     }
+    public Button getBtnBrowseTaxa() {
+        return btnBrowseTaxa;
+    }
+    public Text getTextTaxonName() {
+        return textTaxonName;
+    }
+    public Button getBtnClearTaxon() {
+        return btnClearTaxon;
+    }
 }
index ea5a9ccf9a9f664a6b38a62d4ef9fb3cea53ef0b..25b99f0229ddaa80f91e3c18ff1d9b93ae878fe0 100644 (file)
@@ -10,8 +10,6 @@
 package eu.etaxonomy.taxeditor.view.derivateSearch;
 
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
 import java.util.List;
 
 import org.eclipse.core.commands.ExecutionException;
@@ -36,9 +34,11 @@ import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurato
 import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorImpl;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
 import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController;
 
 /**
@@ -54,6 +54,8 @@ public class DerivateSearchCompositeController implements Listener{
     private EnumTermComboController<SpecimenOrObservationType> enumTermComboController;
     private final DerivateSearchView derivateSearchView;
        private DerivateLabelProvider labelProvider;
+       private Taxon selectedTaxon;
+
     /**
      * @param parent
      * @param derivateSearchView
@@ -65,20 +67,18 @@ public class DerivateSearchCompositeController implements Listener{
     }
 
     private void init(){
-        LinkedHashMap<SpecimenOrObservationType, String> orderedTerms = AbstractUtility.orderTerms(Arrays.asList(SpecimenOrObservationType.values()));
-        String[] comboItems = new String[orderedTerms.size()];
-        int count = 0;
-        for(String termMessage:orderedTerms.values()){
-            comboItems[count] = termMessage;
-            count++;
-        }
-
+        //derivate type combo
         enumTermComboController = new EnumTermComboController<SpecimenOrObservationType>(derivateSearchComposite.getComboDerivateType(), null, null, SpecimenOrObservationType.class, 0);
         enumTermComboController.setSelection(SpecimenOrObservationType.Unknown);
 
+        //add listeners
         derivateSearchComposite.getSearchField().addListener(SWT.KeyDown, this);
         derivateSearchComposite.getButtonSearch().addListener(SWT.Selection, this);
+        derivateSearchComposite.getBtnBrowseTaxa().addListener(SWT.Selection, this);
+        derivateSearchComposite.getBtnClearTaxon().addListener(SWT.Selection, this);
 
+
+        //result table
         TableViewer resultViewer = derivateSearchComposite.getResultViewer();
         resultViewer.setContentProvider(new ArrayContentProvider());
         labelProvider = new DerivateLabelProvider();
@@ -112,21 +112,39 @@ public class DerivateSearchCompositeController implements Listener{
             derivateSearchView.setFocus(); //rebind the conversation
         }
 
+
+        List<SpecimenOrObservationBase<?>> filteredByAssociatedTaxon = null;
+        //filter by taxon
+        if(selectedTaxon!=null){
+            filteredByAssociatedTaxon = CdmStore.getService(IOccurrenceService.class).listByAssociatedTaxon(null, null, selectedTaxon, null, null, null, null, null);
+        }
+
+        //filter by specimen type
         configurator.setTitleSearchString(derivateSearchComposite.getSearchField().getText());
         SpecimenOrObservationType type = enumTermComboController.getSelection();
-        //filter by specimen type
-        List<SpecimenOrObservationBase> results = CdmStore.getSearchManager().findOccurrencesByType(configurator, type);
+        List<SpecimenOrObservationBase> filteredByType = new ArrayList<SpecimenOrObservationBase>();
+        if(filteredByAssociatedTaxon!=null){
+            for (SpecimenOrObservationBase specimenOrObservationBase : filteredByAssociatedTaxon) {
+                if(type.equals(SpecimenOrObservationType.Unknown) || specimenOrObservationBase.getRecordBasis().equals(type)){
+                    filteredByType.add(specimenOrObservationBase);
+                }
+            }
+        }
+        else{
+            filteredByType = CdmStore.getSearchManager().findOccurrencesByType(configurator, type);
+        }
+
         //filter out assigned specimens
         if(derivateSearchComposite.getBtnFilterUndeterminedSpecimen().getSelection()){
             List<SpecimenOrObservationBase> specimensWithNoDetermination = new ArrayList<SpecimenOrObservationBase>();
-            for(SpecimenOrObservationBase<?> result:results){
+            for(SpecimenOrObservationBase<?> result:filteredByType){
                 if(CdmStore.getService(IOccurrenceService.class).countDeterminations(result, null)==0){
                     specimensWithNoDetermination.add(result);
                 }
             }
-            results = specimensWithNoDetermination;
+            filteredByType = specimensWithNoDetermination;
         }
-        derivateSearchComposite.getResultViewer().setInput(results);
+        derivateSearchComposite.getResultViewer().setInput(filteredByType);
     }
 
     /* (non-Javadoc)
@@ -139,6 +157,16 @@ public class DerivateSearchCompositeController implements Listener{
                 || (eventSource == derivateSearchComposite.getSearchField() && event.keyCode == SWT.CR)){
             searchDerivates();
         }
+        else if(eventSource==derivateSearchComposite.getBtnBrowseTaxa()){
+            selectedTaxon = SelectionDialogFactory.getSelectionFromDialog(Taxon.class, derivateSearchView.getSite().getShell(), derivateSearchView.getConversationHolder(), null);
+            if(selectedTaxon!=null){
+                derivateSearchComposite.getTextTaxonName().setText(selectedTaxon.getTitleCache());
+            }
+        }
+        else if(eventSource==derivateSearchComposite.getBtnClearTaxon()){
+            selectedTaxon = null;
+            derivateSearchComposite.getTextTaxonName().setText("");
+        }
     }
 
     /**
@@ -159,6 +187,7 @@ public class DerivateSearchCompositeController implements Listener{
         derivateSearchComposite.getSearchField().setText("");
         enumTermComboController.setSelection(SpecimenOrObservationType.Unknown);
         derivateSearchComposite.getComboDerivateType().deselectAll();
+        selectedTaxon = null;
     }
 
     public TableViewer getResultViewer() {
index 6da90e1e38064d4a2a8e00ae462ef5d7e7c357f0..9f950fa3fbffe21c7aedfb871b02b86ab3cd00b1 100644 (file)
 package eu.etaxonomy.taxeditor.view.derivateSearch;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.MenuManager;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.part.ViewPart;
 
@@ -44,6 +47,13 @@ public class DerivateSearchView extends ViewPart implements IContextListener {
         derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
         getSite().setSelectionProvider(derivateSearchCompositeController.getResultViewer());
         derivateSearchCompositeController.setEnabled(CdmStore.isActive());
+
+        //create context menu
+        MenuManager menuManager = new MenuManager();
+        getSite().registerContextMenu(menuManager, derivateSearchCompositeController.getResultViewer());
+        Control control = derivateSearchCompositeController.getResultViewer().getControl();
+        Menu menu = menuManager.createContextMenu(control);
+        control.setMenu(menu);
     }
 
     /* (non-Javadoc)
index bf7088c7109b9d01546993cc2eb6ecba7fc98098..5d81dbf00f16e61dd0aa8968041200135370fc76 100644 (file)
@@ -52,7 +52,9 @@ import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
+import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -92,9 +94,7 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
@@ -108,11 +108,10 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollect
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
@@ -296,15 +295,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                 //in future using only one class with different SpecimenOrObservationTypes is desired
 //                createTissueSampleSection(rootElement);
             }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createSpecimenScanSection(rootElement);
-            }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createLivingPlantPhotoSection(rootElement);
-            }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createMediaSpecimenSection(rootElement);
-            }
             else{
                 createDerivedUnitBaseElementSection(rootElement);
             }
@@ -668,55 +658,40 @@ public class DetailsViewer extends AbstractCdmDataViewer {
     private void createDerivedUnitBaseElementSection(RootElement parent) {
         destroySections();
 
-        //different order of sections (Specimen Details as second section and expanded)
-        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
-            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitGeneralDetailSection);
+        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(derivedUnitGeneralDetailSection);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-            OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(originalLabelDataSection);
+        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(derivedUnitBaseDetailSection);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitBaseDetailSection);
+        OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(originalLabelDataSection);
 
+        //for editors working with facades
+        if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
             GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(gatheringEventDetailSection);
 
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
             FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(fieldUnitDetailSection);
         }
-        else{
-            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitGeneralDetailSection);
 
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(gatheringEventDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(fieldUnitDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(derivedUnitBaseDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
             DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(determinationDetailSection);
         }
+        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+            TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+            addPart(taxonAssociationDetailSection);
+        }
 
     }
 
@@ -744,24 +719,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         }
     }
 
-    private void createPreservedSpecimenSpecimenSection(RootElement parent) {
-        destroySections();
-
-        PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        addPart(section);
-        addPart(derivedUnitBaseDetailSection);
-        addPart(determinationDetailSection);
-    }
-
     private void createTissueSampleSection(RootElement parent) {
         destroySections();
 
@@ -848,25 +805,17 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         addPart(pherogramSection);
     }
 
-    private void createSpecimenScanSection(RootElement parent) {
+    private void createMediaSpecimenSection(RootElement parent) {
         destroySections();
-        SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
 
-        addPart(section);
-    }
-
-    private void createLivingPlantPhotoSection(RootElement parent) {
-        destroySections();
-        LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(generalSection);
 
-        addPart(section);
-    }
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-    private void createMediaSpecimenSection(RootElement parent) {
-        destroySections();
-        MediaSpecimenGeneralDetailSection section = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        addPart(rightsSection);
 
-        addPart(section);
     }
 
 
index 2f940d85dffcec693da2b426337bfc861fd9cabc..4bfbc6b6ef9229038dc3dd1d222caa8575f0ff04 100644 (file)
  *******************************************************************************/\r
 package org.eclipse.wb.swt;
 
-import java.io.File;\r
-import java.io.InputStream;\r
-import java.lang.reflect.Constructor;\r
-import java.lang.reflect.Method;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import org.eclipse.core.runtime.Platform;\r
-import org.eclipse.jface.resource.CompositeImageDescriptor;\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.osgi.framework.Bundle;\r
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.osgi.framework.Bundle;
 
 /**
  * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
index 429964e7b0386edade61551b040b961594ea4ead..8b6d4cc3ffec8aceabd59822e031990300d2e59a 100644 (file)
  *******************************************************************************/\r
 package org.eclipse.wb.swt;
 
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.Cursor;\r
-import org.eclipse.swt.graphics.Font;\r
-import org.eclipse.swt.graphics.FontData;\r
-import org.eclipse.swt.graphics.GC;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.graphics.ImageData;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.widgets.Display;\r
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
 
 /**
  * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.