Committing changes to definedtermeditor after merge from branch
authorl.morris <l.morris@localhost>
Mon, 16 Jan 2012 12:14:15 +0000 (12:14 +0000)
committerl.morris <l.morris@localhost>
Mon, 16 Jan 2012 12:14:15 +0000 (12:14 +0000)
132 files changed:
.gitattributes
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationUtil.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorUtil.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicMarkerTypeEditingMenu.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/entitycreator/NameCreator.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/preference/BulkEditorMarkerPreferencePage.java
eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/AbstractDynamicConceptRelationMenu.java
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/DynamicFeatureMenu.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermBasePropertyTester.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermContentProvider.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermTransfer.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateTermVocabularyHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/DeleteTermBaseHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermMenu.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/AbstractDefinedTermEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/DefinedTermEditorInputFactory.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/ExtensionTypeEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/FeatureEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/MarkerTypeEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaLevelEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateDefinedTermOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateTermVocabularyOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/AvailableFeaturesWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/labels/DefaultLabelStrategy.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/TaxonRelationshipTypeInverseContainer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/LanguagePreferencePage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/AbstractMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/ExtensionTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/FeatureMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/LanguageMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/MarkerTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/MeasurementUnitMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NameRelationshipTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NameTypeDesignationStatusMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NamedAreaTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/NomenclaturalStatusTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/PresenceAbsenceMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/PreservationMethodMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/RankMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/SpecimenTypeDesignationStatusMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/StageMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/TaxonRelationshipTypeMenuPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EmptyComboElement.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/EmptyComboElement.java with 86% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractEnumComboElement.java with 62% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractTermComboElement.java with 88% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/MultilanguageTextElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/PointElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ModifierElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/ScopeElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StateDataElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/StatisticalMeasurementValueElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/CommonNameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/DistributionDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/QuantitativeDataDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameTypeDesignationElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.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/DeterminationEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AnnotationElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/ExtensionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/MarkerElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/RightsElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/AbstractTermBaseDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AnnotationTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/DeterminationModifierComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ExtensionTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/LanguageComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/MarkerTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/MeasurementUnitComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ModifierComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NameRelationshipTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NameTypeDesignationStatusComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NamedAreaTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NomenclaturalCodeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NomenclaturalStatusTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/PresenceAbsenceTermComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/PreservationMethodComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/RankComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ReferenceSystemComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ReferenceTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/RightsTypeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ScopeComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/SexComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/SpecimenTypeDesignationStatusComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StageComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StateComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StatisticalMeasureComboElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/TaxonRelationshipTypeComboElement.java [deleted file]
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/AbstractCdmViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index cae0e78b90581fbecd318fbefa89bfb1afab24fa..c5a8995a2a82089c2dc8c7ed8a207767fc88aaa3 100644 (file)
@@ -847,6 +847,29 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wiz
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceSQLServerWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceTypeSelectionWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/datasource/wizard/CdmDataSourceWizard.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermBasePropertyTester.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermContentProvider.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermTransfer.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateTermVocabularyHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/DeleteTermBaseHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermMenu.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/AbstractDefinedTermEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/DefinedTermEditorInputFactory.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/ExtensionTypeEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/FeatureEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/MarkerTypeEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaLevelEditorInput.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateDefinedTermOperation.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateTermVocabularyOperation.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/AvailableFeaturesWizard.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/AvailableFeaturesWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/EditFeatureTreeWizardPage.java -text
@@ -990,6 +1013,9 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermMana
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/internal/TaxeditorStorePlugin.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/bar/AuthenticatedUserBar.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EmptyComboElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/LoginDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/UriDialog.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialogs/filteredSelection/AbstractFilteredCdmResourceSelectionDialog.java -text
@@ -1224,6 +1250,14 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/use
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/user/UserDetailWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/AbstractTermBaseDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/DefinedTermDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/NamedAreaLevelDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermVocabularyDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/AbstractSelectionElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/AgentSelectionElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/ClassificationSelectionElement.java -text
@@ -1248,34 +1282,6 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/T
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TaxonSelectionElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/TeamSelectionElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/UserSelectionElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractEnumComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractTermComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AnnotationTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/DeterminationModifierComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/EmptyComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ExtensionTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/LanguageComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/MarkerTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/MeasurementUnitComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ModifierComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NameRelationshipTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NameTypeDesignationStatusComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NamedAreaTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NomenclaturalCodeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/NomenclaturalStatusTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/PresenceAbsenceTermComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/PreservationMethodComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/RankComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ReferenceSystemComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ReferenceTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/RightsTypeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/ScopeComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/SexComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/SpecimenTypeDesignationStatusComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StageComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StateComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/StatisticalMeasureComboElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/TaxonRelationshipTypeComboElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/GoogleLanguageApiWrapper.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/ITranslationServiceWrapper.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/LanguageNotSupportedException.java -text
index 982c8fd988fe19bca2100c5397953a4541c453b0..105f62e2de1d786e91b4c4cded4ba473b8da8790 100644 (file)
@@ -26,7 +26,7 @@ public class ApplicationUtil extends AbstractUtility {
         *
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       public static String getPluginId(){
                return TaxonomicEditorPlugin.PLUGIN_ID;
        }
        
index e6bc27539d7a4f49147ea7a64977c87474ded4e1..77e70cad0ca9de8c9e46bf0f2389d7ffa915486a 100644 (file)
@@ -73,7 +73,7 @@ public class BulkEditorUtil extends AbstractUtility{
         *
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       public static String getPluginId(){
                return TaxeditorBulkeditorPlugin.PLUGIN_ID;
        }
        
index 117f32e43a878b9c2369ef2e3cb529d7ede50d59..d244ab961a840973aef747cc764d0413e0585514 100644 (file)
@@ -49,7 +49,7 @@ public class DynamicMarkerTypeEditingMenu extends CompoundContributionItem {
                return new IContributionItem[] {
                                new ContributionItem() {
                                        public void fill(Menu menu, int index){
-                                               for(MarkerType markerType : CdmStore.getTermManager().getPreferredMarkerTypes()){
+                                               for(MarkerType markerType : CdmStore.getTermManager().getPreferredTerms(MarkerType.class)){
                                                        createMenuItem(menu, markerType);
                                                }
                                        }
index b999d4e385eace55026bdecb0c8db139e732b8e1..12fe3a4e3ae52e6c3e42100870410ae1a58512d3 100644 (file)
@@ -57,7 +57,7 @@ public class NameCreator implements IEntityCreator<TaxonNameBase> {
         */
        public Map<Object, String> getKeyLabelPairs() {
                Map<Object, String> result = new HashMap<Object, String>();
-               for (Rank rank : CdmStore.getTermManager().getPreferredRanks()) {
+               for (Rank rank : CdmStore.getTermManager().getPreferredTerms(Rank.class)) {
                        result.put(rank, rank.getLabel());
                }
                return result;
index e677b4d333027dcbd134994dee1913d3b20e61e8..b2fdb3cfb9934c5b7bcb863739e5a36dbf1d87d7 100644 (file)
@@ -56,7 +56,7 @@ public class BulkEditorMarkerPreferencePage extends PreferencePage implements IW
                Composite container = new Composite(parent, SWT.NULL);
                container.setLayout(new GridLayout());
 
-               for (final MarkerType markerType : TermStore.getNonTechnicalMarkerTypes()) {
+               for (final MarkerType markerType : TermStore.getTerms(MarkerType.class)) {
                        final Button button = new Button(container, SWT.CHECK);
                        button.setText(String.format("Edit '%s' markers", markerType.getLabel()));
                
index a0ff574b1bc03f0d4ce0c1a943c9572216f1cfcd..6b053d5451713236225db7dd0ec31b3366334700 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry exported="true" kind="lib" path="lib/poi-3.6.jar"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry exported="true" kind="lib" path="lib/activation-1.1.jar" sourcepath="lib/activation-1.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/antlr-2.7.6.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/asm-attrs.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/asm.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.6.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.6.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/avalon-framework-4.2.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/batik-all-1.7.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.1.jar" sourcepath="lib/c3p0-0.9.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/cglib-2.1.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.0.jar" sourcepath="lib/commons-beanutils-1.7.0src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.jar" sourcepath="lib/commons-collections-3.2src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.2.2.jar" sourcepath="lib/commons-dbcp-1.2.2src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-io-1.4.jar" sourcepath="lib/commons-io-1.4src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.4.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.0.4.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.3.jar" sourcepath="lib/commons-pool-1.3src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/dozer-5.3.0.jar" sourcepath="lib/dozer-5.3.0src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/ehcache-1.2.3.jar" sourcepath="lib/ehcache-1.2.3src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/ejb3-persistence.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/ezmorph-1.0.4.jar" sourcepath="lib/ezmorph-1.0.4src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/fop.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/google-api-translate-java-0.92.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/h2-1.1.115.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-annotations-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-annotations-3.4.0-SNAPSHOTsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-commons-annotations-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-commons-annotations-3.4.0-SNAPSHOTsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-core-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-core-3.4.0-SNAPSHOTsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-search-3.1.0.GA.jar" sourcepath="lib/hibernate-search-3.1.0.GAsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-tools-3.2.0.ga.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-validator-4.0.0.CR1.jar" sourcepath="lib/hibernate-validator-4.0.0.CR1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/hsqldb.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/httpclient-4.0.1.jar" sourcepath="lib/httpclient-4.0.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar" sourcepath="lib/httpcore-4.0.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/javassist.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jaxb-api-2.1.6.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jaxb-impl-2.1.6.jar" sourcepath="lib/jaxb-impl-2.1.6src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jdbc-1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jdbc2_0-stdext.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jdom.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/joda-time-1.5.jar" sourcepath="lib/joda-time-1.5src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/joda-time-hibernate-1.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/json-lib-2.2.3-jdk15.jar" sourcepath="lib/json-lib-2.2.3-jdk15src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/jsr250-api-1.0.jar" sourcepath="lib/jsr250-api-1.0src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/jta.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/jtds-1.2.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/junit-4.8.1.jar" sourcepath="lib/junit-4.8.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.14.jar" sourcepath="lib/log4j-1.2.14src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/lsid-client-1.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/lsid-server-1.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/lucene-core-2.4.0.jar" sourcepath="lib/lucene-core-2.4.0src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/lucene-spellchecker-2.4.0.jar" sourcepath="lib/lucene-spellchecker-2.4.0src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/mail-1.4.jar" sourcepath="lib/mail-1.4src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/msbase-2000.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/mssqlserver-2000.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/msutil-2000.3.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.0.5.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/odfdom-0.8.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/opencsv-1.8.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.apache.commons.codec-1.3.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.eclipse.equinox.common-3.6.0.v20100503.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.eclipse.osgi-3.6.2.R36x_v20110210.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.aop-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.aop-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.asm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.asm-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.aspects-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.aspects-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.beans-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.context-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.context.support-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.context.support-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.core-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.core-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.expression-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.expression-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.jdbc-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.jdbc-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.orm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.orm-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.oxm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.oxm-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.transaction-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.transaction-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.web-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/org.springframework.web.servlet-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.web.servlet-3.0.4.RELEASEsrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/postgresql-8.2-504.jdbc4.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/sanselan-0.97-incubator.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/saxon9he.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/serializer-2.7.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/servlet-2.5.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/servlet-api-2.5.jar" sourcepath="lib/servlet-api-2.5src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.5.2.jar" sourcepath="lib/slf4j-api-1.5.2src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.5.2.jar" sourcepath="lib/slf4j-log4j12-1.5.2src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/spring-modules-cache-0.7.jar" sourcepath="lib/spring-modules-cache-0.7src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/spring-modules-lucene-0.8a.jar" sourcepath="lib/spring-modules-lucene-0.8asrc.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/spring-security-config-3.0.5.RELEASE.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.0.5.RELEASE.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.1.jar" sourcepath="lib/wsdl4j-1.6.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/xalan-2.7.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.7.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xml-apis-1.3.04.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xml-apis.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xml-resolver-1.2.jar" sourcepath="lib/xml-resolver-1.2src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/xmlgraphics-commons-1.3.1.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xom-1.0.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xsltc.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/xstream-1.3.1.jar" sourcepath="lib/xstream-1.3.1src.zip"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.0.9-SNAPSHOT.jar" sourcepath="/Users/nph/.m2/repository/eu/etaxonomy/cdmlib-model/3.0.9-SNAPSHOT/cdmlib-model-3.0.9-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.0.9-SNAPSHOT.jar" sourcepath="/Users/nph/.m2/repository/eu/etaxonomy/cdmlib-persistence/3.0.9-SNAPSHOT/cdmlib-persistence-3.0.9-SNAPSHOT-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.0.9-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.0.9-SNAPSHOT.jar" sourcepath="/cdmlib-services"/>
-       <classpathentry exported="true" kind="lib" path="lib/hibernate-envers-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-envers-3.4.0-SNAPSHOTsrc.zip"/>
-       <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/activation-1.1.jar" sourcepath="lib/activation-1.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/antlr-2.7.6.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/asm-attrs.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/asm.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/aspectjrt-1.6.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/aspectjweaver-1.6.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/avalon-framework-4.2.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/batik-all-1.7.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.1.jar" sourcepath="lib/c3p0-0.9.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cglib-2.1.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-beanutils-1.7.0.jar" sourcepath="lib/commons-beanutils-1.7.0src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-collections-3.2.jar" sourcepath="lib/commons-collections-3.2src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-dbcp-1.2.2.jar" sourcepath="lib/commons-dbcp-1.2.2src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-io-1.3.1.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-io-1.4.jar" sourcepath="lib/commons-io-1.4src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-lang-2.4.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-logging-1.0.4.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/commons-pool-1.3.jar" sourcepath="lib/commons-pool-1.3src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/dom4j-1.6.1.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/dozer-5.3.0.jar" sourcepath="lib/dozer-5.3.0src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/ehcache-1.2.3.jar" sourcepath="lib/ehcache-1.2.3src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/ejb3-persistence.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/ezmorph-1.0.4.jar" sourcepath="lib/ezmorph-1.0.4src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/fop.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/google-api-translate-java-0.92.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/h2-1.1.115.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-annotations-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-annotations-3.4.0-SNAPSHOTsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-commons-annotations-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-commons-annotations-3.4.0-SNAPSHOTsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-core-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-core-3.4.0-SNAPSHOTsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-search-3.1.0.GA.jar" sourcepath="lib/hibernate-search-3.1.0.GAsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-tools-3.2.0.ga.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-validator-4.0.0.CR1.jar" sourcepath="lib/hibernate-validator-4.0.0.CR1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hsqldb.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/httpclient-4.0.1.jar" sourcepath="lib/httpclient-4.0.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/httpcore-4.0.1.jar" sourcepath="lib/httpcore-4.0.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/javassist.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jaxb-api-2.1.6.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jaxb-impl-2.1.6.jar" sourcepath="lib/jaxb-impl-2.1.6src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jaxen-1.1.2.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jdbc-1.2.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jdbc2_0-stdext.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jdom.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/joda-time-1.5.jar" sourcepath="lib/joda-time-1.5src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/joda-time-hibernate-1.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/json-lib-2.2.3-jdk15.jar" sourcepath="lib/json-lib-2.2.3-jdk15src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jsr250-api-1.0.jar" sourcepath="lib/jsr250-api-1.0src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jta.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/jtds-1.2.2.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/junit-4.8.1.jar" sourcepath="lib/junit-4.8.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/log4j-1.2.14.jar" sourcepath="lib/log4j-1.2.14src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/lsid-client-1.1.2.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/lsid-server-1.1.2.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/lucene-core-2.4.0.jar" sourcepath="lib/lucene-core-2.4.0src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/lucene-spellchecker-2.4.0.jar" sourcepath="lib/lucene-spellchecker-2.4.0src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/mail-1.4.jar" sourcepath="lib/mail-1.4src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/msbase-2000.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/mssqlserver-2000.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/msutil-2000.3.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/mysql-connector-java-5.0.5.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/odfdom-0.8.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/opencsv-1.8.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.apache.commons.codec-1.3.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.eclipse.equinox.common-3.6.0.v20100503.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.eclipse.osgi-3.6.2.R36x_v20110210.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.aop-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.aop-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.asm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.asm-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.aspects-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.aspects-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.beans-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.beans-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.context-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.context-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.context.support-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.context.support-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.core-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.core-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.expression-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.expression-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.jdbc-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.jdbc-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.orm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.orm-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.oxm-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.oxm-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.transaction-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.transaction-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.web-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.web-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/org.springframework.web.servlet-3.0.4.RELEASE.jar" sourcepath="lib/org.springframework.web.servlet-3.0.4.RELEASEsrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/poi-3.6.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/postgresql-8.2-504.jdbc4.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/sanselan-0.97-incubator.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/saxon9he.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/serializer-2.7.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/servlet-2.5.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/servlet-api-2.5.jar" sourcepath="lib/servlet-api-2.5src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.5.2.jar" sourcepath="lib/slf4j-api-1.5.2src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/slf4j-log4j12-1.5.2.jar" sourcepath="lib/slf4j-log4j12-1.5.2src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/spring-modules-cache-0.7.jar" sourcepath="lib/spring-modules-cache-0.7src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/spring-modules-lucene-0.8a.jar" sourcepath="lib/spring-modules-lucene-0.8asrc.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/spring-security-config-3.0.5.RELEASE.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/spring-security-core-3.0.5.RELEASE.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/wsdl4j-1.6.1.jar" sourcepath="lib/wsdl4j-1.6.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xalan-2.7.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.7.1.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xercesImpl.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xml-apis-1.3.04.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xml-apis-ext-1.3.04.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xml-apis.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xml-resolver-1.2.jar" sourcepath="lib/xml-resolver-1.2src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xmlgraphics-commons-1.3.1.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xom-1.0.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xsltc.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/xstream-1.3.1.jar" sourcepath="lib/xstream-1.3.1src.zip"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.0.9-SNAPSHOT.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.0.9-SNAPSHOT.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.0.9-SNAPSHOT.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.0.9-SNAPSHOT.jar" sourcepath="C:/Users/l.morris/.m2/repository/eu/etaxonomy/cdmlib-model/3.0.9-SNAPSHOT/cdmlib-model-3.0.9-SNAPSHOT-sources.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.0.9-SNAPSHOT.jar" sourcepath="C:/Users/l.morris/.m2/repository/eu/etaxonomy/cdmlib-persistence/3.0.9-SNAPSHOT/cdmlib-persistence-3.0.9-SNAPSHOT-sources.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.0.9-SNAPSHOT.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.0.9-SNAPSHOT.jar"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.0.9-SNAPSHOT.jar" sourcepath="/cdmlib-services"/>\r
+       <classpathentry exported="true" kind="lib" path="lib/hibernate-envers-3.4.0-SNAPSHOT.jar" sourcepath="lib/hibernate-envers-3.4.0-SNAPSHOTsrc.zip"/>\r
+       <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
index 2fcf7ad76592820c07cddfabb8c949a43f4682f1..f1758c8214856224cfac3634a61e5438f5091780 100644 (file)
@@ -306,7 +306,7 @@ public class EditorUtil extends AbstractUtility {
         * 
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId() {
+       public static String getPluginId() {
                return TaxeditorEditorPlugin.PLUGIN_ID;
        }
 
index 6c024a2075eae4f17c5d030f5a510d8eade5ccb9..a651461cf2ebaa5c04eface5045fa6efea83f119 100644 (file)
@@ -34,7 +34,7 @@ public abstract class AbstractDynamicConceptRelationMenu extends ContributionIte
        public void fill(Menu menu, int index){
                final IHandlerService handlerService = (IHandlerService) TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class);
                
-               for(final TaxonRelationshipTypeInverseContainer container : CdmStore.getTermManager().getRelationshipTypesWithInverses()){
+               for(final TaxonRelationshipTypeInverseContainer container : CdmStore.getTermManager().getPreferredTerms(TaxonRelationshipTypeInverseContainer.class)){
                        MenuItem menuItem = new MenuItem(menu, -1);
                        menuItem.setText(container.getTitleCache());
                        menuItem.setData(container);
index 568c914fd3587d8785ce6046b3267381afc9bde0..d76d6e575911d8b785ae05123c96e5b6274f10af 100644 (file)
@@ -11,6 +11,7 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
+import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
@@ -112,7 +113,7 @@ public class DescriptiveContentProvider implements ITreeContentProvider {
                
                // create a transient tree with all features if none was selected
                if(featureTree == null){
-                       featureTree = FeatureTree.NewInstance(TermStore.getFeatures());
+                       featureTree = FeatureTree.NewInstance(TermStore.getTerms(Feature.class));
                }
                
                return featureTree;
index b3799a0c3726771848b7df051ff53e77931fb27c..9b1a7380c1bae04a7737d008a30c7bb49d7ec44f 100644 (file)
@@ -42,6 +42,7 @@ import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
 import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
@@ -165,6 +166,11 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                        return;
                }
                
+               if(part instanceof DefinedTermEditor){
+                       showEmptyPage();
+                       return;
+               }
+               
                if(part instanceof MultiPageTaxonEditor){
                        if(! part.equals(this.part)){
                                IEditorInput input = ((IEditorPart) part).getEditorInput();
index f2374a56db6e84484e5ce1fb613c8d1085506296..f1194d7857892d60ff4ca42c491bfe19ebb9a8ab 100644 (file)
@@ -134,7 +134,7 @@ public class DynamicFeatureMenu extends CompoundContributionItem {
                }
                
                if(featureTree == null){
-                       featureTree = FeatureTree.NewInstance(CdmStore.getTermManager().getPreferredFeatures());
+                       featureTree = FeatureTree.NewInstance(CdmStore.getTermManager().getPreferredTerms(Feature.class));
                }
                
                return featureTree;
index 5a76457d792e5541d54782cc2a43a5fc849c2e9e..5925be91e873ab2ed6bc4acddf15898b199cac96 100644 (file)
@@ -317,7 +317,7 @@ public class NavigationUtil extends AbstractUtility{
         *
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       public static String getPluginId(){
                return TaxeditorNavigationPlugin.PLUGIN_ID;
        }
 
index 77d98881b0cb63c09845cb1be2eff17bad5717c9..15bcf0edd6cea9d4672fa9a5ec24fb0e111239a2 100644 (file)
@@ -9,6 +9,7 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.cdm.database,
  eu.etaxonomy.taxeditor.datasource,
  eu.etaxonomy.taxeditor.datasource.wizard,
+ eu.etaxonomy.taxeditor.editor.definedterm,
  eu.etaxonomy.taxeditor.featuretree,
  eu.etaxonomy.taxeditor.handler,
  eu.etaxonomy.taxeditor.io,
@@ -26,6 +27,7 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.store.internal,
  eu.etaxonomy.taxeditor.store.operations,
  eu.etaxonomy.taxeditor.ui.bar,
+ eu.etaxonomy.taxeditor.ui.combo,
  eu.etaxonomy.taxeditor.ui.dialogs,
  eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection,
  eu.etaxonomy.taxeditor.ui.forms,
@@ -40,7 +42,6 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.ui.section.supplemental,
  eu.etaxonomy.taxeditor.ui.section.taxon,
  eu.etaxonomy.taxeditor.ui.selection,
- eu.etaxonomy.taxeditor.ui.term,
  eu.etaxonomy.taxeditor.view,
  eu.etaxonomy.taxeditor.view.datasource,
  eu.etaxonomy.taxeditor.view.datasource.handler,
index dbcc37fbf03ffc0bbee7f228cec0f332fd9ea508..33e09770c35a59bf7b92bb813d5a657fb71110f3 100644 (file)
         restorable="true">
   </view>
    </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor"
+            default="false"
+            id="eu.etaxonomy.taxeditor.editor.definedTerm"
+            name="Defined Term Editor">
+      </editor>
+   </extension>
    <extension
          point="org.eclipse.ui.menus">
       <menuContribution
                </visibleWhen>
             </command>
          </menu>
+         <menu
+               id="eu.etaxonomy.taxeditor.store.definedTermEditorMenu"
+               label="Term Editor">
+            <command
+                  commandId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+                  label="Named Area"
+                  style="push">
+               <parameter
+                     name="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+                     value="eu.etaxonomy.cdm.model.location.NamedArea">
+               </parameter>
+            </command>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+                  label="Named Area Level"
+                  style="push">
+               <parameter
+                     name="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+                     value="eu.etaxonomy.cdm.model.location.NamedAreaLevel">
+               </parameter>
+            </command>
+            <separator
+                  name="eu.etaxonomy.taxeditor.store.definedTermEditorMenu.separator2"
+                  visible="true">
+            </separator>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+                  label="Extension Type"
+                  style="push">
+               <parameter
+                     name="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+                     value="eu.etaxonomy.cdm.model.common.ExtensionType">
+               </parameter>
+            </command>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+                  label="Marker Type"
+                  style="push">
+               <parameter
+                     name="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+                     value="eu.etaxonomy.cdm.model.description.Feature">
+               </parameter>
+            </command>
+            <separator
+                  name="eu.etaxonomy.taxeditor.store.definedTermEditorMenu.separator3"
+                  visible="true">
+            </separator>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+                  label="Feature"
+                  style="push">
+               <parameter
+                     name="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+                     value="eu.etaxonomy.cdm.model.description.Feature">
+               </parameter>
+            </command>
+         </menu>
       </menuContribution>
       <menuContribution
             locationURI="menu:org.eclipse.ui.main.menu.file?after=eu.etaxonomy.taxeditor.application.filemenu.io">
             </control>
          </toolbar>
       </menuContribution>
+      <menuContribution
+            locationURI="popup:eu.etaxonomy.taxeditor.editor.definedTerm">
+         <menu
+               label="New">
+            <command
+                  commandId="eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary"
+                  label="Vocabulary"
+                  style="push">
+            </command>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm"
+                  label="Defined Term"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="true">
+                  <reference
+                        definitionId="isModifiable">
+                  </reference>
+               </visibleWhen>
+            </command>
+         </menu>
+         <command
+               commandId="org.eclipse.ui.edit.delete"
+               label="Delete"
+               style="push">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isModifiable">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
    </extension>
    <extension
          name="Window Menu Commands"
          point="org.eclipse.ui.commands">
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.OpenDefinedTermEditorHandler"
+            id="eu.etaxonomy.taxeditor.store.openDefinedTermEditor"
+            name="Open Defined Term Editor">
+         <commandParameter
+               id="eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter"
+               name="inputType"
+               optional="true">
+         </commandParameter>
+      </command>
+   </extension>
+   <extension
+         name="File Menu Commands"
+         point="org.eclipse.ui.commands">
       <command
             defaultHandler="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
             id="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
             </with>
          </activeWhen>
       </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.editor.definedterm.handler.DeleteTermBaseHandler"
+            commandId="org.eclipse.ui.edit.delete">
+         <activeWhen>
+            <with
+                  variable="activePartId">
+               <equals
+                     value="eu.etaxonomy.taxeditor.editor.definedTerm">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
    </extension>
    <extension
          name="Popup Menu Commands"
             name="Update Datasource">
       </command>
    </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.CreateDefinedTermHandler"
+            id="eu.etaxonomy.taxeditor.editor.definedTerms.newDefinedTerm"
+            name="New Defined Term">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.definedterm.handler.CreateTermVocabularyHandler"
+            id="eu.etaxonomy.taxeditor.editor.definedTerms.newTermVocabulary"
+            name="New Term Vocabulary">
+      </command>
+   </extension>
    <extension
          point="org.eclipse.ui.importWizards">
       <category
          properties="isShowExperimentalFeatures"
          type="org.eclipse.jface.viewers.IStructuredSelection">
    </propertyTester>
+   <propertyTester
+         class="eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester"
+         id="eu.etaxonomy.taxeditor.store.termEditor.propertyTester"
+         namespace="eu.etaxonomy.taxeditor.store.termEditor.propertyTester"
+         properties="isModifiable"
+         type="org.eclipse.jface.viewers.IStructuredSelection">
+   </propertyTester>
 </extension>
 <extension
       point="org.eclipse.core.expressions.definitions">
          </test>
       </with>
    </definition>
+   <definition
+         id="isModifiable">
+      <with
+            variable="activeMenuSelection">
+         <test
+               property="eu.etaxonomy.taxeditor.store.termEditor.propertyTester.isModifiable">
+         </test>
+      </with>
+   </definition>
 </extension>
        
 </plugin>
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDragListener.java
new file mode 100644 (file)
index 0000000..42ead93
--- /dev/null
@@ -0,0 +1,77 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.jface.viewers.Viewer;\r
+import org.eclipse.swt.dnd.DragSourceAdapter;\r
+import org.eclipse.swt.dnd.DragSourceEvent;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 10 Jan 2012\r
+ *\r
+ */\r
+public class DefinedTermDragListener extends DragSourceAdapter {\r
+       \r
+       private Viewer viewer;\r
+\r
+       /**\r
+        * \r
+        */\r
+       public DefinedTermDragListener(Viewer viewer) {\r
+               this.viewer = viewer;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)\r
+        */\r
+       @Override\r
+       public void dragStart(DragSourceEvent event) {\r
+               \r
+               event.doit = true;// set to false if needed - default is true\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)\r
+        */\r
+       @Override\r
+       public void dragFinished(DragSourceEvent event) {\r
+               // TODO Auto-generated method stub\r
+               super.dragFinished(event);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)\r
+        */\r
+       @Override\r
+       public void dragSetData(DragSourceEvent event) {\r
+               \r
+               IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();\r
+               List<DefinedTermBase> definedTerms = new ArrayList<DefinedTermBase>();\r
+               \r
+               for (Object object : selection.toList()){\r
+                               definedTerms.add((DefinedTermBase)object);\r
+                       }\r
+                       \r
+               if (TermTransfer.getInstance().isSupportedType(\r
+                               event.dataType)) {\r
+                       event.data = definedTerms.toArray(new DefinedTermBase[definedTerms.size()]);\r
+               }\r
+       }\r
+       \r
+       \r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermDropAdapter.java
new file mode 100644 (file)
index 0000000..8744410
--- /dev/null
@@ -0,0 +1,77 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.eclipse.jface.viewers.ViewerDropAdapter;\r
+import org.eclipse.swt.dnd.TransferData;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.MoveDefinedTermOperation;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 10 Jan 2012\r
+ *\r
+ */\r
+public class DefinedTermDropAdapter extends ViewerDropAdapter {\r
+\r
+       private DefinedTermEditor editor;\r
+       /**\r
+        * @param viewer\r
+        */\r
+       protected DefinedTermDropAdapter(DefinedTermEditor editor) {\r
+               super(editor.getViewer());\r
+               this.editor = editor;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)\r
+        */\r
+       @Override\r
+       public boolean performDrop(Object data) {\r
+               \r
+               TermBase target = (TermBase) getCurrentTarget();//can be vocab\r
+               //DefinedTermBase[] droppedElements = (DefinedTermBase[]) data;\r
+               Object[] droppedTerms = (Object[]) data;\r
+               Collection<DefinedTermBase> sourceTerms = new ArrayList<DefinedTermBase>(); //Arrays.asList(droppedElements)\r
+               \r
+               for (Object droppedTerm : droppedTerms) {\r
+                       \r
+                       DefinedTermBase term = (DefinedTermBase) droppedTerm;\r
+                       sourceTerms.add(term);\r
+                       \r
+               }\r
+               \r
+               AbstractPostOperation operation = new MoveDefinedTermOperation("Move Descriptions", StoreUtil.getUndoContext(), target, sourceTerms, editor);\r
+               //TODO: implement execute\r
+               StoreUtil.executeOperation(operation);\r
+               \r
+               return true;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)\r
+        */\r
+       @Override\r
+       public boolean validateDrop(Object target, int operation,\r
+                       TransferData transferType) {\r
+               boolean transferDataIsSupported = TermTransfer.getInstance().isSupportedType(transferType);\r
+               System.out.println(target);\r
+               // maybe don't need this - they will be all TermBase anyway\r
+               return target instanceof TermBase && transferDataIsSupported; \r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java
new file mode 100644 (file)
index 0000000..6ff74b9
--- /dev/null
@@ -0,0 +1,270 @@
+// $Id$\r
+/**\r
+ * Copyright (C) 2009 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
+ * \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.HashSet;\r
+import java.util.List;\r
+import java.util.Set;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.jface.action.GroupMarker;\r
+import org.eclipse.jface.action.MenuManager;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.jface.viewers.StructuredSelection;\r
+import org.eclipse.jface.viewers.TreeViewer;\r
+import org.eclipse.jface.viewers.ViewerSorter;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.dnd.DND;\r
+import org.eclipse.swt.dnd.Transfer;\r
+import org.eclipse.swt.layout.FillLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Menu;\r
+import org.eclipse.ui.IEditorInput;\r
+import org.eclipse.ui.IEditorSite;\r
+import org.eclipse.ui.ISelectionListener;\r
+import org.eclipse.ui.ISelectionService;\r
+import org.eclipse.ui.IWorkbenchActionConstants;\r
+import org.eclipse.ui.IWorkbenchPart;\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.part.EditorPart;\r
+\r
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;\r
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.model.common.CdmBase;\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.input.AbstractDefinedTermEditorInput;\r
+import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;\r
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 3 Jan 2012\r
+ *\r
+ */\r
+public class DefinedTermEditor extends EditorPart implements IConversationEnabled, ISelectionListener, IDirtyMarkableSelectionProvider, IPostOperationEnabled {\r
+\r
+       public static final String ID = "eu.etaxonomy.taxeditor.editor.definedTerm";\r
+\r
+       public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor";\r
+       \r
+       protected TreeViewer viewer;\r
+       protected ConversationHolder conversation;\r
+       private ISelectionService selectionService;\r
+       private boolean dirty;\r
+       Set<TermVocabulary<? extends DefinedTermBase>> inMemoryVocabularies = new HashSet<TermVocabulary<? extends DefinedTermBase>>();\r
+\r
+       private int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;\r
+       /**\r
+        * \r
+        */\r
+       public DefinedTermEditor() {\r
+               super();\r
+               conversation = CdmStore.createConversation();\r
+       }\r
+\r
+       @Override\r
+       public void createPartControl(Composite parent) {\r
+                       \r
+       //              parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));\r
+                       \r
+                       FillLayout layout = new FillLayout();\r
+                       layout.marginHeight = 0;\r
+                       layout.marginWidth = 0;\r
+                       layout.type = SWT.VERTICAL;\r
+                       \r
+                       parent.setLayout(layout);\r
+                       viewer = new TreeViewer(parent);\r
+                       viewer.getControl().setLayoutData(CdmFormFactory.FILL());\r
+                       viewer.setContentProvider(new TermContentProvider());\r
+                       viewer.setLabelProvider(new TermLabelProvider());\r
+                       viewer.setSorter(new ViewerSorter());\r
+                       \r
+                       Transfer[] transfers = new Transfer[] { TermTransfer.getInstance() };\r
+                       viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListener(viewer));\r
+                       viewer.addDropSupport(dndOperations, transfers, new DefinedTermDropAdapter(this));\r
+\r
+                                       \r
+                       initialiseVocabularies();               \r
+                       viewer.setInput(inMemoryVocabularies);\r
+                                               \r
+                       getSite().setSelectionProvider(viewer);\r
+                       \r
+                       selectionService = getSite().getWorkbenchWindow().getSelectionService();\r
+                       selectionService.addSelectionListener(this);\r
+       \r
+                       setPartName(getEditorInput().getName());\r
+                       createMenu();\r
+               }\r
+       \r
+       \r
+       protected void initialiseVocabularies() {\r
+               inMemoryVocabularies.clear();\r
+               //List<TermVocabulary> vocabularies = CdmStore.getService(IVocabularyService.class).list(null, null, null, null, null);\r
+\r
+//             for (TermVocabulary vocabulary : vocabularies){\r
+//                     if(vocabulary.getTerms().isEmpty()){\r
+//                             inMemoryVocabularies.add(vocabulary);\r
+//                     }\r
+//             }\r
+\r
+               \r
+               List<TermVocabulary<? extends DefinedTermBase>> termVocabularies = CdmStore.getService(IVocabularyService.class).listByTermClass(getDefinedTermEditorInput().getTermClass(), true, true, null, null, null, null);\r
+               \r
+               \r
+               inMemoryVocabularies.addAll(termVocabularies);\r
+       }\r
+       \r
+       /**\r
+        * \r
+        */\r
+       public AbstractDefinedTermEditorInput getDefinedTermEditorInput() {\r
+               return (AbstractDefinedTermEditorInput) getEditorInput();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)\r
+        */\r
+       @Override\r
+       public boolean postOperation(CdmBase objectAffectedByOperation) {\r
+\r
+               if(objectAffectedByOperation instanceof DefinedTermBase){\r
+                       viewer.refresh();\r
+               } else if (objectAffectedByOperation instanceof TermVocabulary){\r
+//                     if (inMemoryVocabularies.contains(objectAffectedByOperation)){\r
+//                             inMemoryVocabularies.remove((TermVocabulary) objectAffectedByOperation);\r
+//                     }else{\r
+//                             inMemoryVocabularies.add((TermVocabulary) objectAffectedByOperation);\r
+//                             DetailsViewPart view = (DetailsViewPart) StoreUtil.getView(DetailsViewPart.ID, true);\r
+//                             view.setFocus();\r
+//                     }\r
+                       \r
+//                     viewer.setInput(inMemoryVocabularies);\r
+                       viewer.refresh();\r
+                       \r
+               }\r
+               \r
+               \r
+               \r
+               if(objectAffectedByOperation != null){\r
+                       viewer.setSelection(new StructuredSelection(objectAffectedByOperation));\r
+               }\r
+               setDirty(true);\r
+\r
+               return true;\r
+       } \r
+\r
+       private void createMenu() {\r
+               // register context menu\r
+               MenuManager menuManager = new MenuManager();\r
+               menuManager\r
+                               .add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));\r
+               getSite().registerContextMenu(ID, menuManager, viewer);\r
+       \r
+               Control control = viewer.getControl();\r
+               Menu menu = menuManager.createContextMenu(control);\r
+               control.setMenu(menu);\r
+       }\r
+       \r
+\r
+               \r
+\r
+       @Override\r
+       public void doSave(IProgressMonitor monitor) {\r
+               getConversationHolder().commit();\r
+               setDirty(false);\r
+               initialiseVocabularies();\r
+       }\r
+       \r
+\r
+       @Override\r
+       public void doSaveAs() {}\r
+\r
+       @Override\r
+       public void init(IEditorSite site, IEditorInput input) throws PartInitException {\r
+               setSite(site);\r
+               setInput(input);\r
+               \r
+       }\r
+\r
+       @Override\r
+       public boolean isDirty() {\r
+               return dirty;\r
+       }\r
+\r
+       @Override\r
+       public boolean isSaveAsAllowed() {\r
+               return false;\r
+       }\r
+\r
+       @Override\r
+       public void setFocus() {\r
+               getConversationHolder().bind();\r
+       }\r
+\r
+       @Override\r
+       public void update(CdmDataChangeMap changeEvents) {\r
+               // TODO Auto-generated method stub\r
+               \r
+       }\r
+\r
+       @Override\r
+       public ConversationHolder getConversationHolder() {\r
+               return conversation;\r
+       }\r
+\r
+       @Override\r
+       public void selectionChanged(IWorkbenchPart part, ISelection selection) {\r
+               // TODO Auto-generated method stub\r
+               \r
+       }\r
+\r
+       @Override\r
+       public void changed(Object element) {\r
+               dirty = true;\r
+               setDirty(true);\r
+               viewer.update(element, null);\r
+       }\r
+\r
+       /**\r
+        * @param dirty the dirty to set\r
+        */\r
+       public void setDirty(boolean dirty) {\r
+               this.dirty = dirty;\r
+               firePropertyChange(PROP_DIRTY);\r
+       }\r
+\r
+       @Override\r
+       public boolean onComplete() {\r
+               // TODO Auto-generated method stub\r
+               return false;\r
+       }\r
+\r
+       /**\r
+        * \r
+        */\r
+       public TreeViewer getViewer() {\r
+               return viewer;\r
+       }\r
+\r
+       /**\r
+        * @return \r
+        * \r
+        */\r
+       public Set<TermVocabulary<? extends DefinedTermBase>> getInMemoryVocabularies() {\r
+               return inMemoryVocabularies;\r
+       }\r
+\r
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermBasePropertyTester.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermBasePropertyTester.java
new file mode 100644 (file)
index 0000000..6c9e0f4
--- /dev/null
@@ -0,0 +1,84 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+\r
+import org.eclipse.core.expressions.PropertyTester;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.Marker;\r
+import eu.etaxonomy.cdm.model.common.MarkerType;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.AbstractTermBaseDetailElement;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 9 Jan 2012\r
+ *\r
+ */\r
+public class TermBasePropertyTester extends PropertyTester {\r
+\r
+       private static final String IS_MODIFIABLE = "isModifiable";\r
+       \r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)\r
+        */\r
+       @Override\r
+       public boolean test(Object receiver, String property, Object[] args,\r
+                       Object expectedValue) {\r
+               \r
+               IStructuredSelection selection = (IStructuredSelection) receiver;\r
+               TermBase selectedElement = (TermBase) selection.getFirstElement();\r
+               \r
+               if(IS_MODIFIABLE.equals(property)){\r
+                       return isModifiable(selectedElement);\r
+               }\r
+               \r
+               return false;\r
+       }\r
+\r
+\r
+       /**\r
+        * Checks whether there is a {@link Marker} with the type {@link MarkerType#MODIFIABLE()} and if there is then return its value.\r
+        * \r
+        * @return The markers value if it exists \r
+        */\r
+       public static boolean isModifiable(TermBase termBase) {\r
+               if (termBase == null){\r
+                       return true;\r
+               }\r
+               \r
+               TermVocabulary vocabulary = null;\r
+               \r
+               if(termBase instanceof DefinedTermBase){\r
+                       vocabulary = ((DefinedTermBase) termBase).getVocabulary();\r
+               }else if(termBase instanceof TermVocabulary){\r
+                       vocabulary = (TermVocabulary) termBase;\r
+               }\r
+               \r
+               if(vocabulary == null){\r
+                       return true;\r
+               }\r
+               \r
+               for(Marker vocabularyMarker : vocabulary.getMarkers()){\r
+                       if(vocabularyMarker.getMarkerType().equals(MarkerType.MODIFIABLE())){\r
+                               return vocabularyMarker.getValue();                     \r
+                       }\r
+               }\r
+                               \r
+               return true;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermContentProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermContentProvider.java
new file mode 100644 (file)
index 0000000..3b6241a
--- /dev/null
@@ -0,0 +1,127 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.Collection;\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+import java.util.SortedSet;\r
+\r
+import org.eclipse.jface.viewers.ITreeContentProvider;\r
+import org.eclipse.jface.viewers.Viewer;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 8 Dec 2011\r
+ *\r
+ */\r
+public class TermContentProvider implements ITreeContentProvider {\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IContentProvider#dispose()\r
+        */\r
+       @Override\r
+       public void dispose() {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)\r
+        */\r
+       @Override\r
+       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {\r
+               // TODO Auto-generated method stub\r
+\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Object[] getElements(Object inputElement) {\r
+       \r
+               Collection<TermVocabulary> inputElements = (Collection<TermVocabulary>) inputElement;\r
+               return inputElements.toArray();\r
+               //return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Object[] getChildren(Object parentElement) {\r
+               \r
+               if(parentElement instanceof TermVocabulary){\r
+                       return getTopLevelElements((TermVocabulary) parentElement);\r
+               } else if (parentElement instanceof DefinedTermBase) {\r
+                       return ((DefinedTermBase) parentElement).getIncludes().toArray();\r
+               }\r
+               return null;\r
+       }\r
+       \r
+       /**\r
+        *  \r
+        * @param vocabulary\r
+        * @return An array of DefinedTermBase objects that do not have parents\r
+        * \r
+        * TODO: Needs to be implemented in cdmlib\r
+        */\r
+       private Object[] getTopLevelElements(TermVocabulary vocabulary) {\r
+               \r
+               SortedSet<DefinedTermBase> terms = vocabulary.getTermsOrderedByLabels(CdmStore.getDefaultLanguage());\r
+               Set<DefinedTermBase> topLevelTerms = new HashSet<DefinedTermBase>(); \r
+        \r
+               for (DefinedTermBase term : terms){\r
+                        if (term.getPartOf() == null){\r
+                                topLevelTerms.add(term);\r
+                        }\r
+                               \r
+               }\r
+        \r
+               return topLevelTerms.toArray();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)\r
+        */\r
+       @Override\r
+       public Object getParent(Object element) {\r
+               \r
+               if(element instanceof DefinedTermBase){\r
+                       \r
+                       DefinedTermBase definedTerm = (DefinedTermBase)element;\r
+                       if (definedTerm.getPartOf() == null) {\r
+                               return definedTerm.getVocabulary();\r
+                       } else {\r
+                               return definedTerm.getPartOf();\r
+                       }\r
+               }       \r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)\r
+        */\r
+       @Override\r
+       public boolean hasChildren(Object element) {\r
+               \r
+               if (getChildren(element) != null){\r
+                       \r
+                       return getChildren(element).length > 0;\r
+               }\r
+               return false;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermLabelProvider.java
new file mode 100644 (file)
index 0000000..ea647af
--- /dev/null
@@ -0,0 +1,48 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;\r
+import org.eclipse.jface.viewers.LabelProvider;\r
+import org.eclipse.jface.viewers.StyledString;\r
+\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 9 Dec 2011\r
+ *\r
+ */\r
+public class TermLabelProvider extends LabelProvider implements\r
+               IStyledLabelProvider {\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)\r
+        */\r
+       @Override\r
+       public StyledString getStyledText(Object element) {\r
+               \r
+               return  new StyledString(getText(element), StyledString.QUALIFIER_STYLER);\r
+       }\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)\r
+        */\r
+       @Override\r
+       public String getText(Object element) {\r
+               \r
+               if (element instanceof TermBase){\r
+                       return ((TermBase)element).getLabel();\r
+               } \r
+               return super.getText(element);\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermTransfer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/TermTransfer.java
new file mode 100644 (file)
index 0000000..c8623b0
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm;\r
+\r
+import java.util.UUID;\r
+\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.taxeditor.model.CdmObjectTransfer;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 10 Jan 2012\r
+ *\r
+ */\r
+public class TermTransfer extends CdmObjectTransfer<DefinedTermBase> {\r
+       \r
+       private static TermTransfer instance = new TermTransfer();\r
+       private static final String TYPE_NAME = "termElement-transfer-format";\r
+       private static final int TYPEID = registerType(TYPE_NAME);\r
+       \r
+       public static synchronized TermTransfer getInstance(){\r
+               return instance;\r
+       }\r
+       \r
+       private TermTransfer() {}\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.model.CdmObjectTransfer#loadElement(java.util.UUID)\r
+        */\r
+       @Override\r
+       public DefinedTermBase loadElement(UUID uuid) {\r
+               return CdmStore.getService(ITermService.class).load(uuid);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.swt.dnd.Transfer#getTypeIds()\r
+        */\r
+       @Override\r
+       protected int[] getTypeIds() {\r
+               return new int[] { TYPEID };\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.swt.dnd.Transfer#getTypeNames()\r
+        */\r
+       @Override\r
+       protected String[] getTypeNames() {\r
+               return new String[] { TYPE_NAME };\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateDefinedTermHandler.java
new file mode 100644 (file)
index 0000000..24a8462
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$\r
+/**\r
+ * Copyright (C) 2009 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
+ * \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
+package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.IHandler;\r
+import org.eclipse.core.commands.common.NotDefinedException;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateDefinedTermOperation;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 21 Dec 2011\r
+ * \r
+ */\r
+public class CreateDefinedTermHandler extends AbstractHandler implements IHandler {\r
+\r
+       /*\r
+        * (non-Javadoc)\r
+        * \r
+        * @see\r
+        * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.\r
+        * ExecutionEvent)\r
+        */\r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+               IPostOperationEnabled editor = (IPostOperationEnabled) HandlerUtil\r
+                               .getActiveEditor(event);\r
+\r
+               IStructuredSelection selection = (IStructuredSelection) HandlerUtil\r
+                               .getCurrentSelection(event);\r
+\r
+               TermBase selectedElement = (TermBase) selection.getFirstElement();\r
+\r
+               try {\r
+                       AbstractPostOperation operation = new CreateDefinedTermOperation(\r
+                                       event.getCommand().getName(), StoreUtil.getUndoContext(),\r
+                                       selectedElement, editor);\r
+                       StoreUtil.executeOperation(operation);\r
+\r
+               } catch (NotDefinedException e) {\r
+                       StoreUtil.error(getClass(), e);\r
+               }\r
+\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateTermVocabularyHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/CreateTermVocabularyHandler.java
new file mode 100644 (file)
index 0000000..3ad89be
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.IHandler;\r
+import org.eclipse.core.commands.common.NotDefinedException;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateDefinedTermOperation;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.CreateTermVocabularyOperation;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 21 Dec 2011\r
+ *\r
+ */\r
+public class CreateTermVocabularyHandler extends AbstractHandler implements\r
+               IHandler {\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
+        */\r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+               IPostOperationEnabled editor = (IPostOperationEnabled) HandlerUtil\r
+                               .getActiveEditor(event);\r
+\r
+               if (! (editor instanceof DefinedTermEditor)){\r
+                       return null;\r
+               }\r
+               \r
+               try {\r
+                       AbstractPostOperation operation = new CreateTermVocabularyOperation(\r
+                                       event.getCommand().getName(), StoreUtil.getUndoContext(), (DefinedTermEditor) editor);\r
+                       StoreUtil.executeOperation(operation);\r
+\r
+               } catch (NotDefinedException e) {\r
+                       StoreUtil.error(getClass(), e);\r
+               }\r
+\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/DeleteTermBaseHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/DeleteTermBaseHandler.java
new file mode 100644 (file)
index 0000000..ec008ea
--- /dev/null
@@ -0,0 +1,67 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
+\r
+import java.util.Iterator;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.common.NotDefinedException;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.operation.DeleteTermBaseOperation;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 22 Dec 2011\r
+ *\r
+ */\r
+public class DeleteTermBaseHandler extends AbstractHandler {\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
+        */\r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+               DefinedTermEditor editor = (DefinedTermEditor) HandlerUtil\r
+                               .getActiveEditor(event);\r
+\r
+               IStructuredSelection selection = (IStructuredSelection) HandlerUtil\r
+                               .getCurrentSelection(event);\r
+\r
+               Iterator<TermBase> selectionIterator = selection.iterator();\r
+\r
+               while (selectionIterator.hasNext()){\r
+                       \r
+                       TermBase term = selectionIterator.next();\r
+                       \r
+                       try {\r
+                               AbstractPostOperation operation = new DeleteTermBaseOperation(\r
+                                               event.getCommand().getName(), StoreUtil.getUndoContext(),\r
+                                               term, editor);\r
+                               StoreUtil.executeOperation(operation);\r
+       \r
+                       } catch (NotDefinedException e) {\r
+                               StoreUtil.error(getClass(), e);\r
+                       }\r
+               }\r
+\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermEditorHandler.java
new file mode 100644 (file)
index 0000000..393a3e6
--- /dev/null
@@ -0,0 +1,59 @@
+package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.IHandler;\r
+import org.eclipse.core.commands.IParameter;\r
+import org.eclipse.core.commands.common.NotDefinedException;\r
+import org.eclipse.ui.IWorkbenchPage;\r
+import org.eclipse.ui.PartInitException;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
+import org.eclipse.ui.handlers.ShowViewHandler;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.input.DefinedTermEditorInputFactory;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+// $Id$\r
+/**\r
+ * Copyright (C) 2009 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
+ * \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 8 Dec 2011\r
+ *\r
+ */\r
+public class OpenDefinedTermEditorHandler extends AbstractHandler implements\r
+               IHandler {\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)\r
+        */\r
+       @Override\r
+       public Object execute(ExecutionEvent event) throws ExecutionException {\r
+               \r
+               try {\r
+                       String parameter = event.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter");\r
+                       Class<? extends DefinedTermBase> clazz = (Class<? extends DefinedTermBase>) Class.forName(parameter);\r
+               \r
+                       IWorkbenchPage activePage = StoreUtil.getActivePage();\r
+                       try {\r
+                               activePage.openEditor(DefinedTermEditorInputFactory.NewInstance(clazz), DefinedTermEditor.ID);\r
+                       } catch (PartInitException e) {\r
+                               StoreUtil.error(getClass(), e);\r
+                       }\r
+               } catch (ClassNotFoundException e) {\r
+                       StoreUtil.error(getClass(), e);\r
+               }\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermMenu.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/handler/OpenDefinedTermMenu.java
new file mode 100644 (file)
index 0000000..5d6e797
--- /dev/null
@@ -0,0 +1,73 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.handler;\r
+\r
+import java.util.HashMap;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jface.action.IContributionItem;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.ui.PlatformUI;\r
+import org.eclipse.ui.actions.CompoundContributionItem;\r
+import org.eclipse.ui.menus.CommandContributionItem;\r
+import org.eclipse.ui.menus.CommandContributionItemParameter;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 4 Jan 2012\r
+ *\r
+ */\r
+public class OpenDefinedTermMenu extends CompoundContributionItem {\r
+\r
+       /**\r
+        * \r
+        */\r
+       public OpenDefinedTermMenu() {\r
+               // TODO Auto-generated constructor stub\r
+       }\r
+\r
+       /**\r
+        * @param id\r
+        */\r
+       public OpenDefinedTermMenu(String id) {\r
+               super(id);\r
+               // TODO Auto-generated constructor stub\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()\r
+        */\r
+       @Override\r
+       protected IContributionItem[] getContributionItems() {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+       \r
+       /**\r
+        * @param key\r
+        * @param object\r
+        * @return\r
+        */\r
+       private IContributionItem createContributionItem(String label,\r
+                       String inputType) {\r
+               CommandContributionItemParameter parameter = new CommandContributionItemParameter(\r
+                               PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null,\r
+                               "eu.etaxonomy.taxeditor.store.definedterm.menu.open", SWT.NONE);\r
+\r
+               parameter.label = label;\r
+\r
+               Map parameters = new HashMap();\r
+               parameters.put("eu.etaxonomy.taxeditor.store.definedterm.menu.open", inputType);\r
+               parameter.parameters = parameters;\r
+\r
+               return new CommandContributionItem(parameter);\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/AbstractDefinedTermEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/AbstractDefinedTermEditorInput.java
new file mode 100644 (file)
index 0000000..49cc3d4
--- /dev/null
@@ -0,0 +1,71 @@
+// $Id$\r
+/**\r
+ * Copyright (C) 2009 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
+ * \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.List;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.eclipse.ui.IEditorInput;\r
+import org.eclipse.ui.IPersistableElement;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 3 Jan 2012\r
+ *\r
+ */\r
+public abstract class AbstractDefinedTermEditorInput<T extends DefinedTermBase> implements IEditorInput {\r
+\r
+       /**\r
+        * \r
+        */\r
+       public AbstractDefinedTermEditorInput() {\r
+               super();\r
+       }\r
+\r
+       @Override\r
+       public Object getAdapter(Class adapter) {\r
+               return null;\r
+       }\r
+\r
+       @Override\r
+       public boolean exists() {\r
+               return false;\r
+       }\r
+\r
+       @Override\r
+       public ImageDescriptor getImageDescriptor() {\r
+               return null;\r
+       }\r
+\r
+       @Override\r
+       public IPersistableElement getPersistable() {\r
+               return null;\r
+       }\r
+\r
+       @Override\r
+       public String getToolTipText() {\r
+               return getName();\r
+       }\r
+\r
+       /**\r
+        * @return\r
+        */\r
+       public abstract List<String> getTermClasses();\r
+       \r
+       public abstract T createTermInstance();\r
+       \r
+       public Class<? extends DefinedTermBase> getTermClass() {\r
+               \r
+               return createTermInstance().getClass();\r
+       }\r
+\r
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/DefinedTermEditorInputFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/DefinedTermEditorInputFactory.java
new file mode 100644 (file)
index 0000000..efbfa0e
--- /dev/null
@@ -0,0 +1,54 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import org.eclipse.ui.IEditorInput;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.ExtensionType;\r
+import eu.etaxonomy.cdm.model.common.MarkerType;\r
+import eu.etaxonomy.cdm.model.description.Feature;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
+import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 3 Jan 2012\r
+ *\r
+ */\r
+public class DefinedTermEditorInputFactory {\r
+\r
+//     public static final String NamedArea = "eu.etaxonomy.taxeditor.editor.namedArea";\r
+\r
+       /**\r
+        * @param clazz\r
+        * @return\r
+        */\r
+       public static IEditorInput NewInstance(Class<? extends DefinedTermBase> clazz) {\r
+               if(clazz == NamedArea.class){\r
+                       return new NamedAreaEditorInput();\r
+               } \r
+               if (clazz == NamedAreaLevel.class){\r
+                       return new NamedAreaLevelEditorInput();\r
+               }\r
+               if (clazz == ExtensionType.class){\r
+                       return new ExtensionTypeEditorInput();\r
+               }\r
+               if (clazz == MarkerType.class){\r
+                       return new MarkerTypeEditorInput();\r
+               }\r
+               if (clazz == Feature.class){\r
+                       return new FeatureEditorInput();\r
+               }\r
+               \r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/ExtensionTypeEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/ExtensionTypeEditorInput.java
new file mode 100644 (file)
index 0000000..49d597a
--- /dev/null
@@ -0,0 +1,52 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import eu.etaxonomy.cdm.model.common.ExtensionType;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 6 Jan 2012\r
+ *\r
+ */\r
+public class ExtensionTypeEditorInput extends AbstractDefinedTermEditorInput<ExtensionType> {\r
+       \r
+       private List<String> termClasses = Arrays.asList(new String[]{\r
+                       ExtensionType.class.getName()\r
+       });\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IEditorInput#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return "Extension Type";\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#getTermClasses()\r
+        */\r
+       @Override\r
+       public List<String> getTermClasses() {\r
+               return termClasses;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#createTermInstance()\r
+        */\r
+       @Override\r
+       public ExtensionType createTermInstance() {\r
+               return ExtensionType.NewInstance();\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/FeatureEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/FeatureEditorInput.java
new file mode 100644 (file)
index 0000000..da4c4d8
--- /dev/null
@@ -0,0 +1,50 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import eu.etaxonomy.cdm.model.description.Feature;\r
+/**\r
+ * @author l.morris\r
+ * @date 11 Jan 2012\r
+ *\r
+ */\r
+public class FeatureEditorInput extends AbstractDefinedTermEditorInput<Feature> {\r
+\r
+       private List<String> termClasses = Arrays.asList(new String[]{\r
+                       Feature.class.getName()\r
+       });\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IEditorInput#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return "Feature";\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.input.AbstractDefinedTermEditorInput#getTermClasses()\r
+        */\r
+       @Override\r
+       public List<String> getTermClasses() {\r
+               return termClasses;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.input.AbstractDefinedTermEditorInput#createTermInstance()\r
+        */\r
+       @Override\r
+       public Feature createTermInstance() {\r
+               return Feature.NewInstance();\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/MarkerTypeEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/MarkerTypeEditorInput.java
new file mode 100644 (file)
index 0000000..5bc6cb5
--- /dev/null
@@ -0,0 +1,54 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import eu.etaxonomy.cdm.model.common.MarkerType;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 6 Jan 2012\r
+ *\r
+ */\r
+public class MarkerTypeEditorInput extends AbstractDefinedTermEditorInput<MarkerType> {\r
+       \r
+       private List<String> termClasses = Arrays.asList(new String[]{\r
+                       MarkerType.class.getName()\r
+       });\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IEditorInput#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return "Marker Type";\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#getTermClasses()\r
+        */\r
+       @Override\r
+       public List<String> getTermClasses() {\r
+               return termClasses;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#createTermInstance()\r
+        */\r
+       @Override\r
+       public MarkerType createTermInstance() {\r
+               return new MarkerType();\r
+       }\r
+       \r
+       \r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaEditorInput.java
new file mode 100644 (file)
index 0000000..5ce6ae3
--- /dev/null
@@ -0,0 +1,63 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import org.eclipse.ui.IEditorInput;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.location.Continent;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
+import eu.etaxonomy.cdm.model.location.TdwgArea;\r
+import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 8 Dec 2011\r
+ *\r
+ */\r
+public class NamedAreaEditorInput extends AbstractDefinedTermEditorInput<NamedArea> {\r
+\r
+       private List<String> termClasses = Arrays.asList(new String[]{\r
+                       NamedArea.class.getName(), \r
+                       TdwgArea.class.getName(),\r
+                       WaterbodyOrCountry.class.getName(),\r
+                       Continent.class.getName()\r
+       });\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IEditorInput#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return "Named Area";\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#getTermClasses()\r
+        */\r
+       @Override\r
+       public List<String> getTermClasses() {\r
+               return termClasses;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#createTermInstance()\r
+        */\r
+       @Override\r
+       public NamedArea createTermInstance() {\r
+                return NamedArea.NewInstance();\r
+       }\r
+       \r
+               \r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaLevelEditorInput.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/input/NamedAreaLevelEditorInput.java
new file mode 100644 (file)
index 0000000..a379239
--- /dev/null
@@ -0,0 +1,53 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.input;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 4 Jan 2012\r
+ *\r
+ */\r
+public class NamedAreaLevelEditorInput extends AbstractDefinedTermEditorInput<NamedAreaLevel> {\r
+\r
+       \r
+       private List<String> termClasses = Arrays.asList(new String[]{\r
+                       NamedAreaLevel.class.getName()\r
+       });\r
+       \r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.ui.IEditorInput#getName()\r
+        */\r
+       @Override\r
+       public String getName() {\r
+               return "Named Area Level";\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#getTermClasses()\r
+        */\r
+       @Override\r
+       public List<String> getTermClasses() {\r
+               return termClasses;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see eu.etaxonomy.taxeditor.editor.definedterm.AbstractDefinedTermEditorInput#createTermInstance()\r
+        */\r
+       @Override\r
+       public NamedAreaLevel createTermInstance() {\r
+               return NamedAreaLevel.NewInstance();\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateDefinedTermOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateDefinedTermOperation.java
new file mode 100644 (file)
index 0000000..cc2512f
--- /dev/null
@@ -0,0 +1,97 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.operation;\r
+\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.operations.IUndoContext;\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.ui.IEditorInput;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.input.AbstractDefinedTermEditorInput;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.input.NamedAreaEditorInput;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 21 Dec 2011\r
+ *\r
+ */\r
+public class CreateDefinedTermOperation extends AbstractPostOperation {\r
+\r
+       \r
+\r
+       private TermBase parentTermBase;\r
+       private AbstractDefinedTermEditorInput editorInput; \r
+\r
+       /**\r
+        * @param label\r
+        * @param undoContext\r
+        * @param postOperationEnabled\r
+        */\r
+       public CreateDefinedTermOperation(String label,\r
+                       IUndoContext undoContext, TermBase termBase, IPostOperationEnabled postOperationEnabled) {\r
+               super(label, undoContext, postOperationEnabled);\r
+               this.parentTermBase = termBase;\r
+               editorInput = ((DefinedTermEditor)postOperationEnabled).getDefinedTermEditorInput();\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               \r
+               DefinedTermBase newTerm = editorInput.createTermInstance();                             \r
+               \r
+               newTerm.setLabel("Untitled");\r
+               \r
+               if (parentTermBase instanceof TermVocabulary){\r
+                       TermVocabulary vocabulary = (TermVocabulary) parentTermBase;\r
+                       vocabulary.addTerm(newTerm);\r
+               } else if (parentTermBase instanceof DefinedTermBase) {\r
+                       DefinedTermBase parent = (DefinedTermBase) parentTermBase;\r
+                       parent.addIncludes(newTerm);\r
+                       TermVocabulary vocabulary = parent.getVocabulary();\r
+                       vocabulary.addTerm(newTerm);\r
+               }\r
+               \r
+               return postExecute(newTerm);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateTermVocabularyOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/CreateTermVocabularyOperation.java
new file mode 100644 (file)
index 0000000..a8950ee
--- /dev/null
@@ -0,0 +1,79 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.operation;\r
+\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.operations.IUndoContext;\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 21 Dec 2011\r
+ *\r
+ */\r
+public class CreateTermVocabularyOperation extends AbstractPostOperation {\r
+\r
+       private DefinedTermEditor definedTermEditor;\r
+\r
+       /**\r
+        * @param label\r
+        * @param undoContext\r
+        * @param postOperationEnabled\r
+        */\r
+       public CreateTermVocabularyOperation(String label,\r
+                       IUndoContext undoContext, DefinedTermEditor definedTermEditor) {\r
+               super(label, undoContext, definedTermEditor);\r
+               this.definedTermEditor = definedTermEditor;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+\r
+               TermVocabulary termVocabulary = OrderedTermVocabulary.NewInstance(null, "Untitled", null, null);\r
+               CdmStore.getService(IVocabularyService.class).save(termVocabulary);\r
+               definedTermEditor.getInMemoryVocabularies().add(termVocabulary);\r
+               \r
+               return postExecute(termVocabulary);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/DeleteTermBaseOperation.java
new file mode 100644 (file)
index 0000000..11ced84
--- /dev/null
@@ -0,0 +1,120 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.operation;\r
+\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.operations.IUndoContext;\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Status;\r
+\r
+import eu.etaxonomy.cdm.api.service.ITermService;\r
+import eu.etaxonomy.cdm.api.service.IVocabularyService;\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.store.CdmStore;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 22 Dec 2011\r
+ *\r
+ */\r
+public class DeleteTermBaseOperation extends AbstractPostOperation {\r
+\r
+       private TermBase termBase;\r
+       private DefinedTermEditor definedTermEditor;\r
+       /**\r
+        * @param label\r
+        * @param undoContext\r
+        * @param postOperationEnabled\r
+        */\r
+       public DeleteTermBaseOperation(String label, IUndoContext undoContext, TermBase termBase,\r
+                       DefinedTermEditor definedTermEditor) {\r
+               super(label, undoContext, definedTermEditor);\r
+               this.termBase = termBase;\r
+               this.definedTermEditor = definedTermEditor;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               \r
+               \r
+               \r
+               if (termBase instanceof TermVocabulary) {\r
+                       \r
+                       if (!((TermVocabulary)termBase).getTerms().isEmpty()) {\r
+                               IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "Delete all terms from this vocaulary before deleting the vocabulary.");\r
+                               StoreUtil.warningDialog("Vocabulary not empty", termBase, status);\r
+                               return status;\r
+                       }\r
+                       definedTermEditor.getInMemoryVocabularies().remove(termBase);\r
+                       CdmStore.getService(IVocabularyService.class).delete((TermVocabulary)termBase);\r
+                       \r
+               } else if (termBase instanceof DefinedTermBase) {\r
+                       \r
+                       \r
+                       DefinedTermBase definedTermBase = (DefinedTermBase) termBase;\r
+                       if(!definedTermBase.getIncludes().isEmpty()){\r
+                               IStatus status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "This term includes other terms. Please delete the included terms before deleting this term.");                            \r
+                               StoreUtil.warningDialog("Term has included terms", termBase, status);\r
+                               return status;\r
+                       } \r
+                                               \r
+                       DefinedTermBase partOf = definedTermBase.getPartOf();\r
+                       if(partOf != null){\r
+                               partOf.removeIncludes(definedTermBase);\r
+                       }\r
+                       \r
+                       DefinedTermBase kindOf = definedTermBase.getKindOf();\r
+                       if(kindOf != null){\r
+                               definedTermBase.removeGeneralization(kindOf);\r
+                       }\r
+                       \r
+                       TermVocabulary vocabulary = definedTermBase.getVocabulary();\r
+                       if(vocabulary != null){\r
+                               vocabulary.removeTerm(definedTermBase);\r
+                       }\r
+                       CdmStore.getService(ITermService.class).delete((DefinedTermBase)termBase);\r
+                       \r
+               }\r
+               \r
+               return postExecute(termBase);\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+}\r
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/operation/MoveDefinedTermOperation.java
new file mode 100644 (file)
index 0000000..b68a850
--- /dev/null
@@ -0,0 +1,135 @@
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.taxeditor.editor.definedterm.operation;\r
+\r
+import java.util.Collection;\r
+\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.core.commands.operations.IUndoContext;\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Status;\r
+\r
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;\r
+import eu.etaxonomy.cdm.model.common.TermBase;\r
+import eu.etaxonomy.cdm.model.common.TermVocabulary;\r
+import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
+import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;\r
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;\r
+import eu.etaxonomy.taxeditor.store.StoreUtil;\r
+\r
+/**\r
+ * @author l.morris\r
+ * @date 10 Jan 2012\r
+ *\r
+ */\r
+public class MoveDefinedTermOperation extends AbstractPostOperation {\r
+       \r
+       private Collection<DefinedTermBase> sourceTerms;// the actual DefinedTermBase(s) we are moving\r
+       private TermBase targetTermOrVocabulary;// the target VOCABULARY or DefinedTerm we are moving these to\r
+\r
+       /**\r
+        * @param label\r
+        * @param undoContext\r
+        * @param postOperationEnabled\r
+        */\r
+       public MoveDefinedTermOperation(String label, IUndoContext undoContext, TermBase target, Collection<DefinedTermBase> sourceTerms,\r
+                       IPostOperationEnabled postOperationEnabled) {\r
+               super(label, undoContext, postOperationEnabled);\r
+               \r
+               this.targetTermOrVocabulary = target;\r
+               this.sourceTerms = sourceTerms;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               \r
+               // need to make the moved DefinedTerm part of another DefinedTerm or Vocabulary (target)\r
+               // and remove it from old associations\r
+               \r
+               //TODO move to ITermService\r
+               \r
+               for (DefinedTermBase term : sourceTerms){\r
+                       // do nothing when moving it on itself\r
+                       if(targetTermOrVocabulary.equals(term)){\r
+                               Status status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "Term can not be added to itself");\r
+                               StoreUtil.informationDialog("", status);\r
+                               return status;\r
+                       }\r
+                       \r
+                       if (targetTermOrVocabulary instanceof TermVocabulary) {\r
+                               TermVocabulary termVocabulary = (TermVocabulary)targetTermOrVocabulary;\r
+                               \r
+                               // do nothing when term is top level and gets added to the same vocabulary\r
+                               if(term.getPartOf() == null && termVocabulary.equals(term.getVocabulary())){\r
+                                       Status status = new Status(IStatus.CANCEL, StoreUtil.getPluginId(), "Term is already in this vocabulary");\r
+                                       StoreUtil.informationDialog("", status);\r
+                                       return status;\r
+                               }\r
+                               \r
+                               cleanTerm(term);\r
+                               termVocabulary.addTerm(term);\r
+                               \r
+                       } else if (targetTermOrVocabulary instanceof DefinedTermBase) {\r
+                               cleanTerm(term);\r
+                               DefinedTermBase targetDefinedTerm = (DefinedTermBase) targetTermOrVocabulary;\r
+                               targetDefinedTerm.addIncludes(term);\r
+                               targetDefinedTerm.getVocabulary().addTerm(term);                                \r
+                       }\r
+\r
+               }\r
+               //return null;\r
+               return postExecute(targetTermOrVocabulary);                     \r
+       }\r
+       \r
+       private DefinedTermBase cleanTerm(DefinedTermBase term){\r
+\r
+               DefinedTermBase partOf = term.getPartOf();\r
+               if(partOf != null){\r
+                       partOf.removeIncludes(term);\r
+               }\r
+       \r
+               \r
+               TermVocabulary vocabulary = term.getVocabulary();\r
+               if(vocabulary != null){\r
+                       vocabulary.removeTerm(term);\r
+               }\r
+               \r
+               return term;\r
+       }\r
+       \r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+       /* (non-Javadoc)\r
+        * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
+        */\r
+       @Override\r
+       public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
+                       throws ExecutionException {\r
+               // TODO Auto-generated method stub\r
+               return null;\r
+       }\r
+\r
+}\r
index adac91b5195aa0396018173e6c4a776eac2e1b16..bd2a64f69a03cf292df153296008932969b7091c 100644 (file)
@@ -97,7 +97,7 @@ public class AvailableFeaturesWizardPage extends WizardPage {
         */
        private List<Feature> getAvailableFeatures(){
                
-               List<Feature> preferredFeatures = CdmStore.getTermManager().getPreferredFeatures();
+               List<Feature> preferredFeatures = CdmStore.getTermManager().getPreferredTerms(Feature.class);
                
                for(Feature featureAlreadyInTree : featureTree.getDistinctFeatures()){
                        preferredFeatures.remove(featureAlreadyInTree);
index d90f953b34c5ca8d034af13b1cee76769068f935..60e2e4084303a197478f7d10be7d8f95b4760345 100644 (file)
@@ -10,7 +10,6 @@
 
 package eu.etaxonomy.taxeditor.handler;
 
-import org.apache.log4j.Logger;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
index 4bf709a117199affb57cf7925904861132362b28..8ce48d376d7876e5480bf411bf1dc143a3e86997 100644 (file)
@@ -25,7 +25,7 @@ public class DefaultLabelStrategy implements ILabelImageStrategy {
        /** {@inheritDoc} */
        public String getNameRelationTypeLabel(NameRelationshipType type) {
                List<NameRelationshipType> vocab = 
-                       TermStore.getNameRelationshipTypes();
+                       TermStore.getTerms(NameRelationshipType.class);
        
                for (NameRelationshipType type1 : vocab) {
                        if (type1.equals(type)) {
@@ -42,7 +42,7 @@ public class DefaultLabelStrategy implements ILabelImageStrategy {
        public String getNameRelationTypeInverseLabel(NameRelationshipType type) {
                
                List<NameRelationshipType> vocab = 
-                       TermStore.getNameRelationshipTypes();
+                       TermStore.getTerms(NameRelationshipType.class);
 
                for (NameRelationshipType type1 : vocab) {
                        if (type1.equals(type)) {
index 6a18fa134f3c9f0d934a5ad68a6e9c61febf63f0..835ca848861e3ca54cf337cd585e213e8608ccf4 100644 (file)
@@ -49,6 +49,7 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
 import org.eclipse.ui.themes.ITheme;
 import org.eclipse.ui.themes.IThemeManager;
 
+import eu.etaxonomy.cdm.model.common.TermBase;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
@@ -308,6 +309,11 @@ public abstract class AbstractUtility {
                });
        }
 
+       public static void informationDialog(final String title,
+                       final IStatus status) {
+               informationDialog(title, status.getMessage());
+       }
+       
        /**
         * <p>
         * warningDialog
@@ -332,6 +338,16 @@ public abstract class AbstractUtility {
                        }
                });
        }
+       
+       /**
+        * @param title
+        * @param termBase
+        * @param status
+        */
+       public static void warningDialog(String title, Object source,
+                       IStatus status) {
+               warningDialog(title, source, status.getMessage());
+       }
 
        /**
         * <p>
@@ -745,6 +761,11 @@ public abstract class AbstractUtility {
                log(status);
        }
        
+       public static void warn(Class source, IStatus status) {
+               getLog4JLogger(source).warn(status.getMessage(), status.getException());
+               log(status);
+       }
+       
        public static void warn(Class source, Throwable t) {
                IStatus status = new Status(IStatus.WARNING, getPluginId(), t.getMessage(), t);
                getLog4JLogger(source).warn(t);
@@ -827,7 +848,7 @@ public abstract class AbstractUtility {
         * 
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId() {
+       public static String getPluginId() {
                return "eu.taxeditor";
        }
 
index 08dc15b31bfcc51fbee66b146c4898f38b058de2..a194b8fb92047a5ec2b80aac7e0c6a1bb3c40c69 100644 (file)
@@ -22,6 +22,10 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class TaxonRelationshipTypeInverseContainer extends DefinedTermBase<DefinedTermBase> {
        
+       /**
+        * 
+        */
+       private static final long serialVersionUID = 7225140304186547675L;
        private boolean inverse;
        private TaxonRelationshipType type;
        
index 8380858886ed36e586cd4c07fa0cc8ed23cfd6b3..e1a6b959c7b3b4c3ac3071c24029aa81900c0f59 100644 (file)
@@ -81,7 +81,7 @@ public class LanguagePreferencePage extends PreferencePage implements IWorkbench
                
                final Combo combo_globalLanguage = new Combo(composite, SWT.NONE); 
                
-               List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredLanguages();
+               List<Language> preferredLanguages = CdmStore.getTermManager().getPreferredTerms(Language.class);
                
                for(int i = 0; i < preferredLanguages.size(); i++){
                        Language language = preferredLanguages.get(i);
index 4035427827ecf26aa797c1996c42799a29307631..ca321d13724370020c073fcd6f54f377d53efff7 100644 (file)
@@ -483,7 +483,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         */
        public static Map<MarkerType, Boolean> getEditMarkerTypePreferences() {
                List<MarkerType> markerTypes = CdmStore.getTermManager()
-                               .getPreferredMarkerTypes();
+                               .getPreferredTerms(MarkerType.class);
 
                Map<MarkerType, Boolean> result = new HashMap<MarkerType, Boolean>();
 
index 75e164d7352187a75bcbb33c31cdefefba1348fd..f78483bd64ade4007c5559700ee8bb91f2b0d4d3 100644 (file)
@@ -15,13 +15,17 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.preference.PreferencePage;
 import org.eclipse.jface.viewers.CheckStateChangedEvent;
 import org.eclipse.jface.viewers.CheckboxTableViewer;
 import org.eclipse.jface.viewers.ICheckStateListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -33,16 +37,21 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.internal.commands.Parameter;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.wizard.VocabularyTermWizard;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>Abstract AbstractMenuPreferences class.</p>
@@ -87,7 +96,9 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                setDescription(description);
        }
        
-       protected abstract List<T> getTerms();
+       protected List<T> getTerms(){
+               return TermStore.getTerms(getTermClass());
+       }
 
        /**
         * {@inheritDoc}
@@ -178,24 +189,12 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
         * @param buttonContainer a {@link org.eclipse.swt.widgets.Composite} object.
         */
        protected void createEditButtons(Composite buttonContainer) {
-               newButton = new Button(buttonContainer, SWT.PUSH);
-               newButton.setText("New");
-               newButton.setLayoutData(new GridData(SWT.FILL));
 
-               
                editButton = new Button(buttonContainer, SWT.PUSH);
-               editButton.setText("Edit");
+               editButton.setText("Open Term Editor");
                editButton.setLayoutData(new GridData(SWT.FILL));
 
-               
-               removeButton = new Button(buttonContainer, SWT.PUSH);
-               removeButton.setText("Remove");
-               removeButton.setLayoutData(new GridData(SWT.FILL));
-
-               
-               addNewButtonListeners();
                addEditButtonListeners();
-               addDeleteButtonListeners();
        }
 
        /**
@@ -231,59 +230,43 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
                         */
                        @Override
-                       public void widgetSelected(SelectionEvent e) {
-                               T selection = (T) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
+                       public void widgetSelected(SelectionEvent event) {
                                
-                               if(selection == null){
-                                       StoreUtil.informationDialog("Nothing selected", "Please select a term to edit.");
-                                       return;
-                               }
+                               ICommandService commandService = (ICommandService)  StoreUtil.getService(ICommandService.class);
+
+                               Command command = commandService.getCommand(DefinedTermEditor.OPEN_COMMAND_ID);
                                
-                               VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), selection, getConversationHolder()); 
+                               IParameter parameter;
+                               try {
+                                       parameter = command.getParameter("eu.etaxonomy.taxeditor.store.openDefinedTermEditor.parameter");
                                
-                               WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
-                           
-                               if(dialog.open() == IStatus.OK){                            
-                                   tableViewer.setInput(getTerms());
-                                   tableViewer.reveal(selection);
-                           }
-                       }
-               });
-       }
-       
-       /**
-        * Implement this method in MenuPreference Pages where the vocabulary should be editable, editable flag
-        * is set.
-        */
-       protected void addDeleteButtonListeners() {
-               removeButton.addSelectionListener(new SelectionAdapter(){
-                       /* (non-Javadoc)
-                        * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-                        */
-                       @Override
-                       public void widgetSelected(SelectionEvent e) {
-                               boolean confirmation = StoreUtil.confirmDialog("Confirm deletion", "Do you really want to delete the selected terms?");
-                               
-                               if(confirmation){
-                                       IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
+                                       Parameterization[] parameterizations = new Parameterization[]{
+                                                       new Parameterization(parameter, getTermClass().getName())
+                                       };
                                        
-                                       Iterator<T> selectionIterator = selection.iterator();
+                                       ParameterizedCommand pCommand = new ParameterizedCommand(command, parameterizations);
                                        
-                                       while(selectionIterator.hasNext()){
-                                               T term = selectionIterator.next();
-
-                                               tableViewer.remove(term);
-                                               
-                                               if(getConversationHolder().getSessionHolder().getSession().contains(term)){
-                                                       ITermService service = CdmStore.getService(ITermService.class);
-                                                       DefinedTermBase theTerm = service.load(term.getUuid());
-                                                       
-                                                       service.delete(theTerm);
+                                       if (command.isEnabled()) {
+                                               IHandlerService handlerService = (IHandlerService) StoreUtil.getService(IHandlerService.class);
+                                               try {
+                                                       handlerService.executeCommand(pCommand, null);
+                                               } catch (NotDefinedException e) {
+                                                       throw new RuntimeException("Could not find open command: "
+                                                                       + DefinedTermEditor.OPEN_COMMAND_ID);
+                                               } catch (Exception e) {
+                                                       StoreUtil
+                                                                       .error(getClass(),
+                                                                                       "An exception occured while trying to open a selection",
+                                                                                       e);
                                                }
                                        }
-                                       
-//                                     tableViewer.refresh();
+                               } catch (NotDefinedException e) {
+                                       StoreUtil
+                                       .error(getClass(),
+                                                       "An exception occured while trying to open the Term Editor",
+                                                       e);
                                }
+                               
                        }
                });
        }
index 0c00d5540414d25c9c8065dbcac0dd5c14702a8b..3f752f5368609e55d3d7ce0e13f1e283c804fec4 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.common.ExtensionType;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>ExtensionTypeMenuPreferences class.</p>
@@ -30,7 +27,7 @@ public class ExtensionTypeMenuPreferences extends AbstractMenuPreferences<Extens
        public ExtensionTypeMenuPreferences() {
                super("Extension Type Preferences" , 
                                "Choose which extension types to display",
-                               true);
+                               false);
        }
 
        /* (non-Javadoc)
@@ -41,12 +38,4 @@ public class ExtensionTypeMenuPreferences extends AbstractMenuPreferences<Extens
        protected Class<ExtensionType> getTermClass() {
                return ExtensionType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<ExtensionType> getTerms() {
-               return TermStore.getExtensionTypes();
-       }
 }
index 0375bf2a8f692c236cbcbaf1f02b8f9ba774d0d7..a228ef6a698d70d4019644ac8a69eb4904332d3a 100644 (file)
@@ -8,10 +8,7 @@
 */
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>FeatureMenuPreferences class.</p>
@@ -32,7 +29,7 @@ public class FeatureMenuPreferences extends AbstractMenuPreferences<Feature> {
        public FeatureMenuPreferences() {
                super("Feature Preferences", 
                                "Choose which features you would like to use for descriptive elements.", 
-                               true);
+                               false);
        }
 
        /* (non-Javadoc)
@@ -43,12 +40,4 @@ public class FeatureMenuPreferences extends AbstractMenuPreferences<Feature> {
        protected Class<Feature> getTermClass() {
                return Feature.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<Feature> getTerms() {
-               return TermStore.getFeatures();
-       }
 }
index e630441c997dc066a83fa3bf381f043a8887528f..b355fc4fa338148f8fcc73eebbc56b78436427be 100644 (file)
@@ -10,8 +10,6 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.ViewerComparator;
@@ -20,7 +18,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 
 import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>LanguageMenuPreferences class.</p>
@@ -87,12 +84,4 @@ public class LanguageMenuPreferences extends AbstractMenuPreferences<Language> {
        protected Class<Language> getTermClass() {
                return Language.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<Language> getTerms() {
-               return TermStore.getLanguages();
-       }
 }
index 406ae6162621c21459ccfe5df1b5b40a568d89f7..0fc47e1a93f2f29f3bee31e920dff19bed229fa0 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.common.MarkerType;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>MarkerTypeMenuPreferences class.</p>
@@ -41,12 +38,4 @@ public class MarkerTypeMenuPreferences extends AbstractMenuPreferences<MarkerTyp
        protected Class<MarkerType> getTermClass() {
                return MarkerType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<MarkerType> getTerms() {
-               return TermStore.getNonTechnicalMarkerTypes();
-       }
 }
index 545fe62f96a3a78083d786e042499cb25a3b6009..f664e5f5f0c3591e49a942d48002b228f18624dc 100644 (file)
@@ -3,10 +3,7 @@
  */
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.description.MeasurementUnit;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>MeasurementUnitMenuPreferences class.</p>
@@ -34,12 +31,4 @@ public class MeasurementUnitMenuPreferences extends AbstractMenuPreferences<Meas
                return MeasurementUnit.class;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<MeasurementUnit> getTerms() {
-               return TermStore.getMeasurementUnits();
-       }
-
 }
index 5cb22dc4e90e3bb654b6dd72a0b27398b228fad4..0e8184895184c89d942ba288e3828f50c47893b6 100644 (file)
@@ -10,8 +10,6 @@
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -20,7 +18,6 @@ import eu.etaxonomy.cdm.model.name.NameRelationshipType;
 import eu.etaxonomy.taxeditor.labels.ILabelImageStrategy;
 import eu.etaxonomy.taxeditor.labels.LabelImageProvider;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>NameRelationshipTypeMenuPreferences class.</p>
@@ -97,12 +94,4 @@ public class NameRelationshipTypeMenuPreferences extends
        protected Class<NameRelationshipType> getTermClass() {
                return NameRelationshipType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<NameRelationshipType> getTerms() {
-               return TermStore.getNameRelationshipTypes();
-       }
 }
index bfdd50f744dfd2f1d1a960aed24aad83c42841d9..715258774a5dbcf2343d6f45386919e762e4ff8e 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>NameTypeDesignationStatusMenuPreferences class.</p>
@@ -42,12 +39,4 @@ public class NameTypeDesignationStatusMenuPreferences extends
                return NameTypeDesignationStatus.class;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<NameTypeDesignationStatus> getTerms() {
-               return TermStore.getNameTypeDesignationStatus();
-       }
-
 }
index 335e293d7f98cc97f6009800110f3b341a62cf19..b24c6d941931c37e363029efeee6b060e6c39a0f 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.location.NamedAreaType;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>NamedAreaTypeMenuPreferences class.</p>
@@ -30,7 +27,7 @@ public class NamedAreaTypeMenuPreferences extends AbstractMenuPreferences<NamedA
        public NamedAreaTypeMenuPreferences() {
                super("Named Area Types", 
                                "Edit displayed named area types", 
-                               true);
+                               false);
        }
 
        /* (non-Javadoc)
@@ -41,12 +38,4 @@ public class NamedAreaTypeMenuPreferences extends AbstractMenuPreferences<NamedA
        protected Class<NamedAreaType> getTermClass() {
                return NamedAreaType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<NamedAreaType> getTerms() {
-               return TermStore.getNamedAreaTypes();
-       }
 }
index 4ec3a86fc11697249268bf85ecce1f5f344950ad..e947a269c95213b9f85187cc6118fd37efe1b5fe 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>NomenclaturalStatusTypeMenuPreferences class.</p>
@@ -42,13 +39,5 @@ public class NomenclaturalStatusTypeMenuPreferences extends
        protected Class<NomenclaturalStatusType> getTermClass() {
                return NomenclaturalStatusType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<NomenclaturalStatusType> getTerms() {
-               return TermStore.getNomenclaturalStatusTypes();
-       }
        
 }
index 8a5c7b669219f5f5f4e9499a229c8c8ab88180d8..d71ae560b7b652cb2b530914da241c97ce31c930 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>PresenceAbsenceMenuPreferences class.</p>
@@ -44,13 +41,5 @@ public class PresenceAbsenceMenuPreferences extends AbstractMenuPreferences<Pres
        protected Class<PresenceAbsenceTermBase> getTermClass() {
                return PresenceAbsenceTermBase.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<PresenceAbsenceTermBase> getTerms() {
-               return TermStore.getPresenceAbsenceTerms();
-       }
        
 }
index 40486bfe3444b96fc995e1ef1f50bc11c5128e49..9459ed7a60884e0cdb6b8ab32e7dc99506b08b49 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>PreservationMethodMenuPreferences class.</p>
@@ -41,12 +38,4 @@ public class PreservationMethodMenuPreferences extends AbstractMenuPreferences<P
        protected Class<PreservationMethod> getTermClass() {
                return PreservationMethod.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<PreservationMethod> getTerms() {
-               return TermStore.getPreservationMethods();
-       }
 }
index 78a40b855648a5e44b23f21a22aac194e838fe19..9c16f51bc247eae4ffd2951c40f0dccf067db178 100644 (file)
@@ -8,8 +8,6 @@
 */
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -19,7 +17,6 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
 
 import eu.etaxonomy.cdm.model.name.Rank;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * Allows the user to choose which <code>Rank</code>s to display in the
@@ -52,8 +49,6 @@ public class RankMenuPreferences extends AbstractMenuPreferences<Rank> implement
        @Override
        protected void createAdditionalContent(Composite container) {
                
-               // TODO create option to sort ranks either alphabetically or hierarchically (asc- or descending)
-               
                final Button checkbox = new Button(container, SWT.CHECK);
                checkbox.setText("Sort ranks hierarchically (default is alphabetically)");
                
@@ -66,7 +61,7 @@ public class RankMenuPreferences extends AbstractMenuPreferences<Rank> implement
                        @Override
                        public void widgetSelected(SelectionEvent e) {
                                PreferencesUtil.setSortRanksHierarchichally(checkbox.getSelection());
-                               refresh(TermStore.getRanks());
+                               refresh(getTerms());
                        }
                });
                
@@ -81,12 +76,4 @@ public class RankMenuPreferences extends AbstractMenuPreferences<Rank> implement
                return Rank.class;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<Rank> getTerms() {
-               return TermStore.getRanks();
-       }
-
 }
index aa132d05146d9851a91ce9219c8151b0429644f7..5291ae7a3f199a65b943ff8e03d29a5dfedf4445 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>SpecimenTypeDesignationStatusMenuPreferences class.</p>
@@ -42,12 +39,4 @@ public class SpecimenTypeDesignationStatusMenuPreferences extends
                return SpecimenTypeDesignationStatus.class;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<SpecimenTypeDesignationStatus> getTerms() {
-               return TermStore.getSpecimenTypeDesignationStatus();
-       }
-
 }
index 5185f29450c43c8385a49e41b2b4c0ec8e081ee6..82c3707254f082f19411f3fc67eae019241a9261 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.description.Stage;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>StageMenuPreferences class.</p>
@@ -42,11 +39,4 @@ public class StageMenuPreferences extends AbstractMenuPreferences<Stage> {
                return Stage.class;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<Stage> getTerms() {
-               return TermStore.getStages();
-       }
 }
index 243eb00f028ddafd7821a0f9eb34b8e8af37ed66..6bb9724a7421f04f8696e21026014720a5139254 100644 (file)
 
 package eu.etaxonomy.taxeditor.preference.menu;
 
-import java.util.List;
-
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.store.TermStore;
 
 /**
  * <p>TaxonRelationshipTypeMenuPreferences class.</p>
@@ -42,13 +39,5 @@ public class TaxonRelationshipTypeMenuPreferences extends
        protected Class<TaxonRelationshipType> getTermClass() {
                return TaxonRelationshipType.class;
        }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.preference.menu.AbstractMenuPreferences#getTerms()
-        */
-       @Override
-       protected List<TaxonRelationshipType> getTerms() {
-               return TermStore.getTaxonRelationshipTypes();
-       }
        
 }
index 55fdc632fdccb09e4a5d214b4771e7c128186fca..f5c4c7d318672bd210212775e8044d94e23d3522 100644 (file)
@@ -14,10 +14,12 @@ import java.util.UUID;
 
 import org.eclipse.core.commands.operations.IOperationHistory;
 import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
 
+import eu.etaxonomy.cdm.model.common.TermBase;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
@@ -76,7 +78,7 @@ public class StoreUtil extends AbstractUtility {
         *
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       public static String getPluginId(){
                return TaxeditorStorePlugin.PLUGIN_ID;
        }
 
index 87322c4710f20869b228b7e6e1e26f1579e2a4f6..9290201b4d889399ae512e6a9790fcfede76d671 100644 (file)
@@ -11,7 +11,6 @@
 package eu.etaxonomy.taxeditor.store;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -21,32 +20,9 @@ import java.util.UUID;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.ui.IMemento;
 
-import eu.etaxonomy.cdm.model.common.AnnotationType;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.ExtensionType;
-import eu.etaxonomy.cdm.model.common.Language;
-import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.cdm.model.common.TermBase;
-import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.MeasurementUnit;
-import eu.etaxonomy.cdm.model.description.Modifier;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
-import eu.etaxonomy.cdm.model.description.Scope;
-import eu.etaxonomy.cdm.model.description.Stage;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
-import eu.etaxonomy.cdm.model.location.NamedAreaType;
-import eu.etaxonomy.cdm.model.media.RightsTerm;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
-import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
-import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
-import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
-import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier;
-import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
-import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
 
 /**
  * @author n.hoffmann
@@ -68,6 +44,15 @@ public class TermManager extends ContextListenerAdapter{
                CdmStore.getContextManager().addContextListener(this);
        }
        
+       /**
+        * 
+        * @param clazz
+        * @return
+        */
+       public <T extends DefinedTermBase> List<T> getPreferredTerms(Class<T> clazz){
+               return getFilteredTerms(TermStore.getTerms(clazz));
+       }
+       
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.model.ContextListenerAdapter#contextStart(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
         */
@@ -156,191 +141,202 @@ public class TermManager extends ContextListenerAdapter{
                return initialTerms.iterator().next().getClass().getName();
        }
        
-       /**
-        * <p>getPreferredSpecimenTypeDesignationStatus</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<SpecimenTypeDesignationStatus> getPreferredSpecimenTypeDesignationStatus() { return getFilteredTerms(TermStore.getSpecimenTypeDesignationStatus());}
-
-       /**
-        * <p>getPreferredNameTypeDesignationStatus</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<NameTypeDesignationStatus> getPreferredNameTypeDesignationStatus() { return getFilteredTerms(TermStore.getNameTypeDesignationStatus()); }
-       
-       /**
-        * <p>getPreferredTaxonRelationshipTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<TaxonRelationshipType> getPreferredTaxonRelationshipTypes() { return getFilteredTerms(TermStore.getTaxonRelationshipTypes());}
-       
-       private static List<TaxonRelationshipType> excludeTaxonRelationshipTypes = Arrays.asList(new TaxonRelationshipType[]{
-                       TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN(),
-                       TaxonRelationshipType.MISAPPLIED_NAME_FOR(),
-                       TaxonRelationshipType.ALL_RELATIONSHIPS()
-       });
-       
-       /**
-        * Please note that the {@link TaxonRelationshipType}s TAXONOMICALLY_INCLUDED_IN, MISAPPLIED_NAME_FOR and ALL_RELATIONSHIPS
-        * are filtered out as they are most likely not needed. If you do need them please refactor this method to your needs.
-        * 
-        * @return a list of {@link TaxonRelationshipTypeInverseContainer} elements
-        */
-       public List<TaxonRelationshipTypeInverseContainer> getRelationshipTypesWithInverses(){
-               List<TaxonRelationshipTypeInverseContainer> relationshipTypeInverseContainers = new ArrayList<TaxonRelationshipTypeInverseContainer>();
-               
-               List<TaxonRelationshipType> relationshipTypes = getPreferredTaxonRelationshipTypes();
-               
-               relationshipTypes.removeAll(excludeTaxonRelationshipTypes);
-               
-               for (TaxonRelationshipType relationshipType : relationshipTypes){
-                       if(!relationshipType.isSymmetric()){
-                               TaxonRelationshipTypeInverseContainer inverseContainer = new TaxonRelationshipTypeInverseContainer(relationshipType, true);
-                               relationshipTypeInverseContainers.add(inverseContainer);
-                       }                       
-                       TaxonRelationshipTypeInverseContainer container = new TaxonRelationshipTypeInverseContainer(relationshipType, false);
-                       relationshipTypeInverseContainers.add(container);                       
-               }               
-               
-               return relationshipTypeInverseContainers;
-       }
-       
-       /**
-        * <p>getPreferredFeatures</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Feature> getPreferredFeatures() { return getFilteredTerms(TermStore.getFeatures());}
-
-       /**
-        * <p>getPreferredRanks</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Rank> getPreferredRanks() { return getFilteredTerms(TermStore.getRanks());}
-       
-       /**
-        * <p>getPreferredPresenceAbsenceTerms</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<PresenceAbsenceTermBase> getPreferredPresenceAbsenceTerms(){ return getFilteredTerms(TermStore.getPresenceAbsenceTerms());}
-       
-       /**
-        * <p>getPreferredNomenclaturalStatusTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<NomenclaturalStatusType> getPreferredNomenclaturalStatusTypes(){    return getFilteredTerms(TermStore.getNomenclaturalStatusTypes());}
-       
-       /**
-        * <p>getPreferredNameRelationshipTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<NameRelationshipType> getPreferredNameRelationshipTypes(){ return getFilteredTerms(TermStore.getNameRelationshipTypes());}
-       
-       /**
-        * <p>getPreferredLanguages</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Language> getPreferredLanguages() { return getFilteredTerms(TermStore.getLanguages()); }
-       
-       /**
-        * <p>getPreferredMarkerTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<MarkerType> getPreferredMarkerTypes() { return getFilteredTerms(TermStore.getNonTechnicalMarkerTypes()); }
-       
-       /**
-        * <p>getPreferredExtensionTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<ExtensionType> getPreferredExtensionTypes() { return getFilteredTerms(TermStore.getExtensionTypes()); }
-       
-       /**
-        * <p>getPreferredRightsTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<RightsTerm> getPreferredRightsTypes() {     return getFilteredTerms(TermStore.getRightsTypes());}
-       
-       /**
-        * <p>getPreferredNamedAreaTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<NamedAreaType> getPreferredNamedAreaTypes() { return getFilteredTerms(TermStore.getNamedAreaTypes()); } 
+//     /**
+//      * <p>getPreferredSpecimenTypeDesignationStatus</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<SpecimenTypeDesignationStatus> getPreferredSpecimenTypeDesignationStatus() { return getFilteredTerms(TermStore.getSpecimenTypeDesignationStatus());}
+//
+//     /**
+//      * <p>getPreferredNameTypeDesignationStatus</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<NameTypeDesignationStatus> getPreferredNameTypeDesignationStatus() { return getFilteredTerms(TermStore.getNameTypeDesignationStatus()); }
+//     
+//     /**
+//      * <p>getPreferredTaxonRelationshipTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<TaxonRelationshipType> getPreferredTaxonRelationshipTypes() { return getFilteredTerms(TermStore.getTaxonRelationshipTypes());}
+//     
+//     private static List<TaxonRelationshipType> excludeTaxonRelationshipTypes = Arrays.asList(new TaxonRelationshipType[]{
+//                     TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN(),
+//                     TaxonRelationshipType.MISAPPLIED_NAME_FOR(),
+//                     TaxonRelationshipType.ALL_RELATIONSHIPS()
+//     });
+//     
+//     /**
+//      * Please note that the {@link TaxonRelationshipType}s TAXONOMICALLY_INCLUDED_IN, MISAPPLIED_NAME_FOR and ALL_RELATIONSHIPS
+//      * are filtered out as they are most likely not needed. If you do need them please refactor this method to your needs.
+//      * 
+//      * @return a list of {@link TaxonRelationshipTypeInverseContainer} elements
+//      */
+//     public List<TaxonRelationshipTypeInverseContainer> getPreferredRelationshipTypesWithInverses(){
+//             List<TaxonRelationshipTypeInverseContainer> relationshipTypeInverseContainers = new ArrayList<TaxonRelationshipTypeInverseContainer>();
+//             
+//             List<TaxonRelationshipType> relationshipTypes = getPreferredTaxonRelationshipTypes();
+//             
+//             relationshipTypes.removeAll(excludeTaxonRelationshipTypes);
+//             
+//             for (TaxonRelationshipType relationshipType : relationshipTypes){
+//                     if(!relationshipType.isSymmetric()){
+//                             TaxonRelationshipTypeInverseContainer inverseContainer = new TaxonRelationshipTypeInverseContainer(relationshipType, true);
+//                             relationshipTypeInverseContainers.add(inverseContainer);
+//                     }                       
+//                     TaxonRelationshipTypeInverseContainer container = new TaxonRelationshipTypeInverseContainer(relationshipType, false);
+//                     relationshipTypeInverseContainers.add(container);                       
+//             }               
+//             
+//             return relationshipTypeInverseContainers;
+//     }
        
-       /**
-        * <p>getPreferredAnnotationTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<AnnotationType> getPreferredAnnotationTypes() { return getFilteredTerms(TermStore.getAnnotationTypes()); } 
 
-       /**
-        * <p>getPreferredStages</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Stage> getPreferredStages() { return getFilteredTerms(TermStore.getStages()); }
        
-       /**
-        * <p>getPreferredPreservationMethods</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<PreservationMethod> getPreferredPreservationMethods() { return getFilteredTerms(TermStore.getPreservationMethods()); }
-       
-       /**
-        * <p>getPreferredMeasurementUnits</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<MeasurementUnit> getPreferredMeasurementUnits() { return getFilteredTerms(TermStore.getMeasurementUnits()); }
-       
-       /**
-        * <p>getPreferredStates</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<State> getPreferredStates() { return getFilteredTerms(TermStore.getStates()); }
-       
-       /**
-        * <p>getPreferredModifiers</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Modifier> getPreferredModifiers() { return getFilteredTerms(TermStore.getModifiers()); }
-       
-       /**
-        * <p>getPreferredStatisticalMeasures</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<StatisticalMeasure> getPreferredStatisticalMeasures() { return getFilteredTerms(TermStore.getStatisticalMeasures()); }
-       
-       /**
-        * <p>getPreferredScopes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<Scope> getPreferredScopes() { return getFilteredTerms(TermStore.getScopes()); }
-       
-       /**
-        * <p>getPreferredDeterminationModifiers</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public List<DeterminationModifier> getPreferredDeterminationModifiers() { return getFilteredTerms(TermStore.getDeterminationModifiers()); }
        
+//     
+//     /**
+//      * <p>getPreferredFeatures</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Feature> getPreferredFeatures() { return getFilteredTerms(TermStore.getFeatures());}
+//
+//     /**
+//      * <p>getPreferredRanks</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Rank> getPreferredRanks() { return getFilteredTerms(TermStore.getRanks());}
+//     
+//     /**
+//      * <p>getPreferredPresenceAbsenceTerms</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<PresenceAbsenceTermBase> getPreferredPresenceAbsenceTerms(){ return getFilteredTerms(TermStore.getPresenceAbsenceTerms());}
+//     
+//     /**
+//      * <p>getPreferredNomenclaturalStatusTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<NomenclaturalStatusType> getPreferredNomenclaturalStatusTypes(){    return getFilteredTerms(TermStore.getNomenclaturalStatusTypes());}
+//     
+//     /**
+//      * <p>getPreferredNameRelationshipTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<NameRelationshipType> getPreferredNameRelationshipTypes(){ return getFilteredTerms(TermStore.getNameRelationshipTypes());}
+//     
+//     /**
+//      * <p>getPreferredLanguages</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Language> getPreferredLanguages() { return getFilteredTerms(TermStore.getLanguages()); }
+//     
+//     /**
+//      * <p>getPreferredMarkerTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<MarkerType> getPreferredMarkerTypes() { return getFilteredTerms(TermStore.getNonTechnicalMarkerTypes()); }
+//     
+//     /**
+//      * <p>getPreferredExtensionTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<ExtensionType> getPreferredExtensionTypes() { return getFilteredTerms(TermStore.getExtensionTypes()); }
+//     
+//     /**
+//      * <p>getPreferredRightsTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<RightsTerm> getPreferredRightsTypes() {     return getFilteredTerms(TermStore.getRightsTypes());}
+//     
+//     /**
+//      * <p>getPreferredNamedAreaTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<NamedAreaType> getPreferredNamedAreaTypes() { return getFilteredTerms(TermStore.getNamedAreaTypes()); } 
+//     
+//     /**
+//      * <p>getPreferredNamedAreaTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<NamedAreaLevel> getPreferredNamedAreaLevels() { return getFilteredTerms(TermStore.getNamedAreaLevels()); } 
+//     
+//     /**
+//      * <p>getPreferredAnnotationTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<AnnotationType> getPreferredAnnotationTypes() { return getFilteredTerms(TermStore.getAnnotationTypes()); } 
+//
+//     /**
+//      * <p>getPreferredStages</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Stage> getPreferredStages() { return getFilteredTerms(TermStore.getStages()); }
+//     
+//     /**
+//      * <p>getPreferredPreservationMethods</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<PreservationMethod> getPreferredPreservationMethods() { return getFilteredTerms(TermStore.getPreservationMethods()); }
+//     
+//     /**
+//      * <p>getPreferredMeasurementUnits</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<MeasurementUnit> getPreferredMeasurementUnits() { return getFilteredTerms(TermStore.getMeasurementUnits()); }
+//     
+//     /**
+//      * <p>getPreferredStates</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<State> getPreferredStates() { return getFilteredTerms(TermStore.getStates()); }
+//     
+//     /**
+//      * <p>getPreferredModifiers</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Modifier> getPreferredModifiers() { return getFilteredTerms(TermStore.getModifiers()); }
+//     
+//     /**
+//      * <p>getPreferredStatisticalMeasures</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<StatisticalMeasure> getPreferredStatisticalMeasures() { return getFilteredTerms(TermStore.getStatisticalMeasures()); }
+//     
+//     /**
+//      * <p>getPreferredScopes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<Scope> getPreferredScopes() { return getFilteredTerms(TermStore.getScopes()); }
+//     
+//     /**
+//      * <p>getPreferredDeterminationModifiers</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public List<DeterminationModifier> getPreferredDeterminationModifiers() { return getFilteredTerms(TermStore.getDeterminationModifiers()); }
+//     
        /**
         * Generic method to set term preferences
         *
@@ -361,19 +357,4 @@ public class TermManager extends ContextListenerAdapter{
                
                hiddenTermsMap.put(typeName, undesiredTermUuids);
        }
-       
-       /**
-        * <p>addTermToPreferredTerms</p>
-        *
-        * @param term a T object.
-        * @param <T> a T object.
-        */
-       public <T extends TermBase> void addTermToPreferredTerms(T term){
-
-//             VocabularyEnum vocabulary = VocabularyEnum.getVocabularyEnum(term.getClass());
-//             
-//             getPreferenceStore().setValue(getPreferenceKey(term), VocabularyStore.getTermVocabulary(vocabulary).getTerms().contains(term));
-//             
-//             firePreferencesChanged(term.getClass());
-       }
 }
index d462cc8ca5a464566e01b5adcb7179efd271d53d..120a1b07d9c70ad193dab662bac2c3fbc73f2cbb 100644 (file)
 package eu.etaxonomy.taxeditor.store;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.api.service.IVocabularyService;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.AnnotationType;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
-import eu.etaxonomy.cdm.model.common.ExtensionType;
-import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.common.MarkerType;
-import eu.etaxonomy.cdm.model.common.OrderedTermBase;
-import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
-import eu.etaxonomy.cdm.model.common.TermVocabulary;
-import eu.etaxonomy.cdm.model.common.VocabularyEnum;
 import eu.etaxonomy.cdm.model.description.AbsenceTerm;
 import eu.etaxonomy.cdm.model.description.Feature;
-import eu.etaxonomy.cdm.model.description.MeasurementUnit;
-import eu.etaxonomy.cdm.model.description.Modifier;
 import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
 import eu.etaxonomy.cdm.model.description.PresenceTerm;
-import eu.etaxonomy.cdm.model.description.Scope;
-import eu.etaxonomy.cdm.model.description.Stage;
-import eu.etaxonomy.cdm.model.description.State;
-import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
-import eu.etaxonomy.cdm.model.location.NamedAreaType;
-import eu.etaxonomy.cdm.model.location.ReferenceSystem;
-import eu.etaxonomy.cdm.model.media.RightsTerm;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
-import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
-import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
 import eu.etaxonomy.cdm.model.name.Rank;
-import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
-import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier;
-import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
@@ -60,257 +40,123 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
  * @version 1.0
  */
 public class TermStore {
-       
-       /**
-        * <p>getSpecimenTypeDesignationStatus</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<SpecimenTypeDesignationStatus> getSpecimenTypeDesignationStatus() {
-               return getTerms(SpecimenTypeDesignationStatus.class);
-       }
-       
 
-       /**
-        * <p>getNameTypeDesignationStatus</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<NameTypeDesignationStatus> getNameTypeDesignationStatus() {
-               return getTerms(NameTypeDesignationStatus.class);
-       }
-       
-       /**
-        * <p>getNamedAreaTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<NamedAreaType> getNamedAreaTypes(){
-               return getTerms(NamedAreaType.class);
-       }
        
-       /**
-        * <p>getAnnotationTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<AnnotationType> getAnnotationTypes(){
-               return getTerms(AnnotationType.class);
-       }
        
-       /**
-        * <p>getTaxonRelationshipTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<TaxonRelationshipType> getTaxonRelationshipTypes(){
-               return getTerms(TaxonRelationshipType.class);
+       public static <TERM extends DefinedTermBase> List<TERM> getTerms(Class<TERM> clazz){
+               return getTerms(clazz, null, true);
        }
        
-       
        /**
-        * <p>getLanguages</p>
-        *
-        * @return a {@link java.util.List} object.
+        * Returns a list of terms of the given type currently available in the system. 
+        * If <code>filtered</code> is set to <code>true</code>, all terms for certain types will be
+        * gathered from edge cases.
+        * 
+        * @param clazz
+        * @param comparator
+        * @param filtered Will filter out some results
+        * @return
         */
-       public static List<Language> getLanguages(){
-               return getTerms(Language.class);
-       }
-       
-       /**
-        * <p>getFeatures</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<Feature> getFeatures() {
-               List<Feature> features = getTerms(Feature.class);
-               features.remove(Feature.IMAGE());
-               return features;
-
-       }
-       
-       /**
-        * <p>getNameRelationshipTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<NameRelationshipType> getNameRelationshipTypes() {
-               return getTerms(NameRelationshipType.class);
-       }
-       
-       /**
-        * <p>getNomenclaturalStatusTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<NomenclaturalStatusType> getNomenclaturalStatusTypes(){
-               return getTerms(NomenclaturalStatusType.class);
-       }
-       
+       public static <TERM extends DefinedTermBase> List<TERM> getTerms(Class<TERM> clazz, Comparator<TERM> comparator, boolean filtered){
+               List<TERM> terms = new ArrayList<TERM>();
 
-       /**
-        * <p>getNonTechnicalMarkerTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<MarkerType> getNonTechnicalMarkerTypes() {
-               List<MarkerType> nonTechnicalMarkerTypes = new ArrayList<MarkerType>();
-               List<MarkerType> markerTypes = getTerms(MarkerType.class);
-               
-               for (Object type : markerTypes) {
-                       if (((MarkerType) type).isTechnical() == false) {
-                               nonTechnicalMarkerTypes.add((MarkerType) type);
-                       }
+               ITermStoreEdgeCase<TERM> edgeCase = getEdgeCase(clazz);
+               if(filtered && edgeCase != null){
+                       terms = edgeCase.getTerms();
+               }else{
+                       terms = getTermsFromService(clazz, comparator);
                }
                
-               return nonTechnicalMarkerTypes;
-       }
-       
-
-       /**
-        * <p>getExtensionTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<ExtensionType> getExtensionTypes() {
-               return getTerms(ExtensionType.class);
-       }
-       
-       /**
-        * <p>getRightsTypes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<RightsTerm> getRightsTypes() {
-               return getTerms(RightsTerm.class);
+               return terms;
+               
        }
        
-       
-       /**
-        * Retrieve all ranks from data store.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<Rank> getRanks(){
-               if(PreferencesUtil.getSortRanksHierarchichally()){
-                       return getTerms(Rank.class, new Comparator<Rank>(){
-       
+       private static <T extends DefinedTermBase> List<T> getTermsFromService(Class<T> termClass, Comparator<T> comparator){
+               if (comparator == null){
+                       comparator = new Comparator<T>() {
                                @Override
-                               public int compare(Rank o1, Rank o2) {
-                                       return o1.compareTo(o2);
+                               public int compare(T o1, T o2) {
+                                       String label1 = o1.getLabel(CdmStore.getDefaultLanguage()) != null ? o1.getLabel(CdmStore.getDefaultLanguage()) : o1.getTitleCache();
+                                       String label2 = o2.getLabel(CdmStore.getDefaultLanguage()) != null ? o2.getLabel(CdmStore.getDefaultLanguage()) : o2.getTitleCache();
+                                       return label1.compareTo(label2);
                                }
-                               
-                       });
-               }else{
-                       return getTerms(Rank.class);
+                       };
                }
+               
+               List<T> terms = CdmStore.getService(ITermService.class).listByTermClass(termClass, null, null, null, null);
+               Collections.sort(terms, comparator);
+               return terms;
        }
        
+//     /**
+//      * <p>getFeatures</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public static List<Feature> getFeatures() {
+//             List<Feature> features = getTerms(Feature.class);
+//             features.remove(Feature.IMAGE());
+//             return features;
+//
+//     }
+//
+//
+//     /**
+//      * <p>getNonTechnicalMarkerTypes</p>
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public static List<MarkerType> getNonTechnicalMarkerTypes() {
+//             List<MarkerType> nonTechnicalMarkerTypes = new ArrayList<MarkerType>();
+//             List<MarkerType> markerTypes = getTerms(MarkerType.class);
+//             
+//             for (Object type : markerTypes) {
+//                     if (((MarkerType) type).isTechnical() == false) {
+//                             nonTechnicalMarkerTypes.add((MarkerType) type);
+//                     }
+//             }
+//             
+//             return nonTechnicalMarkerTypes;
+//     }
+//
+//     /**
+//      * Retrieve all ranks from data store.
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public static List<Rank> getRanks(){
+//             if(PreferencesUtil.getSortRanksHierarchichally()){
+//                     return getTerms(Rank.class, new Comparator<Rank>(){
+//     
+//                             @Override
+//                             public int compare(Rank o1, Rank o2) {
+//                                     return o1.compareTo(o2);
+//                             }
+//                             
+//                     });
+//             }else{
+//                     return getTerms(Rank.class);
+//             }
+//     }
+//     
+//     
+//     /**
+//      * Retrieve all presence and absence terms from data store.
+//      *
+//      * @return a {@link java.util.List} object.
+//      */
+//     public static List<PresenceAbsenceTermBase> getPresenceAbsenceTerms() {
+//             List presenceAbsenceTerms = getTerms(PresenceTerm.class);
+//             presenceAbsenceTerms.addAll(getTerms(AbsenceTerm.class));
+//
+//             return presenceAbsenceTerms;
+//     }
        
        /**
-        * Retrieve all presence and absence terms from data store.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<PresenceAbsenceTermBase> getPresenceAbsenceTerms() {
-               List presenceAbsenceTerms = getTerms(PresenceTerm.class);
-               presenceAbsenceTerms.addAll(getTerms(AbsenceTerm.class));
-
-               return presenceAbsenceTerms;
-       }
-
-       /**
-        * Retrieve all stages from data store.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<Stage> getStages(){
-               return getTerms(Stage.class);
-       }
-       
-       /**
-        * Retrieve all states from data store.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<State> getStates() {
-               return getTerms(State.class);
-       }
-       
-       /**
-        * Retrieve all preservation methods from data store.
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<PreservationMethod> getPreservationMethods(){
-               return getTerms(PreservationMethod.class);
-       }
-       
-       
-
-       /**
-        * <p>getMeasurementUnits</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<MeasurementUnit> getMeasurementUnits() {
-               return getTerms(MeasurementUnit.class);
-       }
-       
-
-       /**
-        * <p>getModifiers</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<Modifier> getModifiers() {
-               return getTerms(Modifier.class);
-       }
-
-
-       /**
-        * <p>getStatisticalMeasures</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<StatisticalMeasure> getStatisticalMeasures() {
-               return getTerms(StatisticalMeasure.class);
-       }
-       
-       /**
-        * <p>getScopes</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<Scope> getScopes() {
-               return getTerms(Scope.class);
-       }
-       
-       /**
-        * <p>getDeterminationModifiers</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<DeterminationModifier> getDeterminationModifiers() {
-               return getTerms(DeterminationModifier.class);
-       }
-       
-       /**
-        * <p>getReferenceSystems</p>
-        *
-        * @return a {@link java.util.List} object.
-        */
-       public static List<ReferenceSystem> getReferenceSystems() {
-               return getTerms(ReferenceSystem.class);
-       }
-       
-       /**
-        ************* save methods *****************************
-        *
         * @param term a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
         */
        public static void saveTerm(DefinedTermBase term){
-               getTermService().saveOrUpdate(term);
+               CdmStore.getService(ITermService.class).saveOrUpdate(term);
        }
        
        /**
@@ -319,7 +165,7 @@ public class TermStore {
         * @param selected a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
         */
        public static void delete(DefinedTermBase selected) {
-               getTermService().delete(selected);
+               CdmStore.getService(ITermService.class).delete(selected);
        }
        
        /**
@@ -328,62 +174,139 @@ public class TermStore {
         * @param term a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object.
         */
        public static void updateVocabulary(DefinedTermBase term) {
-               getTermService().saveOrUpdate(term);
+               CdmStore.getService(ITermService.class).saveOrUpdate(term);
        }
        
+       private static Set<ITermStoreEdgeCase<? extends DefinedTermBase>> termStoreEdgeCases = new HashSet<ITermStoreEdgeCase<? extends DefinedTermBase>>();
        
-       
-       /*************** internal methods **************************/
-       
-       private static Language getDefaultLanguage(){
-               return CdmStore.getDefaultLanguage();
-       }
-       
-       private static OrderedTermVocabulary<? extends OrderedTermBase> getOrderedTermVocabulary(VocabularyEnum vocabularyType){
-               TermVocabulary<DefinedTermBase> vocabulary = getTermVocabulary(vocabularyType);         
-               return HibernateProxyHelper.deproxy(vocabulary, OrderedTermVocabulary.class);
+       static {
+               termStoreEdgeCases.add(new ITermStoreEdgeCase<Feature>() {
+
+                       @Override
+                       public Class<Feature> getTermClass() {
+                               return Feature.class;
+                       }
+
+                       @Override
+                       public List<Feature> getTerms() {
+                               List<Feature> features = TermStore.getTermsFromService(Feature.class, null);
+                               features.remove(Feature.IMAGE());
+                               return features;
+                       }
+               });
+               termStoreEdgeCases.add(new ITermStoreEdgeCase<MarkerType>(){
+
+                       @Override
+                       public Class<MarkerType> getTermClass() {
+                               return MarkerType.class;
+                       }
+
+                       @Override
+                       public List<MarkerType> getTerms() {
+                               // filter out non technical markers
+                               List<MarkerType> nonTechnicalMarkerTypes = new ArrayList<MarkerType>();
+                               List<MarkerType> markerTypes = TermStore.getTermsFromService(MarkerType.class, null);
+                               
+                               for (Object type : markerTypes) {
+                                       if (((MarkerType) type).isTechnical() == false) {
+                                               nonTechnicalMarkerTypes.add((MarkerType) type);
+                                       }
+                               }
+                               
+                               return nonTechnicalMarkerTypes;
+                       }
+                       
+               });
+               termStoreEdgeCases.add(new ITermStoreEdgeCase<Rank>() {
+
+                       @Override
+                       public Class<Rank> getTermClass() {
+                               return Rank.class;
+                       }
+
+                       @Override
+                       public List<Rank> getTerms() {
+                               if(PreferencesUtil.getSortRanksHierarchichally()){
+                                       return TermStore.getTermsFromService(Rank.class, new Comparator<Rank>(){
+                       
+                                               @Override
+                                               public int compare(Rank o1, Rank o2) {
+                                                       return o1.compareTo(o2);
+                                               }
+                                               
+                                       });
+                               }else{
+                                       return TermStore.getTermsFromService(Rank.class, null);
+                               }
+                       }
+                       
+               });
+               termStoreEdgeCases.add(new ITermStoreEdgeCase<PresenceAbsenceTermBase>() {
+
+                       @Override
+                       public Class<PresenceAbsenceTermBase> getTermClass() {
+                               return PresenceAbsenceTermBase.class;
+                       }
+
+                       @Override
+                       public List<PresenceAbsenceTermBase> getTerms() {
+                               List presenceAbsenceTerms = TermStore.getTermsFromService(PresenceTerm.class, null);
+                               presenceAbsenceTerms.addAll(TermStore.getTermsFromService(AbsenceTerm.class, null));
+
+                               return presenceAbsenceTerms;
+                       }
+               });
+               termStoreEdgeCases.add(new ITermStoreEdgeCase<TaxonRelationshipTypeInverseContainer>() {
+
+                       @Override
+                       public Class<TaxonRelationshipTypeInverseContainer> getTermClass() {
+                               return TaxonRelationshipTypeInverseContainer.class;
+                       }
+
+                       @Override
+                       public List<TaxonRelationshipTypeInverseContainer> getTerms() {
+                               List<TaxonRelationshipType> excludeTaxonRelationshipTypes = Arrays.asList(new TaxonRelationshipType[]{
+                                       TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN(),
+                                       TaxonRelationshipType.MISAPPLIED_NAME_FOR(),
+                                       TaxonRelationshipType.ALL_RELATIONSHIPS()       
+                               });
+                               
+                               List<TaxonRelationshipTypeInverseContainer> relationshipTypeInverseContainers = new ArrayList<TaxonRelationshipTypeInverseContainer>();
+                               
+                               List<TaxonRelationshipType> relationshipTypes = TermStore.getTerms(TaxonRelationshipType.class);
+                               
+                               relationshipTypes.removeAll(excludeTaxonRelationshipTypes);
+                               
+                               for (TaxonRelationshipType relationshipType : relationshipTypes){
+                                       if(!relationshipType.isSymmetric()){
+                                               TaxonRelationshipTypeInverseContainer inverseContainer = new TaxonRelationshipTypeInverseContainer(relationshipType, true);
+                                               relationshipTypeInverseContainers.add(inverseContainer);
+                                       }                       
+                                       TaxonRelationshipTypeInverseContainer container = new TaxonRelationshipTypeInverseContainer(relationshipType, false);
+                                       relationshipTypeInverseContainers.add(container);                       
+                               }               
+                               
+                               return relationshipTypeInverseContainers;
+                       }
+               });
        }
        
-       /**
-        * <p>getTermVocabulary</p>
-        *
-        * @param vocabularyType a {@link eu.etaxonomy.cdm.model.common.VocabularyEnum} object.
-        * @return a {@link eu.etaxonomy.cdm.model.common.TermVocabulary} object.
-        */
-       public static TermVocabulary<DefinedTermBase> getTermVocabulary(VocabularyEnum vocabularyType){
+       private static <T extends DefinedTermBase> ITermStoreEdgeCase<T> getEdgeCase(Class<T> termClass) {
                
-               return CdmStore.getService(IVocabularyService.class).getVocabulary(vocabularyType);
-       }
-       
-       private static <TERM extends DefinedTermBase> List<TERM> getTerms(Class<TERM> clazz){
-               Comparator<TERM> comparator = new Comparator<TERM>() {
-                       @Override
-                       public int compare(TERM o1, TERM o2) {
-                               String label1 = o1.getLabel(getDefaultLanguage()) != null ? o1.getLabel(getDefaultLanguage()) : o1.getTitleCache();
-                               String label2 = o2.getLabel(getDefaultLanguage()) != null ? o2.getLabel(getDefaultLanguage()) : o2.getTitleCache();
-                               return label1.compareTo(label2);
+               for (ITermStoreEdgeCase termStoreEdgeCase : termStoreEdgeCases){
+                       if (termStoreEdgeCase.getTermClass().equals(termClass)){
+                               return termStoreEdgeCase;
                        }
-               };
+               }
                
-               return getTerms(clazz, comparator);
+               return null;
        }
        
-       
-       private static <TERM extends DefinedTermBase> List<TERM> getTerms(Class<TERM> clazz, Comparator<TERM> comparator){
+       private interface ITermStoreEdgeCase<TERM> {
 
+               public abstract Class<TERM> getTermClass();
                
-               List<TERM> terms = new ArrayList<TERM>();
-               if(getTermService() != null){
-                       terms = getTermService().listByTermClass(clazz, null, null, null, null);
+               public abstract List<TERM> getTerms();
                
-                       Collections.sort(terms, comparator); 
-               }
-               
-               return terms;
-               
-       }
-       
-       private static ITermService getTermService(){
-               return CdmStore.getService(ITermService.class);
        }
 }
similarity index 86%
rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/EmptyComboElement.java
rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EmptyComboElement.java
index 83647e794e9b04e2771ef19febb5f802ab4d801f..b74bbf333fc4102b894b61de773c01c9b69e568d 100644 (file)
@@ -8,7 +8,7 @@
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
 
-package eu.etaxonomy.taxeditor.ui.term;
+package eu.etaxonomy.taxeditor.ui.combo;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -27,10 +27,8 @@ import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
  * @created Sep 29, 2010
  * @version 1.0
  */
-public class EmptyComboElement<T extends DefinedTermBase> extends AbstractTermComboElement<T> {
+public class EmptyComboElement<T extends DefinedTermBase> extends TermComboElement<T> {
 
-       private static final int VISIBLE_ITEMS = 20;
-       
        private List<T> genericTerms = new ArrayList<T>();
        
        /**
@@ -43,9 +41,9 @@ public class EmptyComboElement<T extends DefinedTermBase> extends AbstractTermCo
         * @param <T> a T object.
         */
        public EmptyComboElement(CdmFormFactory formFactory,
-                       ICdmFormElement parentElement, String labelString,
+                       ICdmFormElement parentElement, Class<T> termClass, String labelString,
                        int style) {
-               super(formFactory, parentElement, labelString, null, VISIBLE_ITEMS, style);
+               super(formFactory, parentElement, termClass, labelString, null, style);
        }
 
 
@@ -54,7 +52,7 @@ public class EmptyComboElement<T extends DefinedTermBase> extends AbstractTermCo
         */
        /** {@inheritDoc} */
        @Override
-       protected List<T> preferredTerms() {
+       protected List<T> getPreferredTerms() {
                return genericTerms != null ? genericTerms : new ArrayList<T>();
        }
 
similarity index 62%
rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractEnumComboElement.java
rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java
index 1452ce07c9e91ceaf4c95f2b219eab54e2998513..0b3770bccf572382e68dee1eec9ce35e014f2851 100644 (file)
@@ -8,9 +8,11 @@
  * See LICENSE.TXT at the top of this package for the full license terms.
  */
 
-package eu.etaxonomy.taxeditor.ui.term;
+package eu.etaxonomy.taxeditor.ui.combo;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
@@ -20,6 +22,9 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Label;
 
+import eu.etaxonomy.cdm.model.common.IDefinedTerm;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.cdm.model.reference.ReferenceType;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.forms.AbstractCdmFormElement;
@@ -38,11 +43,50 @@ import eu.etaxonomy.taxeditor.ui.forms.ISelectable;
  * @created Mar 16, 2010
  * @version 1.0
  */
-public abstract class AbstractEnumComboElement<T extends Enum> extends
+public class EnumComboElement<T extends IDefinedTerm> extends
                AbstractCdmFormElement implements SelectionListener,
                IEnableableFormElement, ISelectable {
 
-       private static final int VISIBLE_ITEMS = 10;
+       private static CdmEnumDataHolder[] cdmEnumDataHolders = {
+               new CdmEnumDataHolder<NomenclaturalCode>(){
+                       
+                       @Override
+                       public String getName() {
+                               return "Nomenclatural Code";
+                       }
+
+                       @Override
+                       public Collection<NomenclaturalCode> getElements() {
+                               return  Arrays.asList(NomenclaturalCode.values());
+                       }
+
+                       @Override
+                       public Class<NomenclaturalCode> getClazz() {
+                               return NomenclaturalCode.class;
+                       }
+                       
+               },
+               new CdmEnumDataHolder<ReferenceType>(){
+
+                       @Override
+                       public String getName() {
+                               return "Reference Type";
+                       }
+
+                       @Override
+                       public Collection<ReferenceType> getElements() {
+                               return Arrays.asList(ReferenceType.values());
+                       }
+
+                       @Override
+                       public Class<ReferenceType> getClazz() {
+                               return ReferenceType.class;
+                       }
+                       
+               }
+       };
+       
+       private static final int DEFAULT_VISIBLE_ITEMS = 10;
 
        protected T selection;
 
@@ -51,6 +95,8 @@ public abstract class AbstractEnumComboElement<T extends Enum> extends
        private Label label;
        protected Combo combo;
 
+       private Class<T> enumType;
+
        /**
         * <p>
         * Constructor for AbstractEnumComboElement.
@@ -67,29 +113,44 @@ public abstract class AbstractEnumComboElement<T extends Enum> extends
         * @param <T>
         *            a T object.
         */
-       public AbstractEnumComboElement(CdmFormFactory formFactory,
-                       ICdmFormElement parentElement, String labelString) {
+       public EnumComboElement(CdmFormFactory formFactory,
+                       ICdmFormElement parentElement, Class<T> enumType, int style) {
                super(formFactory, parentElement);
-               label = formFactory.createLabel(getLayoutComposite(), labelString);
+               this.enumType = enumType;
+               label = formFactory.createLabel(getLayoutComposite(), getDefaultLabelString());
                addControl(label);
 
                // create combo
                combo = new Combo(getLayoutComposite(), SWT.BORDER | SWT.READ_ONLY);
                addControl(combo);
                combo.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY());
-               combo.setVisibleItemCount(VISIBLE_ITEMS);
+               setVisibleItemCount(DEFAULT_VISIBLE_ITEMS);
 
                populateTypes();
 
                combo.addSelectionListener(this);
        }
 
+       private String getDefaultLabelString() {
+               if(enumType.equals(ReferenceType.class)){
+                       return "Reference Type";
+               }else if (enumType.equals(NomenclaturalCode.class)){
+                       return "Nomenclatural Code";
+               }
+               return "No Label";
+       }
+
        /**
         * <p>
         * populateTypes
         * </p>
         */
-       protected abstract void populateTypes();
+       private void populateTypes(){
+               for(T enumElement : getElementsForClass(enumType)){
+                       elementTypeList.add(enumElement);
+                       combo.add(((Enum) enumElement).name());
+               }
+       }
 
        /**
         * <p>
@@ -180,4 +241,31 @@ public abstract class AbstractEnumComboElement<T extends Enum> extends
        /** {@inheritDoc} */
        public void widgetDefaultSelected(SelectionEvent e) {
        }
+       
+       public void setVisibleItemCount(int visibleItems){
+               combo.setVisibleItemCount(visibleItems);
+       }
+       
+       private Collection<T> getElementsForClass(Class<T> clazz){
+               CdmEnumDataHolder<T> dataHolder = getCdmEnumDataHolderForClass(clazz);
+               if (dataHolder != null) {
+                       return dataHolder.getElements(); 
+               }
+               return null;
+       }
+       
+       private CdmEnumDataHolder<T> getCdmEnumDataHolderForClass(Class<T> clazz){
+               for (CdmEnumDataHolder dataHolder : cdmEnumDataHolders) {
+                       if (dataHolder.getClazz().equals(clazz)){
+                               return dataHolder;
+                       }
+               }
+               return null;
+       }
+       
+       private interface CdmEnumDataHolder<T> {
+               Class<T> getClazz();
+               String getName();
+               Collection<T> getElements();
+       }
 }
similarity index 88%
rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/term/AbstractTermComboElement.java
rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/TermComboElement.java
index 76c418b23e1480066dce265e4c2f22cd226eec5f..d82e6a745a735e5108eb65a289b0a4f350415dc7 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * 
  */
-package eu.etaxonomy.taxeditor.ui.term;
+package eu.etaxonomy.taxeditor.ui.combo;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -16,7 +16,6 @@ import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
 
@@ -43,14 +42,16 @@ import eu.etaxonomy.taxeditor.ui.forms.ISelectable;
  * @version 1.0
  * @param <T>
  */
-public abstract class AbstractTermComboElement<T extends DefinedTermBase>
+public class TermComboElement<T extends DefinedTermBase>
                extends AbstractCdmFormElement implements SelectionListener,
                DisposeListener, IEnableableFormElement, ISelectable {
 
-       T selection;
+       private static final int DEFAULT_VISIBLE_ITEMS = 10;
+       
+       private T selection;
 
+       private T emptyElement;
        private static String EMPTY_ELEMENT_LABEL = "";
-       T emptyElement;
 
        protected Label label;
        private Combo combo;
@@ -59,7 +60,8 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
 
        private Comparator<T> termComparator;
 
-       private Composite msgComposite;
+       private Class<T> termClass;
+
 
        /**
         * <p>
@@ -83,11 +85,13 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
         * @param <T>
         *            a T object.
         */
-       public AbstractTermComboElement(CdmFormFactory formFactory,
-                       ICdmFormElement parentElement, String labelString, T selection,
-                       int visibleItems, int style) {
+       public TermComboElement(CdmFormFactory formFactory,
+                       ICdmFormElement parentElement, Class<T> termClass, String labelString, T selection,
+                       int style) {
                super(formFactory, parentElement);
-
+               
+               this.termClass = termClass;
+               
                if (labelString != null) {
                        label = formFactory.createLabel(getLayoutComposite(), labelString);
                        addControl(label);
@@ -97,9 +101,9 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
                combo = new Combo(getLayoutComposite(), SWT.BORDER | SWT.READ_ONLY);
                addControl(combo);
                combo.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY());
-               combo.setVisibleItemCount(visibleItems);
+               combo.setVisibleItemCount(DEFAULT_VISIBLE_ITEMS);
 
-               populateTerms(preferredTerms());
+               populateTerms(getPreferredTerms());
 
                combo.addSelectionListener(this);
                combo.addDisposeListener(this);
@@ -217,7 +221,9 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
         * 
         * @return a {@link java.util.List} object.
         */
-       protected abstract List<T> preferredTerms();
+       protected List<T> getPreferredTerms(){
+               return getTermManager().getPreferredTerms(termClass);
+       }
 
        /**
         * May be overridden by derived classes if the desired label string does not
@@ -232,7 +238,7 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
        }
 
        private void createTermNotInPreferredTerms(T term) {
-               List<T> preferredTerms = preferredTerms();
+               List<T> preferredTerms = getPreferredTerms();
 
                preferredTerms.add(term);
 
@@ -288,7 +294,7 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
                if (event != null
                                && PreferencesUtil.PREFERRED_TERMS_CHANGE.equals(event
                                                .getProperty())) {
-                       populateTerms(preferredTerms());
+                       populateTerms(getPreferredTerms());
                }
        }
 
@@ -329,4 +335,16 @@ public abstract class AbstractTermComboElement<T extends DefinedTermBase>
        protected TermManager getTermManager() {
                return CdmStore.getTermManager();
        }
+       
+       public int getVisibleItemCount(){
+               return combo.getVisibleItemCount();
+       }
+       
+       public void setVisibleItemCount(int count){
+               combo.setVisibleItemCount(count);
+       }
+
+       public void setTerms(List<T> terms) {
+               populateTerms(terms);
+       }
 }
index 2f01add81537dc31db81029dad83a3377947f948..a6adbc41a8ae3bec652fd956b5440705b8cc0d3a 100644 (file)
@@ -42,93 +42,85 @@ import org.joda.time.Partial;
 import org.springframework.security.core.GrantedAuthority;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.agent.Person;
 import eu.etaxonomy.cdm.model.agent.Team;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.Annotation;
-import eu.etaxonomy.cdm.model.common.AnnotationType;
 import eu.etaxonomy.cdm.model.common.Credit;
 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
 import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.common.Extension;
-import eu.etaxonomy.cdm.model.common.ExtensionType;
 import eu.etaxonomy.cdm.model.common.Group;
 import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.cdm.model.common.IDefinedTerm;
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.common.Marker;
-import eu.etaxonomy.cdm.model.common.MarkerType;
+import eu.etaxonomy.cdm.model.common.TermVocabulary;
 import eu.etaxonomy.cdm.model.common.TimePeriod;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.common.VersionableEntity;
 import eu.etaxonomy.cdm.model.description.CategoricalData;
 import eu.etaxonomy.cdm.model.description.CommonTaxonName;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.Distribution;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
 import eu.etaxonomy.cdm.model.description.KeyStatement;
-import eu.etaxonomy.cdm.model.description.MeasurementUnit;
 import eu.etaxonomy.cdm.model.description.Modifier;
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
-import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
 import eu.etaxonomy.cdm.model.description.Scope;
-import eu.etaxonomy.cdm.model.description.Sex;
-import eu.etaxonomy.cdm.model.description.Stage;
-import eu.etaxonomy.cdm.model.description.State;
 import eu.etaxonomy.cdm.model.description.StateData;
-import eu.etaxonomy.cdm.model.description.StatisticalMeasure;
 import eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue;
 import eu.etaxonomy.cdm.model.description.TaxonInteraction;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.location.NamedArea;
-import eu.etaxonomy.cdm.model.location.NamedAreaType;
+import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
 import eu.etaxonomy.cdm.model.location.Point;
-import eu.etaxonomy.cdm.model.location.ReferenceSystem;
 import eu.etaxonomy.cdm.model.media.ImageFile;
 import eu.etaxonomy.cdm.model.media.Media;
 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
 import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
 import eu.etaxonomy.cdm.model.media.Rights;
-import eu.etaxonomy.cdm.model.media.RightsTerm;
 import eu.etaxonomy.cdm.model.name.NameRelationship;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
 import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
-import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
 import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
-import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
-import eu.etaxonomy.cdm.model.name.Rank;
+import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
-import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DeterminationModifier;
 import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
-import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
+import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
 import eu.etaxonomy.cdm.model.occurrence.Specimen;
+import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
-import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.forms.password.EditPasswordElement;
 import eu.etaxonomy.taxeditor.ui.openurl.IOpenUrlEnabled;
 import eu.etaxonomy.taxeditor.ui.openurl.OpenUrlSelectorElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionDetailElement;
@@ -265,6 +257,11 @@ import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
 import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.AgentSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.ClassificationSelectionElement;
@@ -288,34 +285,6 @@ import eu.etaxonomy.taxeditor.ui.selection.TaxonNodeSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TeamSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.UserSelectionElement;
-import eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement;
-import eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement;
-import eu.etaxonomy.taxeditor.ui.term.AnnotationTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.DeterminationModifierComboElement;
-import eu.etaxonomy.taxeditor.ui.term.EmptyComboElement;
-import eu.etaxonomy.taxeditor.ui.term.ExtensionTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.LanguageComboElement;
-import eu.etaxonomy.taxeditor.ui.term.MarkerTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.MeasurementUnitComboElement;
-import eu.etaxonomy.taxeditor.ui.term.ModifierComboElement;
-import eu.etaxonomy.taxeditor.ui.term.NameRelationshipTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.NameTypeDesignationStatusComboElement;
-import eu.etaxonomy.taxeditor.ui.term.NamedAreaTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.NomenclaturalCodeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.NomenclaturalStatusTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.PresenceAbsenceTermComboElement;
-import eu.etaxonomy.taxeditor.ui.term.PreservationMethodComboElement;
-import eu.etaxonomy.taxeditor.ui.term.RankComboElement;
-import eu.etaxonomy.taxeditor.ui.term.ReferenceSystemComboElement;
-import eu.etaxonomy.taxeditor.ui.term.ReferenceTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.RightsTypeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.ScopeComboElement;
-import eu.etaxonomy.taxeditor.ui.term.SexComboElement;
-import eu.etaxonomy.taxeditor.ui.term.SpecimenTypeDesignationStatusComboElement;
-import eu.etaxonomy.taxeditor.ui.term.StageComboElement;
-import eu.etaxonomy.taxeditor.ui.term.StateComboElement;
-import eu.etaxonomy.taxeditor.ui.term.StatisticalMeasureComboElement;
-import eu.etaxonomy.taxeditor.ui.term.TaxonRelationshipTypeComboElement;
 
 /**
  * <p>
@@ -962,33 +931,6 @@ public class CdmFormFactory extends FormToolkit {
                return element;
        }
 
-       public static enum TermComboType {
-               EXTENSIONTYPE, 
-               LANGUAGE, 
-               MARKERTYPE, 
-               NOMENCLATURALSTATUSTYPE, 
-               RANK, 
-               RIGHTSTYPE, 
-               NAMERELATIONSHIP, 
-               NAMEDAREATYPE, 
-               PRESENCEABSENCESTATUS, 
-               ANNOTATIONTYPE, 
-               NAMETYPEDESIGNATIONSTATUS, 
-               SPECIMENTYPEDESIGNATIONSTATUS, 
-               SEX, 
-               STAGE, 
-               PRESERVATION_METHOD, 
-               MEASUREMENT_UNIT, 
-               STATE, 
-               MODIFIER, 
-               STATISTICAL_MEASURE, 
-               SCOPE, 
-               EMPTY, 
-               DETERMINATION_MODIFIER, 
-               REFERENCE_SYSTEM, 
-               TAXON_RELATIONSHIP_TYPE_INVERSE_CONTAINER
-       }
-
        /**
         * <p>
         * createTermComboElement
@@ -1008,125 +950,19 @@ public class CdmFormFactory extends FormToolkit {
         *            object.
         * @param style
         *            a int.
-        * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractTermComboElement}
+        * @return a {@link eu.etaxonomy.taxeditor.ui.combo.TermComboElement}
         *         object.
         */
-       public AbstractTermComboElement createTermComboElement(
-                       TermComboType termComboType, ICdmFormElement parentElement,
-                       String labelString, DefinedTermBase selection, int style) {
-               AbstractTermComboElement element = null;
-
-               switch (termComboType) {
-               case EMPTY:
-                       element = new EmptyComboElement<DefinedTermBase>(this,
-                                       parentElement, labelString, style);
-                       break;
-               case EXTENSIONTYPE:
-                       element = new ExtensionTypeComboElement(this, parentElement,
-                                       labelString, (ExtensionType) selection, style);
-                       break;
-               case LANGUAGE:
-                       element = new LanguageComboElement(this, parentElement,
-                                       labelString, (Language) selection, style);
-                       break;
-               case MARKERTYPE:
-                       element = new MarkerTypeComboElement(this, parentElement,
-                                       labelString, (MarkerType) selection, style);
-                       break;
-               case NOMENCLATURALSTATUSTYPE:
-                       element = new NomenclaturalStatusTypeComboElement(this,
-                                       parentElement, labelString,
-                                       (NomenclaturalStatusType) selection, style);
-                       break;
-               case RANK:
-                       element = new RankComboElement(this, parentElement, labelString,
-                                       (Rank) selection, style);
-                       break;
-               case RIGHTSTYPE:
-                       element = new RightsTypeComboElement(this, parentElement,
-                                       labelString, (RightsTerm) selection, style);
-                       break;
-               case NAMERELATIONSHIP:
-                       element = new NameRelationshipTypeComboElement(this, parentElement,
-                                       labelString, (NameRelationshipType) selection, style);
-                       break;
-               case NAMEDAREATYPE:
-                       element = new NamedAreaTypeComboElement(this, parentElement,
-                                       labelString, (NamedAreaType) selection, style);
-                       break;
-               case ANNOTATIONTYPE:
-                       element = new AnnotationTypeComboElement(this, parentElement,
-                                       labelString, (AnnotationType) selection, style);
-                       break;
-               case PRESENCEABSENCESTATUS:
-                       element = new PresenceAbsenceTermComboElement(this, parentElement,
-                                       labelString, (PresenceAbsenceTermBase) selection, style);
-                       break;
-               case NAMETYPEDESIGNATIONSTATUS:
-                       element = new NameTypeDesignationStatusComboElement(this,
-                                       parentElement, labelString,
-                                       (NameTypeDesignationStatus) selection, style);
-                       break;
-               case SPECIMENTYPEDESIGNATIONSTATUS:
-                       element = new SpecimenTypeDesignationStatusComboElement(this,
-                                       parentElement, labelString,
-                                       (SpecimenTypeDesignationStatus) selection, style);
-                       break;
-               case SEX:
-                       element = new SexComboElement(this, parentElement, labelString,
-                                       (Sex) selection, style);
-                       break;
-               case STAGE:
-                       element = new StageComboElement(this, parentElement, labelString,
-                                       (Stage) selection, style);
-                       break;
-               case PRESERVATION_METHOD:
-                       element = new PreservationMethodComboElement(this, parentElement,
-                                       labelString, (PreservationMethod) selection, style);
-                       break;
-               case MEASUREMENT_UNIT:
-                       element = new MeasurementUnitComboElement(this, parentElement,
-                                       labelString, (MeasurementUnit) selection, style);
-                       break;
-               case STATE:
-                       element = new StateComboElement(this, parentElement, labelString,
-                                       (State) selection, style);
-                       break;
-               case SCOPE:
-                       element = new ScopeComboElement(this, parentElement, labelString,
-                                       (Scope) selection, style);
-                       break;
-               case MODIFIER:
-                       element = new ModifierComboElement(this, parentElement,
-                                       labelString, (Modifier) selection, style);
-                       break;
-               case STATISTICAL_MEASURE:
-                       element = new StatisticalMeasureComboElement(this, parentElement,
-                                       labelString, (StatisticalMeasure) selection, style);
-                       break;
-               case DETERMINATION_MODIFIER:
-                       element = new DeterminationModifierComboElement(this,
-                                       parentElement, labelString,
-                                       (DeterminationModifier) selection, style);
-                       break;
-               case REFERENCE_SYSTEM:
-                       element = new ReferenceSystemComboElement(this, parentElement,
-                                       labelString, (ReferenceSystem) selection, style);
-                       break;
-               case TAXON_RELATIONSHIP_TYPE_INVERSE_CONTAINER:
-                       element = new TaxonRelationshipTypeComboElement(this, parentElement, labelString, (TaxonRelationshipTypeInverseContainer) selection, style);
-                       break;
-               }
-
+       
+       public <T extends DefinedTermBase> TermComboElement createTermComboElement(
+                       Class<T> termComboType, ICdmFormElement parentElement,
+                       String labelString, T selection, int style) {
+               TermComboElement element = new TermComboElement<T>(this, parentElement, termComboType, labelString, selection, style);
                adapt(element);
                parentElement.addElement(element);
                return element;
        }
 
-       public static enum EnumComboType {
-               REFERENCETYPE, NOMENCLATURALCODE
-       }
-
        /**
         * <p>
         * createEnumComboElement
@@ -1144,21 +980,10 @@ public class CdmFormFactory extends FormToolkit {
         * @return a {@link eu.etaxonomy.taxeditor.ui.term.AbstractEnumComboElement}
         *         object.
         */
-       public AbstractEnumComboElement createEnumComboElement(
-                       EnumComboType enumComboType, ICdmFormElement parentElement,
+       public <T extends IDefinedTerm> EnumComboElement<T> createEnumComboElement(
+                       Class<T> enumComboType, ICdmFormElement parentElement,
                        int style) {
-               AbstractEnumComboElement element = null;
-
-               switch (enumComboType) {
-               case REFERENCETYPE:
-                       element = new ReferenceTypeComboElement(this, parentElement,
-                                       "Reference Type", null, style);
-                       break;
-               case NOMENCLATURALCODE:
-                       element = new NomenclaturalCodeComboElement(this, parentElement,
-                                       "Nomenclatural Code", null, style);
-                       break;
-               }
+               EnumComboElement<T> element = new EnumComboElement<T>(this, parentElement, enumComboType, style);
                adapt(element);
                parentElement.addElement(element);
                return element;
@@ -1705,7 +1530,45 @@ public class CdmFormFactory extends FormToolkit {
                GROUP, 
                DETERMINATION, 
                TAXON_RELATIONSHIP, 
-               REFERENCED_ENTITY
+               REFERENCED_ENTITY, 
+               TERM_VOCABULARY,
+               NAMED_AREA, 
+               NAMED_AREA_LEVEL
+       }
+       
+       public AbstractFormSection createDefinedTermDetailSection(Class definedTermClass,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               
+               AbstractFormSection section = new DefinedTermDetailSection(this, definedTermClass, conversation, parentElement, selectionProvider, style);
+                       
+               parentElement.addElement(section);
+               adapt(section);
+               return section;
+               
+       }
+       
+       /**
+        * @param definedTermClass
+        * @param formElement
+        * @param style
+        * @return
+        */
+       public AbstractCdmDetailElement createDefinedTermDetailElement(
+                       Class definedTermClass, AbstractCdmDetailSection parentElement,
+                       int style) {
+               AbstractCdmDetailElement element = null;
+               
+               if (NamedArea.class.isAssignableFrom(definedTermClass)){
+                       element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
+               }
+               else {
+                       element = new DefinedTermDetailElement(this, parentElement);
+               }
+               
+               adapt(element);
+               parentElement.addElement(element);
+               return element;
        }
 
        /**
@@ -1860,6 +1723,14 @@ public class CdmFormFactory extends FormToolkit {
                        section = new ReferencedEntityDetailSection(this, conversation, parentElement, 
                                        selectionProvider, style);
                        break;
+               case TERM_VOCABULARY:
+                       section = new TermVocabularyDetailSection(this, conversation, parentElement, 
+                                       selectionProvider, style);
+                       break;
+               case NAMED_AREA:
+                       section = new NamedAreaDetailSection(this, conversation, parentElement, 
+                                       selectionProvider, style);
+                       break;
                }
 
                if (section == null) {
@@ -1872,6 +1743,8 @@ public class CdmFormFactory extends FormToolkit {
                return section;
        }
 
+       
+       
        /**
         * <p>
         * createCdmDetailElement
@@ -1984,6 +1857,15 @@ public class CdmFormFactory extends FormToolkit {
                case REFERENCED_ENTITY:
                        element = new RefereneEntityDetailElement(this, parentElement);
                        break;
+               case TERM_VOCABULARY:
+                       element = new TermVocabularyDetailElement(this, parentElement);
+                       break;
+               case NAMED_AREA:
+                       element = new eu.etaxonomy.taxeditor.ui.section.vocabulary.NamedAreaDetailElement(this, parentElement);
+                       break;
+               case NAMED_AREA_LEVEL:
+                       element = new DefinedTermDetailElement<NamedAreaLevel>(this, parentElement);
+                       break;
                }
 
                if (element == null) {
@@ -2005,7 +1887,41 @@ public class CdmFormFactory extends FormToolkit {
         * @version 1.0
         */
        public static enum EntityDetailType {
-               TEAM, TEAMMEMBER, ANNOTATION, CREDIT, DESCRIPTIONELEMENTSOURCE, EXTENSION, MARKER, MEDIA, DESCRIPTIONELEMENTMEDIA, MEDIAREPRESENTATION, MEDIAREPRESENTATIONPART, MODIFIER, NOMENCLATURALSTATUS, NAME_RELATIONSHIP, PROTOLOG, RIGHTS, SOURCE, SCOPE, DESCRIPTIONSOURCE, TYPEDESIGNATION, STATE_DATA, STATISTICAL_MEASUREMENT_VALUE, DESCRIBED_SPECIMEN, COLLECTING_AREA, DETERMINATION_EVENT, SPECIMEN_COLLECTION, IDENTIFIABLE_SOURCE_COLLECTION, GEOGRAPHICAL_SCOPE, SCOPE_RESTRICTION, MEMBER, GRANTED_AUTHORITY, GROUPS_BY_USER, TAXONOMIC_SCOPE, DETERMINATION_CURRENT, DETERMINATION_HISTORY
+               TEAM, 
+               TEAMMEMBER, 
+               ANNOTATION, 
+               CREDIT, 
+               DESCRIPTIONELEMENTSOURCE, 
+               EXTENSION, 
+               MARKER, 
+               MEDIA, 
+               DESCRIPTIONELEMENTMEDIA, 
+               MEDIAREPRESENTATION, 
+               MEDIAREPRESENTATIONPART, 
+               MODIFIER, 
+               NOMENCLATURALSTATUS, 
+               NAME_RELATIONSHIP, 
+               PROTOLOG, 
+               RIGHTS, 
+               SOURCE, 
+               SCOPE, 
+               DESCRIPTIONSOURCE, 
+               TYPEDESIGNATION, 
+               STATE_DATA, 
+               STATISTICAL_MEASUREMENT_VALUE, 
+               DESCRIBED_SPECIMEN, 
+               COLLECTING_AREA, 
+               DETERMINATION_EVENT, 
+               SPECIMEN_COLLECTION, 
+               IDENTIFIABLE_SOURCE_COLLECTION, 
+               GEOGRAPHICAL_SCOPE, 
+               SCOPE_RESTRICTION, 
+               MEMBER, 
+               GRANTED_AUTHORITY, 
+               GROUPS_BY_USER, 
+               TAXONOMIC_SCOPE, 
+               DETERMINATION_CURRENT, 
+               DETERMINATION_HISTORY
        }
 
        /**
@@ -2589,4 +2505,6 @@ public class CdmFormFactory extends FormToolkit {
                // text.addFocusListener(visibilityHandler);
                return text;
        }
+
+
 }
index 19fe700b279423b79caf266ae3317482c0f51009..91829bbe3eb12e68d8e9b0fc14a262d84fb4679b 100644 (file)
@@ -29,8 +29,7 @@ import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.common.MultilanguageTextHelper;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
-import eu.etaxonomy.taxeditor.ui.term.EmptyComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.EmptyComboElement;
 import eu.etaxonomy.taxeditor.ui.translation.TranslationWizard;
 
 /**
@@ -117,7 +116,7 @@ public class MultilanguageTextElement extends AbstractCdmFormElement implements
 
                if (PreferencesUtil.isMultilanguageTextEditingCapability()) {
                        combo_language = (EmptyComboElement<Language>) formFactory
-                                       .createTermComboElement(TermComboType.EMPTY, formElement,
+                                       .createTermComboElement(Language.class, formElement,
                                                        "", null, style);
                        combo_language.addSelectionListener(this);
                        addControl(formFactory.createLabel(getLayoutComposite(), ""));
index 6580325959295bfaeb4b836809a42227783ba739..f6f012f5f4b3d9fdb1c8a04728f038b5411426be 100644 (file)
@@ -15,9 +15,9 @@ import java.text.ParseException;
 import org.eclipse.jface.util.PropertyChangeEvent;
 
 import eu.etaxonomy.cdm.model.location.Point;
+import eu.etaxonomy.cdm.model.location.ReferenceSystem;
 import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
-import eu.etaxonomy.taxeditor.ui.term.ReferenceSystemComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 
 /**
  * <p>
@@ -36,7 +36,7 @@ public class PointElement extends AbstractCdmFormElement implements
        private final TextWithLabelElement text_latitude;
        private final TextWithLabelElement text_longitude;
        private final NumberWithLabelElement number_errorRadius;
-       private final ReferenceSystemComboElement combo_referenceSystem;
+       private final TermComboElement<ReferenceSystem> combo_referenceSystem;
 
        private final TextWithLabelElement text_latitudeParsed;
 
@@ -76,8 +76,8 @@ public class PointElement extends AbstractCdmFormElement implements
                text_longitudeParsed.setEnabled(false);
                number_errorRadius = formFactory.createIntegerTextWithLabelElement(
                                formElement, "Error Radius (m)", null, style);
-               combo_referenceSystem = (ReferenceSystemComboElement) formFactory
-                               .createTermComboElement(TermComboType.REFERENCE_SYSTEM,
+               combo_referenceSystem = formFactory
+                               .createTermComboElement(ReferenceSystem.class,
                                                formElement, "Reference System", null, style);
 
                setPoint(point);
index bb8514339623eb6d16d6129fc3f4c244c4bd26a6..7a99479399ca7125a3550abd045af6c505779d81 100644 (file)
@@ -77,6 +77,30 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends
 
                createControls(this, SWT.NULL);
        }
+       
+       public AbstractCdmDetailSection(CdmFormFactory formFactory, Class<ENTITY> clazz,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               super(formFactory, parentElement, selectionProvider,
+                               Section.CLIENT_INDENT | style);
+               
+               setText(getHeading());
+
+               addExpansionListener(this);
+
+               createControlsByType(this, clazz, SWT.NULL);
+       }
+
+       /**
+        * @param abstractCdmDetailSection
+        * @param definedTermClass
+        * @param null1
+        */
+       protected void createControlsByType(
+                       AbstractCdmDetailSection<ENTITY> abstractCdmDetailSection,
+                       Class<ENTITY> entityClass, int style) {
+       }
+
 
        /**
         * <p>
index d17339460d4a49fac0610868f10066161465c93f..5bfce5fd9218e8d92f6bcfc2b388de22aab2464a 100644 (file)
@@ -5,7 +5,6 @@ package eu.etaxonomy.taxeditor.ui.section;
 
 import java.util.Collection;
 
-import org.apache.commons.collections.CollectionUtils;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ToolBarManager;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -29,8 +28,8 @@ import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 
 /**
index acf9ff6211276d965d96bf822ac0a268d318ce9d..d7645a9ba060c58c554ff64e93ec61694ce0ca5b 100644 (file)
@@ -13,12 +13,11 @@ package eu.etaxonomy.taxeditor.ui.section.description;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.description.Modifier;
+import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
-import eu.etaxonomy.taxeditor.ui.term.ModifierComboElement;
 
 /**
  * <p>ModifierElement class.</p>
@@ -29,7 +28,7 @@ import eu.etaxonomy.taxeditor.ui.term.ModifierComboElement;
  */
 public class ModifierElement extends AbstractEntityCollectionElement<Modifier> {
        
-       private ModifierComboElement combo_modifier;
+       private TermComboElement<Modifier> combo_modifier;
 
        /**
         * <p>Constructor for ModifierElement.</p>
@@ -56,7 +55,7 @@ public class ModifierElement extends AbstractEntityCollectionElement<Modifier> {
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
-               combo_modifier = (ModifierComboElement) formFactory.createTermComboElement(TermComboType.MODIFIER, element, "Modifier", getEntity(), style);
+               combo_modifier = formFactory.createTermComboElement(Modifier.class, element, "Modifier", getEntity(), style);
        }
 
        /** {@inheritDoc} */