From 8cb4b748ece8147b3d5b525939e78680450ae671 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 22 Oct 2020 11:11:50 +0200 Subject: [PATCH] Get CmsView directly from Control. --- org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java | 4 ++-- org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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; } -- 2.30.2