Fix class cast and widget disposed exception
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 22 Mar 2016 13:58:47 +0000 (14:58 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 22 Mar 2016 13:58:47 +0000 (14:58 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java

index 08e119a..8233285 100644 (file)
@@ -101,7 +101,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                if(isChoosableEntity){
                    btnChooseEntity = formFactory.createButton(box, null, SWT.PUSH);
                    addControl(btnChooseEntity);
-                   
+
                    btnChooseEntity.setLayoutData(LayoutConstants.RIGHT());
                    btnChooseEntity.setImage(ImageResources.getImage(ImageResources.BROWSE_ICON));
                    btnChooseEntity.setToolTipText("Browse");
@@ -117,7 +117,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                                    ((AbstractEntityCollectionSection)getParentElement()).addElement(entity);
                                    ((AbstractEntityCollectionSection)getParentElement()).firePropertyChangeEvent(getParentElement());
                                }
-                               
+
                            }
                        }
                    });
@@ -199,6 +199,9 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
        /** {@inheritDoc} */
        @Override
     public void setBackground(Color color) {
+           if(box.isDisposed() || container.isDisposed()){
+               return;
+           }
                backgroundColor = color;
                super.setBackground(color);
                box.setBackground(color);
index 9c8d801..a7cc801 100644 (file)
@@ -62,8 +62,8 @@ public class SpecimenTypeDesignationElement extends
                super.setEntity(entity);
                selection_typeSpecimen.setEntity(entity.getTypeSpecimen());
 
-               SpecimenTypeDesignationStatus typeStatus = (SpecimenTypeDesignationStatus) HibernateProxyHelper
-                               .deproxy(entity.getTypeStatus());
+               SpecimenTypeDesignationStatus typeStatus = HibernateProxyHelper
+                               .deproxy(entity.getTypeStatus(), SpecimenTypeDesignationStatus.class);
                combo_typeStatus.setSelection(typeStatus);
                checkbox_notDesignated.setSelection(entity.isNotDesignated());
        }