commit 76b874f88b5e44d9cf572760d39fecad6a99cdf7
Author: Katja Luther <k.luther@bgbm.org>
Date:   Thu Oct 20 13:55:27 2016 +0200

    fix #6050: add the possibility to configure which fields should be displayed in name details view

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
index b5485c6df..ccbc6b96e 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
@@ -156,9 +156,11 @@ public interface IPreferenceKeys {
 
     public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
     public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
+    public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
     public static final String SHOW_NAME_DETAILS_SECTION_LSID = "eu.etaxonomy.taxeditor.name.showNameLsid";
     public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalCode";
     public static final String SHOW_NAME_DETAILS_SECTION_RANK = "eu.etaxonomy.taxeditor.name.showNameRank";
+    public static final String SHOW_NAME_DETAILS_SECTION_NAMECACHE = "eu.etaxonomy.taxeditor.name.showNameNameCache";
     public static final String SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS = "eu.etaxonomy.taxeditor.name.showNameAtomisedEpithets";
     public static final String SHOW_NAME_DETAILS_SECTION_AUTHORSHIP = "eu.etaxonomy.taxeditor.name.showNameAuthorship";
     public static final String SHOW_NAME_DETAILS_SECTION_HYBRID = "eu.etaxonomy.taxeditor.name.showNameHybrid";
@@ -167,7 +169,9 @@ public interface IPreferenceKeys {
     public static final String SHOW_NAME_DETAILS_SECTION_PROTOLOGUE = "eu.etaxonomy.taxeditor.name.showNameProtologue";
     public static final String SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION = "eu.etaxonomy.taxeditor.name.showNameTypeDesignation";
     public static final String SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP = "eu.etaxonomy.taxeditor.name.showNameNameRelationship";
-
+	public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase";
+	public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache";
+	
     public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
 
     // TODO RL
@@ -182,6 +186,11 @@ public interface IPreferenceKeys {
      */
     public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
 
+	
+
+
+
+
 
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
index e7eb2a4d1..0dd68af2e 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
@@ -451,6 +451,18 @@ public class PreferencesUtil implements IPreferenceKeys {
 		getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT, "1000");
 		getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false);
 		getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAMECACHE, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_RANK, true);
+		getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, true);
 	}
 
 	/**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
index 1b68e53ad..38f5377ab 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
@@ -70,42 +70,42 @@ public class TaxonomicEditorGeneralPreferences extends
 		addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
 		        "Open search results in separate windows",
 		        getFieldEditorParent()));
-		addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
-                "Show only a simple name details view",
-                getFieldEditorParent()));
+//		addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
+//                "Show only a simple name details view",
+//                getFieldEditorParent()));
 
 		Composite composite = new Composite(getFieldEditorParent(), SWT.NULL);
         composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
         composite.setLayout(new RowLayout(1));
 
-        final Label label = new Label(composite, SWT.NONE);
-        label.setText("Choose the prefered match mode for searches.");
-
-        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
-
-        MatchMode[] matchModes = MatchMode.values();
-        int currentSelectionIndex = 0;
-        for(int i = 0; i < matchModes.length; i++){
-            MatchMode mode = matchModes[i];
-            combo_MatchMode.add(mode.name(),i);
-            //TODO:the correct preselection is needed here!!
-            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
-                currentSelectionIndex = i;
-            }
-        }
-
-        combo_MatchMode.select(currentSelectionIndex);
-
-        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
-            /* (non-Javadoc)
-             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-             */
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                int selectionIndex = combo_MatchMode.getSelectionIndex();
-                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
-            }
-        });
+//        final Label label = new Label(composite, SWT.NONE);
+//        label.setText("Choose the prefered match mode for searches.");
+//
+//        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
+//
+//        MatchMode[] matchModes = MatchMode.values();
+//        int currentSelectionIndex = 0;
+//        for(int i = 0; i < matchModes.length; i++){
+//            MatchMode mode = matchModes[i];
+//            combo_MatchMode.add(mode.name(),i);
+//            //TODO:the correct preselection is needed here!!
+//            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
+//                currentSelectionIndex = i;
+//            }
+//        }
+//
+//        combo_MatchMode.select(currentSelectionIndex);
+//
+//        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
+//            /* (non-Javadoc)
+//             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+//             */
+//            @Override
+//            public void widgetSelected(SelectionEvent e) {
+//                int selectionIndex = combo_MatchMode.getSelectionIndex();
+//                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
+//            }
+//        });
 
 
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
index b4e733ed7..ca153c81f 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
@@ -79,18 +79,27 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
 	protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
 
 	    if (isAdvancedView){
-	        toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+	    	toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+	    }else{
+	    	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE)){
+	    		toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+        	}
 	    }
 		combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
