- added preference for displaying associated taxa in specimen details view
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 2 Dec 2014 09:24:50 +0000 (09:24 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 2 Dec 2014 09:24:50 +0000 (09:24 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/association/TaxonAssociationDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index dfc178da04deaec541c5d07fb840d1a0a2b061da..a748e14c661f218e2d57a50206435585dccc5286 100644 (file)
@@ -121,6 +121,7 @@ public interface IPreferenceKeys {
 
     public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
 
+    public static final String SHOW_TAXON_ASSOCIATIONS = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations";
 
     public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
 
index 93ebade8b6d5af2adbbd2c6445a2f1ac5d3d363c..9c9bd5aee17d34aaf503280f48c7394b1a51b4bd 100644 (file)
@@ -40,6 +40,9 @@ public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage
         addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
                 "Show \"Collecting Areas\" in \"General\" section of details view",
                 getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS,
+                "Show taxon associations of a specimen in the details view",
+                getFieldEditorParent()));
 
     }
 
index 7b2d5f6263243a644457bd71130c7f5f60a06259..f011cdb179cab0970c11554e1ee79b968d1f70f8 100644 (file)
@@ -11,10 +11,6 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.association;
 
 import java.util.Collection;
 
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.NotEnabledException;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -81,24 +77,24 @@ public class TaxonAssociationDetailElement extends AbstractCdmDetailElement<Deri
      */
     @Override
     public void doubleClick(DoubleClickEvent event) {
-        String commandId = "eu.etaxonomy.taxeditor.navigation.command.update.editSelection";
-
-        IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
-        try {
-            handlerService.executeCommand(commandId, null);
-        } catch (ExecutionException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (NotDefinedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (NotEnabledException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        } catch (NotHandledException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
+//        String commandId = "eu.etaxonomy.taxeditor.navigation.command.update.editSelection";
+//
+//        IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
+//        try {
+//            handlerService.executeCommand(commandId, null);
+//        } catch (ExecutionException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        } catch (NotDefinedException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        } catch (NotEnabledException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        } catch (NotHandledException e) {
+//            // TODO Auto-generated catch block
+//            e.printStackTrace();
+//        }
 
 
 //        if(event.getSelection() instanceof StructuredSelection){
index d21be346eec997c81abd91814396f2b8c5e15ead..d04a0d2859d6a54fb34bbd087146165160bb98d1 100644 (file)
@@ -656,50 +656,30 @@ public class DetailsViewer extends AbstractCdmDataViewer {
     private void createDerivedUnitBaseElementSection(RootElement parent) {
         destroySections();
 
-        //different order of sections (Specimen Details as second section and expanded)
-        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
-            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitGeneralDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitBaseDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(originalLabelDataSection);
+        DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(derivedUnitGeneralDetailSection);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(taxonAssociationDetailSection);
-        }
-        else{
-            DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-            addPart(derivedUnitGeneralDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(gatheringEventDetailSection);
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(derivedUnitBaseDetailSection);
 
-            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(fieldUnitDetailSection);
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(originalLabelDataSection);
 
-            DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(derivedUnitBaseDetailSection);
 
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
             DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
             addPart(determinationDetailSection);
         }
+        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
+            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+            TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+            addPart(taxonAssociationDetailSection);
+        }
 
     }