commit c6df1ae1055136d586462e88fea5ed96e57b2b67
Author: Katja Luther <k.luther@bgbm.org>
Date:   Tue May 18 09:47:17 2021 +0200

    ref #8471: allow delete again and disable description parts

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
index 69c6fa44d..6976a536d 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java
@@ -210,14 +210,6 @@ public class DeleteHandlerE4 {
             IStructuredSelection sel = (IStructuredSelection) selection;
             if (sel.getFirstElement() instanceof FeatureNodeContainer){
                 canExecute = false;
-            }else if (sel.getFirstElement() instanceof DescriptionBase){
-                if (((DescriptionBase)sel.getFirstElement()).isComputed()){
-                    canExecute = false;
-                }
-            }else if (sel.getFirstElement() instanceof DescriptionElementBase){
-                if (((DescriptionElementBase)sel.getFirstElement()).getInDescription().isComputed()){
-                    canExecute = false;
-                }
             }
 
         }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java
index bc63f9883..3aac26cc3 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java
@@ -34,12 +34,14 @@ public class DescriptionDetailElement
 	public DescriptionDetailElement(CdmFormFactory cdmFormFactory,
 			ICdmFormElement formElement, int style) {
 		super(cdmFormFactory, formElement);
+		setEnabled(enabled);
 	}
 
 	@Override
 	protected void createControls(ICdmFormElement formElement, DescriptionBase entity, int style) {
         toggleable_cache = formFactory.createToggleableTextField(this, "Label",
                 entity.getTitleCache(), entity.isProtectedTitleCache(), style);
+        toggleable_cache.setEnabled(!entity.isComputed());
 		// TODO I initially thought that we can handle the entity's descriptive system with a feature tree
 		// Since descriptiveSystem is a Set of Features that are present or allowed for the current description,
 		// it is similar to a FeatureTree (you can get this information from a feature tree) but not the same.
@@ -54,23 +56,18 @@ public class DescriptionDetailElement
 
 	}
 
-	@Override
-    protected void updateControlStates(){
+//	@Override
+//    protected void updateControlStates(){
+//
+//        if (getEntity().isComputed()){
+//            enabled = false;
+//         }else{
+//            enabled = true;
+//        }
+//        setEnabled(enabled);
+//    }
 
-        if (getEntity().isComputed()){
-            enabled = false;
-         }else{
-            enabled = true;
-        }
-        setEnabled(enabled);
-    }
 
-    @Override
-    protected void updateContent() {
-        super.updateContent();
-        toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
-        updateCacheRelevance();
-    }
 
     @Override
     protected void handleTitleCacheRelevantChange(PropertyChangeEvent event) {
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java
index 3ac82dc41..fab31fc32 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailSection.java
@@ -50,4 +50,14 @@ public class DescriptionDetailSection extends AbstractCdmDetailSection<Descripti
 	protected AbstractCdmDetailElement<DescriptionBase<?>> createCdmDetailElement(AbstractCdmDetailSection<DescriptionBase<?>> parentElement, int style) {
 	    return formFactory.createDescriptionDetailElement(parentElement, style);
 	}
+
+	@Override
+    public void setEntity(DescriptionBase<?> entity) {
+	    super.setEntity(entity);
+
+	    if (entity.isComputed()){
+	        setEnabled(false);
+	        this.getDetailElement().setEnabled(false);
+	    }
+	}
 }
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
index 7535741ae..d6adc4f4b 100755
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
@@ -286,10 +286,10 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
                 } else if (isUseDescription) {
                     createUseDescriptionSection(rootElement);
                 } else if (input instanceof TaxonDescription){
-                    createTaxonDescriptionSection(rootElement);
+                    createTaxonDescriptionSection(rootElement, !((DescriptionBase) input).isComputed());
 
                 } else{
-                    createDescriptionSection(rootElement, false);
+                    createDescriptionSection(rootElement, false, !((DescriptionBase) input).isComputed());
                 }
             }
         } else if (input instanceof DescriptionElementBase){
@@ -653,8 +653,9 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         addPart(descriptionElementMediaSection);
     }
 
-    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription) {
+    private void createDescriptionSection(RootElement parent, boolean isTaxonDescription, boolean isEnabled) {
         DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, StoreUtil.getSectionStyle(DescriptionDetailSection.class, getInput().getClass().getCanonicalName(), true));
+        descriptionDetailSection.setEnabled(isEnabled);
         addPart(descriptionDetailSection);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
@@ -663,26 +664,29 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
             NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(
                     getConversationHolder(), parent, this, StoreUtil.getSectionStyle(NaturalLanguageSection.class, getInput().getClass().getCanonicalName(), true));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+            naturalLanguageSection.setEnabled(isEnabled);
             addPart(naturalLanguageSection);
         }
         DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(
                 getConversationHolder(), parent, StoreUtil.getSectionStyle(DescriptionSourceSection.class, getInput().getClass().getCanonicalName(), true));
+        descriptionSourceSection.setEnabled(isEnabled);
         addPart(descriptionSourceSection);
 
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
         if(isTaxonDescription) {
             ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, StoreUtil.getSectionStyle(ScopeSection.class, getInput().getClass().getCanonicalName()));
+            scopeSection.setEnabled(isEnabled);
             addPart(scopeSection);
         }
     }
 
-    private void createTaxonDescriptionSection(RootElement parent) {
-        createDescriptionSection(parent, true);
+    private void createTaxonDescriptionSection(RootElement parent, boolean isEnabled) {
+        createDescriptionSection(parent, true, isEnabled);
     }
 
     private void createSpecimenDescriptionSection(RootElement parent) {
-        createDescriptionSection(parent, false);
+        createDescriptionSection(parent, false, true);
     }
 
     private void createUseDescriptionSection(RootElement parent) {
