Make logging less verbose and better check disposed status of widgets
[lgpl/argeo-commons.git] / swt / org.argeo.cms.swt / src / org / argeo / cms / swt / CmsSwtUtils.java
index 3a91dbc23dc5db5db2c7569f75d00a272b3f8d42..d97bc4c35ad2bb89b81663e7d17d15899fd8ded0 100644 (file)
@@ -61,6 +61,8 @@ public class CmsSwtUtils {
        }
 
        public static CmsView getCmsView(Control parent) {
+               if (parent.isDisposed())
+                       return null;
                // find parent shell
                Shell topShell = parent.getShell();
                while (topShell.getParent() != null)
@@ -219,7 +221,7 @@ public class CmsSwtUtils {
 
        /** Style widget */
        public static <T extends Widget> T style(T widget, String style) {
-               if (style == null)
+               if (style == null || widget.isDisposed())
                        return widget;// does nothing
                EclipseUiSpecificUtils.setStyleData(widget, style);
                if (widget instanceof Control) {