commit adb4cbcf29a146102cbf21d096506dd2af24686d
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Fri Mar 1 10:16:23 2019 +0100

    ref #8150 Allow editing representation label of characters in details

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
index ac55640a7..b6c57ae61 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/CharacterDetailElement.java
@@ -11,13 +11,18 @@ package eu.etaxonomy.taxeditor.ui.section.feature;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
+import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.common.Representation;
 import eu.etaxonomy.cdm.model.description.Character;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermBasePropertyTester;
 import eu.etaxonomy.taxeditor.model.ColorResources;
 import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.RepresentationElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.MeasurementUnitCollectionSection;
 import eu.etaxonomy.taxeditor.ui.section.vocabulary.RecommendedModifierVocabulariesCollectionSection;
@@ -34,6 +39,8 @@ public class CharacterDetailElement extends AbstractCdmDetailElement<Character>
 
     private ICdmFormElement parentFormElement;
 
+    protected RepresentationElement element_Representation;
+
     private CheckboxElement supportsQuantitativeData;
 
     private CheckboxElement supportsCategoricalData;
@@ -54,6 +61,7 @@ public class CharacterDetailElement extends AbstractCdmDetailElement<Character>
 	@Override
 	protected void createControls(ICdmFormElement formElement, Character entity, int style) {
 	    this.parentFormElement = formElement;
+	    element_Representation = formFactory.createTranslatableRepresentationElement(formElement,  getEntity().getPreferredRepresentation(CdmStore.getDefaultLanguage()),getEntity(), 100, style, true);
 	    Label lblStructure = new Label(formElement.getLayoutComposite(), style);
 	    lblStructure.setText("Structure");
 	    Label lblStructureText = new Label(formElement.getLayoutComposite(), style);
@@ -94,6 +102,12 @@ public class CharacterDetailElement extends AbstractCdmDetailElement<Character>
         }
     }
 
+    @Override
+    public void setEntity(Character entity) {
+        super.setEntity(entity);
+        setEnabled(TermBasePropertyTester.isModifiable(entity));
+    }
+
 	@Override
 	public void handleEvent(Object eventSource) {
 	    if(eventSource == supportsQuantitativeData || eventSource == supportsCategoricalData){
@@ -118,6 +132,19 @@ public class CharacterDetailElement extends AbstractCdmDetailElement<Character>
 	            removeCategoricalWidgets();
 	        }
 	    }
+	    else if (eventSource == element_Representation) {
+            Representation selectedRepresentation = element_Representation.getSelectedRepresentation();
+            if(selectedRepresentation!=null){
+                Language representationLanguage = selectedRepresentation.getLanguage();
+                if(representationLanguage==null){
+                    representationLanguage = Language.getDefaultLanguage();
+                }
+                getEntity().setLabel(selectedRepresentation.getLabel(),  representationLanguage);
+                getEntity().getRepresentation(representationLanguage).setAbbreviatedLabel(selectedRepresentation.getAbbreviatedLabel());
+                getEntity().getRepresentation(representationLanguage).setText(selectedRepresentation.getDescription());
+            }
+            getEntity().setTitleCache(null);
+        }
 	}
 
 	private void activateQuantitativeWidgets(){
