commit aae0ca069a639007aa180a7193fa0b510c0499d7
Author: Katja Luther <k.luther@bgbm.org>
Date:   Tue Jan 21 10:55:02 2020 +0100

    fix #8749: move proposal adapter creation to method in abstractComboDetailElement

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java
index aa9389551..09c08a426 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java
@@ -11,7 +11,10 @@ package eu.etaxonomy.taxeditor.ui.combo;
 import java.util.ArrayList;
 
 import org.eclipse.equinox.internal.p2.ui.misc.StringMatcher;
+import org.eclipse.jface.fieldassist.ComboContentAdapter;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
 import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalListener;
 import org.eclipse.jface.fieldassist.IContentProposalProvider;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
@@ -28,6 +31,7 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement;
 import eu.etaxonomy.taxeditor.ui.element.ISelectable;
@@ -68,14 +72,14 @@ DisposeListener {
         combo.setLayoutData(fill_HORIZONTALLY);
         fill_HORIZONTALLY.maxWidth = 50;
         combo.setVisibleItemCount(DEFAULT_VISIBLE_ITEMS);
-
-
-
         //disable mouse-wheel selection
         combo.addListener(SWT.MouseWheel, e->e.doit=false);
-//        combo.addListener(SWT.MouseUp, e->firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)));
+
+
     }
 
+
+
     /** {@inheritDoc} */
     @Override
     public void setBackground(Color color) {
@@ -143,6 +147,28 @@ DisposeListener {
 
     public abstract void setSelection(T selection);
 
+
+
+    private AbstractComboElement<T> getComboElement(){
+        return this;
+    }
+
+
+    protected void addContentProposalAdapter() {
+        ContentProposalAdapter adapter;
+
+        adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), getProposalProvider(), null, null);
+        adapter.setPropagateKeys(true);
+        adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
+        adapter.addContentProposalListener(new IContentProposalListener() {
+            @Override
+            public void proposalAccepted(IContentProposal proposal) {
+                setSelection((T)combo.getData(proposal.getContent()));
+                firePropertyChangeEvent(new CdmPropertyChangeEvent(getComboElement(), null));
+            }
+        });
+    }
+
     IContentProposalProvider getProposalProvider() {
         return new IContentProposalProvider() {
             @Override
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java
index 601e9c226..ece8043e8 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/EnumComboElement.java
@@ -177,6 +177,7 @@ public class EnumComboElement<T extends IEnumTerm<T>> extends
 		label.setText(getDefaultLabelString());
 		populateTypes(comparator);
 		combo.addSelectionListener(this);
+		addContentProposalAdapter();
 	}
 
 	public void setIndent(int indent) {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/NameRelationshipTypeCombo.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/NameRelationshipTypeCombo.java
index 50fd1e2e3..d244ac00e 100755
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/NameRelationshipTypeCombo.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/NameRelationshipTypeCombo.java
@@ -18,9 +18,9 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 
 import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.name.NameRelationshipType;
 import eu.etaxonomy.cdm.model.term.Representation;
 import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.TermManager;
@@ -62,6 +62,7 @@ public class NameRelationshipTypeCombo<T extends InverseTermWrapper> extends Abs
      this.useAbbrevLabel = useAbbrevLabel;
      populateTerms();
      label.setText(labelString);
+     addContentProposalAdapter();
      FontDescriptor descriptor = FontDescriptor.createFrom(label.getFont());
   // setStyle method returns a new font descriptor for the given style
      descriptor = descriptor.setStyle(SWT.ITALIC);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java
index 1fe45b606..90e1470ea 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java
@@ -8,10 +8,6 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.eclipse.jface.fieldassist.ComboContentAdapter;
-import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.jface.fieldassist.IContentProposalListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
@@ -58,19 +54,7 @@ public class VocabularyComboElement<TERM extends DefinedTermBase<TERM>, VOC exte
 
         combo.addSelectionListener(this);
         combo.addDisposeListener(this);
-        ContentProposalAdapter adapter;
-
-        adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), getProposalProvider(), null, null);
-        adapter.setPropagateKeys(true);
-        adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-        adapter.addContentProposalListener(new IContentProposalListener() {
-
-            @Override
-            public void proposalAccepted(IContentProposal proposal) {
-                setSelection((VOC)combo.getData(proposal.getContent()));
-                firePropertyChangeEvent(new CdmPropertyChangeEvent(getComboElement(), null));
-            }
-        });
+        addContentProposalAdapter();
 
         PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
 
@@ -79,7 +63,9 @@ public class VocabularyComboElement<TERM extends DefinedTermBase<TERM>, VOC exte
         }
 	}
 
-	/**
+
+
+    /**
 	 * <p>Sets the selection of the combo to the given T object.</p>
 	 * <p>Passing <code>null</code> to this method will set the selection to
 	 * the empty element and effectively clear the selection</p>
@@ -252,8 +238,4 @@ public class VocabularyComboElement<TERM extends DefinedTermBase<TERM>, VOC exte
         combo.remove(EMPTY_ELEMENT_LABEL);
     }
 
-    private VocabularyComboElement<TERM, VOC> getComboElement(){
-        return this;
-    }
-
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/term/TermComboElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/term/TermComboElement.java
index a9f423dde..fa7a66232 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/term/TermComboElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/term/TermComboElement.java
@@ -127,6 +127,8 @@ public class TermComboElement<T extends DefinedTermBase>
 
         combo.addSelectionListener(this);
         combo.addDisposeListener(this);
+
+        addContentProposalAdapter();
         PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this);
 
         if (selection != null) {
