cleanup
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / name / AbstractTypeDesignationElement.java
index dfc869ed1345885259625b365f61d6e470c932aa..1598219640bdde67ba855b8c3ae0a9e7037eaa65 100644 (file)
@@ -6,7 +6,6 @@
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.taxeditor.ui.section.name;
 
 import java.util.Iterator;
@@ -17,7 +16,6 @@ import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.common.IdentifiableSource;
 import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -31,16 +29,16 @@ import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractSourcedEntityBaseE
 import eu.etaxonomy.taxeditor.ui.section.supplemental.SourceSection;
 
 /**
- * <p>Abstract AbstractTypeDesignationElement class.</p>
- *
  * @author n.hoffmann
  * @created May 17, 2010
- * @version 1.0
  */
-public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase> extends AbstractSourcedEntityBaseElement<T> {
+public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBase>
+        extends AbstractSourcedEntityBaseElement<T> {
+
+    @SuppressWarnings("unused")
+    private static final Logger logger = LogManager.getLogger(AbstractTypeDesignationElement.class);
 
-       private static final Logger logger = LogManager.getLogger(AbstractTypeDesignationElement.class);
-       protected CheckboxElement checkbox_notDesignated;
+    protected CheckboxElement checkbox_notDesignated;
 //     protected EntitySelectionElement<Reference> selection_reference;
 //    protected TextWithLabelElement text_referenceDetail;
        protected OriginalSourceElement singleSourceElement;
@@ -48,23 +46,13 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
     protected ICdmFormElement formElement;
     protected int style;
 
-       /**
-        * <p>Constructor for AbstractTypeDesignationElement.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param entity a T object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        * @param <T> a T object.
-        */
+
        public AbstractTypeDesignationElement(CdmFormFactory formFactory,
                        AbstractFormSection section, T entity,
                        SelectionListener removeListener, int style) {
                super(formFactory, section, entity, removeListener, style);
        }
 
-       /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement formElement, int style) {
            checkbox_notDesignated = formFactory.createCheckbox(formElement, "Not Designated", false, style);
@@ -111,12 +99,11 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
            if (entity.hasDesignationSource()){
             singleSourceElement.setEntity(entity.getDesignationSource(true));
         }
-           
+
            sourceSection = formFactory.createSourceSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(SourceSection.class, IdentifiableSource.class.getCanonicalName()));
         sourceSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
         sourceSection.setEntity(entity);
         StoreUtil.reflowParentScrolledForm(getLayoutComposite(), true);
-        
        }
 
        /**
@@ -124,10 +111,8 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
      */
     protected void updateContent() {
       // if (this.getParentElement() instanceof NameDetailSection
-
     }
 
-
     public void removeReferenceControls(){
         for (Iterator<ICdmFormElement> iterator = getElements().iterator();iterator.hasNext();) {
             ICdmFormElement childElement = iterator.next();
@@ -147,24 +132,23 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
 //                formFactory.removePropertyChangeListener(childElement);
 //                singleSourceElement = null;
 //           }
-          if (childElement instanceof OriginalSourceElement && ((OriginalSourceElement)childElement).equals(singleSourceElement)) {
-
-                  childElement.removeElements();
-
-                  // unregister selection arbitrator
-                  if(childElement instanceof ISelectableElement){
-                      SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator();
-                      if(selectionArbitrator != null){
-                          formFactory.destroySelectionArbitrator(selectionArbitrator);
-                      }
-                  }
-
-                  // unregister from property changes
-                  formFactory.removePropertyChangeListener(childElement);
-                  singleSourceElement = null;
-          }
-        }
+            if (childElement instanceof OriginalSourceElement && ((OriginalSourceElement)childElement).equals(singleSourceElement)) {
+
+                childElement.removeElements();
 
+                // unregister selection arbitrator
+                if(childElement instanceof ISelectableElement){
+                    SelectionArbitrator selectionArbitrator = ((ISelectableElement) childElement).getSelectionArbitrator();
+                    if(selectionArbitrator != null){
+                        formFactory.destroySelectionArbitrator(selectionArbitrator);
+                    }
+                }
+
+                // unregister from property changes
+                formFactory.removePropertyChangeListener(childElement);
+                singleSourceElement = null;
+            }
+        }
     }
 
     public void removeNotDesignatedControls(){
@@ -187,9 +171,7 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
                 checkbox_notDesignated = null;
                 break;
            }
-
         }
-
     }
 
     public void removeSourcesControls(){
@@ -215,10 +197,9 @@ public abstract class AbstractTypeDesignationElement<T extends TypeDesignationBa
                 sourceSection = null;
                 break;
            }
-
         }
-
     }
+
     @Override
     public void handleEvent(Object eventSource) {
 //        if (eventSource == selection_reference) {