commit 935960dca04075d4f594318e65fe92d44ab8babd
Author: Katja Luther <k.luther@bgbm.org>
Date:   Fri Nov 4 17:04:53 2016 +0100

    ref #6176: the referencingObjectsCount is only called for wizards not in details view

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
index e274fe48f..da9210ae7 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
@@ -10,7 +10,6 @@
 
 package eu.etaxonomy.taxeditor.ui.dialog.selection;
 
-import java.lang.reflect.Field;
 import java.text.Collator;
 import java.util.Comparator;
 import java.util.HashSet;
@@ -70,7 +69,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
 	private final Set<T> transientCdmObjects = new HashSet<T>();
 	private final String settings;
 	protected final int limitOfInitialElements = 100;
-	
+
 	protected T cdmBaseToBeFiltered;
 
 
@@ -277,19 +276,19 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog<T extends ICdmB
 		// and all the clever caching prevents the content provider from knowing that the model has changed
 		// I am aware, that this is a hack, but the FilteredSelectionDialog API does not offer a convenient
 		// way to solve the problem.
-		try {
-			Field lastCompletedFilter = this.getClass().getSuperclass().getSuperclass().getDeclaredField("lastCompletedFilter");
-			lastCompletedFilter.setAccessible(true);
-			lastCompletedFilter.set(this, null);
-		} catch (SecurityException e) {
-			MessagingUtils.error(getClass(), e);
-		} catch (NoSuchFieldException e) {
-			MessagingUtils.error(getClass(), e);
-		} catch (IllegalArgumentException e) {
-			MessagingUtils.error(getClass(), e);
-		} catch (IllegalAccessException e) {
-			MessagingUtils.error(getClass(), e);
-		}
+//		try {
+//			Field lastCompletedFilter = this.getClass().getSuperclass().getSuperclass().getDeclaredField("lastCompletedFilter");
+//			lastCompletedFilter.setAccessible(true);
+//			lastCompletedFilter.set(this, null);
+//		} catch (SecurityException e) {
+//			MessagingUtils.error(getClass(), e);
+//		} catch (NoSuchFieldException e) {
+//			MessagingUtils.error(getClass(), e);
+//		} catch (IllegalArgumentException e) {
+//			MessagingUtils.error(getClass(), e);
+//		} catch (IllegalAccessException e) {
+//			MessagingUtils.error(getClass(), e);
+//		}
 
 		// this also is not the nicest way to do it.
 		// I am still amazed, that FilteredSelectionDialog does not offer any methods to change its data
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmEntityWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmEntityWizardPage.java
index b017125b6..d2627cdf8 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmEntityWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/AbstractCdmEntityWizardPage.java
@@ -106,7 +106,7 @@ public abstract class AbstractCdmEntityWizardPage<T> extends WizardPage
 		Color bgColor = getShell().getBackground();
 
 		detailElement = createElement(rootElement);
-
+		
 		rootElement.setBackground(bgColor);
 		control.setBackground(bgColor);
 		scrolledForm.setBackground(bgColor);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
index 13033b4e6..98dd0fc2b 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
@@ -2117,8 +2117,8 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style){
-        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style);
+    public ReferenceDetailElement createReferenceDetailElement(ICdmFormElement parentElement, int style, boolean isWizard){
+        ReferenceDetailElement element = new ReferenceDetailElement(this, parentElement, style, isWizard);
         addAndAdaptElement(parentElement, element);
         return element;
     }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
index b7c88adb0..88bd10190 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
@@ -79,6 +79,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
 	private EnumComboElement<ReferenceType> combo_referenceType;
 
 	private EntitySelectionElement<Reference> selection_inSeries;
+	private boolean isWizard;
 
 	/**
 	 * <p>
@@ -95,8 +96,9 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
 	 *            a int.
 	 */
 	public ReferenceDetailElement(CdmFormFactory cdmFormFactory,
-			ICdmFormElement formElement, int style) {
+			ICdmFormElement formElement, int style, boolean isWizard) {
 		super(cdmFormFactory, formElement);
+		this.isWizard = isWizard;
 	}
 
 	/*
@@ -112,7 +114,9 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
 			Reference entity, int style) {
 		ICdmFormElement o = this.getParentElement();
 		Class clazz=o.getClass();
-		setWarnForReferencingObjects(formElement);
+		if (isWizard){
+		    setWarnForReferencingObjects(formElement);
+		}
 
 
 		toggleable_cache = formFactory.createToggleableTextField(formElement,
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java
index 6a8f53dbb..2d21bf0cf 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailSection.java
@@ -94,7 +94,7 @@ public class ReferenceDetailSection extends AbstractCdmDetailSection<Reference>
 	 */
 	@Override
 	protected AbstractCdmDetailElement<Reference> createCdmDetailElement(AbstractCdmDetailSection<Reference> parentElement, int style) {
-	    return formFactory.createReferenceDetailElement(parentElement, style);
+	    return formFactory.createReferenceDetailElement(parentElement, style, false);
 	}
 
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
index 643c7d9d9..e6dfd0dc9 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceWizardPage.java
@@ -13,10 +13,7 @@ package eu.etaxonomy.taxeditor.ui.section.reference;
 import org.eclipse.swt.SWT;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.CommonServiceImpl;
-import eu.etaxonomy.cdm.api.service.ReferenceServiceImpl;
 import eu.etaxonomy.cdm.model.reference.Reference;
-import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -53,7 +50,7 @@ public class ReferenceWizardPage extends AbstractCdmEntityWizardPage<Reference>
 	@Override
     public AbstractCdmDetailElement<Reference> createElement(ICdmFormElement rootElement){
 		//TODO: looking for referencing objects
-		ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL);
+		ReferenceDetailElement referenceElement = formFactory.createReferenceDetailElement(rootElement, SWT.NULL, true);
 		referenceElement.addExceptionHandler(this);
 		referenceElement.setEntity(entity);
 		referenceElement.setWarnForReferencingObjectsVisible(true);
