commit e3e487e31b25adc3469cf26597ff351245ef74f3
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Thu Dec 6 10:05:14 2018 +0100

    ref #7923 Set character representation during creation

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
index abb9de6ce..c62a97374 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
@@ -56,6 +56,7 @@ import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
 import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.model.common.Representation;
 import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
 import eu.etaxonomy.cdm.model.description.FeatureTree;
@@ -72,6 +73,7 @@ import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
@@ -218,9 +220,6 @@ public class CharacterEditor implements IFeatureTreeEditor,IConversationEnabled,
 
     private void init(){
         btnAddCharacter.addSelectionListener(new SelectionAdapter() {
-            /**
-             * {@inheritDoc}
-             */
             @Override
             public void widgetSelected(SelectionEvent e) {
                 ISelection structureTreeSelection = structuresTreeEditorComposite.getViewer().getSelection();
@@ -234,10 +233,8 @@ public class CharacterEditor implements IFeatureTreeEditor,IConversationEnabled,
                 for (Character character : characters) {
                     //add new Character to feature tree
                     FeatureNode parent = ((FeatureTree) characterTreeEditorComposite.getViewer().getInput()).getRoot();
-                    CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), character.getUuid());
+                    CdmStore.getService(IFeatureNodeService.class).createChildFeatureNode(parent, character);
                 }
-
-                setDirty();
                 characterTreeEditorComposite.getViewer().refresh();
             }
         });
@@ -254,8 +251,18 @@ public class CharacterEditor implements IFeatureTreeEditor,IConversationEnabled,
             Iterator<FeatureNode> propertiesIterator = propertyTreeSelection.iterator();
             while(propertiesIterator.hasNext()){
                 FeatureNode propertyNode = propertiesIterator.next();
+                Representation structureRepresentation = structureNode.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
+                Representation propertyRepresentation = propertyNode.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
+                String label = null;
+                String abbrevLabel = null;
+                if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){
+                    label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel();
+                }
+                if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){
+                    abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel();
+                }
                 //create new Character
-                Character character = Character.NewInstance(structureNode, propertyNode);
+                Character character = Character.NewInstance(structureNode, propertyNode, null, label, abbrevLabel);
                 characters.add(character);
             }
         }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/CharacterTransfer.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/CharacterTransfer.java
index e361489f2..c57b43b3f 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/CharacterTransfer.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/CharacterTransfer.java
@@ -23,8 +23,10 @@ import org.eclipse.swt.dnd.ByteArrayTransfer;
 import org.eclipse.swt.dnd.TransferData;
 
 import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
+import eu.etaxonomy.cdm.model.common.Representation;
 import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.description.FeatureNode;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
@@ -100,7 +102,17 @@ public class CharacterTransfer extends ByteArrayTransfer {
                         IFeatureNodeService featureNodeService = CdmStore.getService(IFeatureNodeService.class);
                         FeatureNode structure = featureNodeService.load(UUID.fromString(split[0]));
                         FeatureNode property = featureNodeService.load(UUID.fromString(split[1]));
-                        characters.add(Character.NewInstance(structure, property));
+                        Representation structureRepresentation = structure.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
+                        Representation propertyRepresentation = property.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
+                        String label = null;
+                        String abbrevLabel = null;
+                        if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){
+                            label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel();
+                        }
+                        if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){
+                            abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel();
+                        }
+                        characters.add(Character.NewInstance(structure, property, null, label, abbrevLabel));
                     }
                 }catch(EOFException e){
                     return characters.toArray();
