From: Mathieu Baudier Date: Thu, 22 Oct 2020 09:11:50 +0000 (+0200) Subject: Get CmsView directly from Control. X-Git-Tag: argeo-commons-2.1.89~60 X-Git-Url: http://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=8cb4b748ece8147b3d5b525939e78680450ae671 Get CmsView directly from Control. --- diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java index b403a2088..311d10fbe 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java @@ -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) diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java index 5d6030ec4..e9ca4e5be 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java @@ -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; }