Get CmsView directly from Control.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 22 Oct 2020 09:11:50 +0000 (11:11 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 22 Oct 2020 09:11:50 +0000 (11:11 +0200)
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java
org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java

index b403a2088d33fbfcb703c49c1bdf11762eca4b6d..311d10fbe9d22f2c1db2db8e9f55d14a9db7a850 100644 (file)
@@ -5,7 +5,7 @@ import java.util.Map;
 
 import javax.security.auth.login.LoginContext;
 
-import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 
 /** Provides interaction with the CMS system. */
@@ -56,7 +56,7 @@ public interface CmsView {
                
        }
 
-       static CmsView getCmsView(Composite parent) {
+       static CmsView getCmsView(Control parent) {
                // find parent shell
                Shell topShell = parent.getShell();
                while (topShell.getParent() != null)
index 5d6030ec4b72aa6de533281405ef7fff89eacd91..e9ca4e5be53fc73cec93fca5136a9225e3bc895c 100644 (file)
@@ -182,8 +182,9 @@ public class CmsUiUtils implements CmsConstants {
                if (style == null)
                        return widget;// does nothing
                EclipseUiSpecificUtils.setStyleData(widget, style);
-               if (widget instanceof Control)
-                       CmsView.getCmsView(((Control) widget).getParent()).applyStyles(widget);
+               if (widget instanceof Control) {
+                       CmsView.getCmsView((Control) widget).applyStyles(widget);
+               }
                return widget;
        }