commit f03073b94c83da569655edb01682d8b6644542d2
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Thu May 3 12:26:56 2018 +0200

    ref #6746 Disable protect titleCache button for feature tree DetailsView

diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java
index 2f8ba06a6..3bd78fc12 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ToggleableTextElement.java
@@ -25,9 +25,9 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Text;
 
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.preference.Resources;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
  * When the button is pressed, this textfield may be edited.
@@ -39,7 +39,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 public class ToggleableTextElement extends AbstractCdmFormElement implements SelectionListener, ModifyListener, IEnableableFormElement, ISelectable {
 
 	private final Text text_cache;
-	private final Button button_toggle;
+	private final Button btnToggleProtectTitleCache;
 	private boolean state;
 	private final Set<SelectionListener> selectionListener = new HashSet<SelectionListener>();
 	private final Label label;
@@ -48,22 +48,11 @@ public class ToggleableTextElement extends AbstractCdmFormElement implements Sel
 	//TODO for RL
 	public void setVisible(boolean b) {
 		text_cache.setVisible(b);
-		button_toggle.setVisible(b);
+		btnToggleProtectTitleCache.setVisible(b);
 		label.setVisible(b);
 		container.setVisible(b);
-	}	
-	
-	
-	/**
-	 * <p>Constructor for ToggleableTextElement.</p>
-	 *
-	 * @param style a int.
-	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
-	 * @param labelString a {@link java.lang.String} object.
-	 * @param initialText a {@link java.lang.String} object.
-	 * @param initialState a boolean.
-	 */
+	}
+
 	protected ToggleableTextElement(CdmFormFactory formFactory, ICdmFormElement parentElement,
 			String labelString, String initialText, boolean initialState, int style) {
 		super(formFactory, parentElement);
@@ -91,20 +80,15 @@ public class ToggleableTextElement extends AbstractCdmFormElement implements Sel
 			}
 		});
 
-		button_toggle = formFactory.createButton(container, "Edit", SWT.TOGGLE);
-		button_toggle.setText("");
-		button_toggle.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
-		addControl(button_toggle);
-		button_toggle.addSelectionListener(this);
+		btnToggleProtectTitleCache = formFactory.createButton(container, "Edit", SWT.TOGGLE);
+		btnToggleProtectTitleCache.setText("");
+		btnToggleProtectTitleCache.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
+		addControl(btnToggleProtectTitleCache);
+		btnToggleProtectTitleCache.addSelectionListener(this);
 
 		setState(initialState);
 	}
 
-	/**
-	 * <p>setText</p>
-	 *
-	 * @param text a {@link java.lang.String} object.
-	 */
 	public void setText(String text){
 		if(text != null){
 			// store current caret position
@@ -119,101 +103,69 @@ public class ToggleableTextElement extends AbstractCdmFormElement implements Sel
 		}
 	}
 
-	/**
-	 * <p>getText</p>
-	 *
-	 * @return a {@link java.lang.String} object.
-	 */
 	public String getText(){
 		return text_cache.getText();
 	}
 
-	/**
-	 * <p>Setter for the field <code>state</code>.</p>
-	 *
-	 * @param state a boolean.
-	 */
 	private void setState(boolean state) {
 	    if(state){
-	        button_toggle.setImage(ImageResources.getImage(ImageResources.LOCK_OPEN_ICON));
+	        btnToggleProtectTitleCache.setImage(ImageResources.getImage(ImageResources.LOCK_OPEN_ICON));
 	    }
 	    else{
-	        button_toggle.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
+	        btnToggleProtectTitleCache.setImage(ImageResources.getImage(ImageResources.LOCK_ICON));
 	    }
 	   setEnabled(state);
 		this.state = state;
 	}
 
-	/** {@inheritDoc} */
 	@Override
     public void setEnabled(boolean enabled) {
 		text_cache.setEnabled(enabled);
-       	button_toggle.setGrayed(enabled);
-		button_toggle.setSelection(enabled);
-		Color color = enabled ? null : StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED);
-		
+       	btnToggleProtectTitleCache.setGrayed(enabled);
+		btnToggleProtectTitleCache.setSelection(enabled);
+		Color color = enabled ? null : AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED);
+
 		text_cache.setForeground(color);
 	}
 
-	/* (non-Javadoc)
-	 * @see eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement#isEnabled()
-	 */
 	@Override
 	public boolean isEnabled() {
 	    return text_cache.isEnabled();
 	}
 
-	/**
-	 * <p>Getter for the field <code>state</code>.</p>
-	 *
-	 * @return a boolean.
-	 */
 	public boolean getState(){
 		return state;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-	 */
-	/** {@inheritDoc} */
+    public Button getBtnToggleProtectTitleCache() {
+        return btnToggleProtectTitleCache;
+    }
+
 	@Override
     public void widgetSelected(SelectionEvent e) {
-		setState(button_toggle.getSelection());
+		setState(btnToggleProtectTitleCache.getSelection());
 		for(SelectionListener listener : selectionListener){
 			listener.widgetSelected(e);
 		}
 		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
 	}
 
-	/**
-	 * <p>addSelectionListener</p>
-	 *
-	 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
-	 */
 	public void addSelectionListener(SelectionListener listener){
 		selectionListener.add(listener);
 	}
 
-	/**
-	 * <p>removeSelectionListener</p>
-	 *
-	 * @param listener a {@link org.eclipse.swt.events.SelectionListener} object.
-	 */
 	public void removeSelectionListener(SelectionListener listener){
 		selectionListener.remove(listener);
 	}
 
-	/** {@inheritDoc} */
 	@Override
     public void widgetDefaultSelected(SelectionEvent e) {}
 
-	/** {@inheritDoc} */
 	@Override
     public void modifyText(ModifyEvent e) {
 		firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e));
 	}
 
-	/** {@inheritDoc} */
 	@Override
     public void setIrrelevant(boolean irrelevant) {
 		String colorId = irrelevant ? Resources.COLOR_COMPOSITE_IRRELEVANT : Resources.COLOR_COMPOSITE_BACKGROUND;
@@ -222,7 +174,6 @@ public class ToggleableTextElement extends AbstractCdmFormElement implements Sel
 		text_cache.setBackground(color);
 	}
 
-	/** {@inheritDoc} */
 	@Override
 	public void setBackground(Color color) {
 		label.setBackground(color);
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureTreeDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureTreeDetailElement.java
index 32686f6da..3be5dd4f4 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureTreeDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureTreeDetailElement.java
@@ -32,11 +32,9 @@ public class FeatureTreeDetailElement extends AbstractIdentifiableEntityDetailEl
 	    toggleable_cache = formFactory.createToggleableTextField(
                 formElement, "Title Cache", entity.getTitleCache(),
                 entity.isProtectedTitleCache(), style);
+	    toggleable_cache.getBtnToggleProtectTitleCache().setEnabled(false);
     }
 
-	/**
-	 * {@inheritDoc}
-	 */
 	@Override
 	protected void updateControlStates() {
 	    super.updateControlStates();
