commit d98abaef29b5433d727b786aaf14af258495c631
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Mon Jun 11 11:50:14 2018 +0200

    ref #4302 Escape '&' in section titles

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
index 3f0de0796..dd3d284a8 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/StoreUtil.java
@@ -119,4 +119,18 @@ public class StoreUtil extends AbstractUtility {
 		return TaxeditorStorePlugin.PLUGIN_ID;
 	}
 
+    /**
+     * Cleans title string for output in section titles<br>
+     * E.g. escapes '&' with "&&" to avoid mnemonic handling (see
+     * Label.setText() documentation)<br>
+     * see also #4302
+     *
+     * @param title
+     *            the title string to clean
+     * @return the cleaned title string
+     */
+	public static String cleanTitleString(String title){
+	    return title.replace("&", "&&");
+	}
+
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
index 77c0279a8..ddb8f0d80 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
@@ -29,6 +29,7 @@ import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -74,6 +75,11 @@ public abstract class AbstractCdmDetailSection<ENTITY>
         }
 	}
 
+	@Override
+	public void setText(String title) {
+	    super.setText(StoreUtil.cleanTitleString(title));
+	}
+
 	protected void createControlsByType(AbstractCdmDetailSection<ENTITY> formElement, Class<ENTITY> entityClass, int style) {
 	    TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout();
 	    layout.topMargin = 10;
@@ -159,11 +165,6 @@ public abstract class AbstractCdmDetailSection<ENTITY>
 				label =((IdentifiableEntity) getEntity()).getTitleCache();
 			}
 			title = ": " + label;
-
-			// we have to duplicate ampersands otherwise they are treated as
-			// mnenomic (see Label.setText() documentation)
-			// see also #4302
-			title = title.replace("&", "&&");
 		}
 		this.setText(String.format("%s%s", getHeading(), title));
 		setTextClient(createToolbar());
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
index 6ed120a31..3cc294202 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
@@ -7,6 +7,7 @@ package eu.etaxonomy.taxeditor.ui.section.supplemental;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -37,7 +38,10 @@ public class HeadlineSection extends AbstractFormSection<ICdmBase> {
 		ICdmBase entity = HibernateProxyHelper.deproxy(cdmBase);
 		super.setEntity(entity);
 
-		setText(entity.getClass().getSimpleName() + (entity instanceof IdentifiableEntity ? ": " + ((IdentifiableEntity) entity).generateTitle() : ""));
+		String simpleName = entity.getClass().getSimpleName();
+        String titleString = entity instanceof IdentifiableEntity ? ": " + ((IdentifiableEntity) entity).generateTitle() : "";
+        titleString = StoreUtil.cleanTitleString(titleString);
+        setText(simpleName + titleString);
 		layout();
 	}
 
