Bugfix for a problem that was introduced by fixing #2545
authorn.hoffmann <n.hoffmann@localhost>
Wed, 5 Oct 2011 14:21:05 +0000 (14:21 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 5 Oct 2011 14:21:05 +0000 (14:21 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractFormSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/DateDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/VersionSection.java

index 89a1f1b21454a788d036585df1eaa50fed116f6a..b52d87de5767730db7f5378abec18337fbe35d73 100644 (file)
@@ -61,10 +61,6 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
 
        private ICdmFormElement parentElement;
 
-       private ConversationHolder conversation;
-
-       private boolean handlingPropertyChange;
-
        private Color persistentBackgroundColor;
 
        /**
@@ -85,8 +81,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
         * @param <ENTITY>
         *            a ENTITY object.
         */
-       protected AbstractFormSection(CdmFormFactory formFactory,
-                       ConversationHolder conversation, ICdmFormElement parentElement,
+       protected AbstractFormSection(CdmFormFactory formFactory, ICdmFormElement parentElement,
                        int style) {
                super(parentElement.getLayoutComposite(), style);
 
@@ -94,8 +89,6 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
 
                this.formFactory = formFactory;
 
-               this.conversation = conversation;
-
                this.setLayoutData(CdmFormFactory.FILL());
 
                Composite client = formFactory.createComposite(this, SWT.WRAP);
@@ -130,9 +123,9 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
         *            a int.
         */
        protected AbstractFormSection(CdmFormFactory formFactory,
-                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
-               this(formFactory, conversation, parentElement, style);
+               this(formFactory, parentElement, style);
                this.selectionProvider = selectionProvider;
        }
 
@@ -557,19 +550,21 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements
         *         object.
         */
        public ConversationHolder getConversationHolder() {
-               IEditorPart activeEditor = StoreUtil.getActiveEditor();
-               if(activeEditor instanceof IConversationEnabled){
-                       ConversationHolder conversation = ((IConversationEnabled) StoreUtil.getActiveEditor()).getConversationHolder();
-                       return conversation;
+               if(getParentElement() == null){
+               
+                       IEditorPart activeEditor = StoreUtil.getActiveEditor();
+                       if(activeEditor instanceof IConversationEnabled){
+                               ConversationHolder conversation = ((IConversationEnabled) StoreUtil.getActiveEditor()).getConversationHolder();
+                               return conversation;
+                       }
+               }else if(getParentElement() instanceof IConversationEnabled){
+                       return ((IConversationEnabled) getParentElement()).getConversationHolder();
                }
                StoreUtil.errorDialog("Could not get conversation for AbstractFormSection", 
                                getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't", 
                                new IllegalArgumentException());
                return null;
-       }
        
-       public void setConversationHolder(ConversationHolder conversation) {
-               this.conversation = conversation;
        }
 
        /** {@inheritDoc} */
index a7789dc8ec8effcfe8b9ec384b9527ef2a9af723..a9126105d4df4d4cac70971e0c4e550d4aa74502 100644 (file)
@@ -50,7 +50,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
         */
        protected DateDetailSection(CdmFormFactory formFactory,
                        ICdmFormElement parentElement, int style) {
-               super(formFactory, null, parentElement, style);
+               super(formFactory, parentElement, style);
 
                partialElement_start = formFactory.createPartialElement(this,
                                "Start: ", null, style);
index 7c07ce08cd6341d4605f7058f10a50134eaf3370..bb8514339623eb6d16d6129fc3f4c244c4bd26a6 100644 (file)
@@ -68,7 +68,7 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends
        public AbstractCdmDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
                        ISelectionProvider selectionProvider, int style) {
-               super(formFactory, conversation, parentElement, selectionProvider,
+               super(formFactory, parentElement, selectionProvider,
                                Section.CLIENT_INDENT | style);
 
                setText(getHeading());
index e3369c47b93aadb27babd52a9b655c5a98b84165..69f4921f012d60c72ce13aafa44746ff9098e2db 100644 (file)
@@ -59,7 +59,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         * @param <ELEMENT> a ELEMENT object.
         */
        public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
-               super(formFactory, conversation, parentElement, Section.CLIENT_INDENT | style);
+               super(formFactory, parentElement, Section.CLIENT_INDENT | style);
                this.title = title;
                this.setText(getTitleString());
                showToolbar();
index 8c5f93b24d713c2d1c07fe9cb2ab01bdf0e579d5..c709959df9c7b6afdebd4c495807f68a5aa6e45f 100644 (file)
@@ -28,7 +28,7 @@ public class HeadlineSection extends AbstractFormSection<ICdmBase> {
         */
        public HeadlineSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
                        int style) {
-               super(cdmFormFactory, null, parentElement, style);
+               super(cdmFormFactory, parentElement, style);
        }
        
        /** {@inheritDoc} */
index 58cbef452db2f80746736097bd3f2f730678413c..ee4f1afbc71f5810127a9fef0adca7653699194e 100644 (file)
@@ -10,8 +10,6 @@
 
 package eu.etaxonomy.taxeditor.ui.section.supplemental;
 
-import org.apache.log4j.Logger;
-
 import eu.etaxonomy.cdm.model.common.VersionableEntity;
 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
@@ -26,7 +24,6 @@ import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
  */
 public class VersionSection extends AbstractFormSection<VersionableEntity>{
 
-       private static final Logger logger = Logger.getLogger(VersionSection.class);
        private VersionElement versionElement;
        
        /**
@@ -38,7 +35,7 @@ public class VersionSection extends AbstractFormSection<VersionableEntity>{
         */
        public VersionSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
                        int style) {
-               super(cdmFormFactory, null, parentElement, style);
+               super(cdmFormFactory, parentElement, style);
                versionElement = cdmFormFactory.createVersionElement(this, null, style);
        }