-
-		createGenusOrUninomialControls(this, nonViralName, style);
-		createInfragenerericEpithetControls(this, nonViralName, style);
-		createSpecificEpithetControls(this, nonViralName, style);
-		createInfraSpecificEpithetControls(this, nonViralName, style);
-		createSpecificNameParts(this, nonViralName, style);
+		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS)){
+			createGenusOrUninomialControls(this, nonViralName, style);
+			createInfragenerericEpithetControls(this, nonViralName, style);
+			createSpecificEpithetControls(this, nonViralName, style);
+			createInfraSpecificEpithetControls(this, nonViralName, style);
+			createSpecificNameParts(this, nonViralName, style);
+		}
 		if (isAdvancedView){
 		    //createSpecificNameParts(this, nonViralName, style);
 			text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
+		}else{
+			if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE)){
+				text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
+        	}
 		}
 	}
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
index e88a143db..23fe4db93 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
@@ -64,6 +64,26 @@ public class NonViralNameDetailElement extends
                 toggleable_cache.setVisible(false);
                 combo_nomenclaturalCode.setVisible(false);
             }
+        }else{
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){
+        		toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
+                if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+                    toggleable_cache.setVisible(false);
+                }
+        	}
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE)){
+        		combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
+        		combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
+        		 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+        			  combo_nomenclaturalCode.setVisible(false);
+                 } 
+        	}
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID)){
+        		textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
+        		
+        	}
+                       
+        	
         }
 
 
@@ -84,7 +104,16 @@ public class NonViralNameDetailElement extends
     	        addControl(section_hybrid);
     	        addElement(section_hybrid);
     	    }
-	    }
+    	 }else{
+    		 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+    			 if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){
+	     	        section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
+	     	        section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+	     	        addControl(section_hybrid);
+	     	        addElement(section_hybrid);
+    			 }
+     	    }
+    	 }
 
 
     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
index 2a12e89b0..48e089902 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java
@@ -365,42 +365,56 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
                 ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
         if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
-            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
-            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            addPart(taxonBaseDetailSection);
+        	TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+	        ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
+	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+	        addPart(taxonBaseDetailSection);
+        }else{
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
+	            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+	            		ExpandableComposite.TWISTIE	| ExpandableComposite.EXPANDED);
+	            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+	
+	            addPart(taxonBaseDetailSection);
+        	}
         }
         NonViralNameDetailSection nonViralNameSection = formFactory
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
                         ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE)){
             NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
             		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
+            addPart(referenceDetailSection);
+        }
+        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS)){
             NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
             		ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
             addPart(nomenclaturalStatusSection);
-            addPart(referenceDetailSection);
+            
         }
         //TODO RL
-        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
-	        ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-	        TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-	        NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-	        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-			addPart(protologSection);
-			addPart(typeDesignationSection);
-			addPart(nameRelationshipSection);
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  ){
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE)){
+        		ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        		addPart(protologSection);
+        	}
+        	
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION)){
+        		TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        		addPart(typeDesignationSection);
+        	}
+        	
+        	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP)){
+        		NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        		formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+        		addPart(nameRelationshipSection);
+        	}
         }
 
         addPart(parsingMessagesSection);
