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 08e119acab58d43971d779105b407b49798fb316..8233285538a3950e39fc62dc88dc8245d8db9b5a 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 9c8d8014b5761ce5898ac4f7e690211ca31885f0..a7cc8010170345968144b529f846e4992353f915 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());
        }