Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Question regarding theming

Dear Fabio,

 

thanks for your answer. In the below code snippet, there you use a class called “UIUtils”. This does not seem to be part of the eclipse platform code.

What does UIUtils.getActiveWorkbenchWindow() do?

 

Is the engine.setId(control, id); call optional?

 

If this is the “preferred” way then we should think about providing something similar as official API.

 

Regards,

Matthias

 

Matthias Becker

Development, PI Tech Core ABAP Server (SE)

SAP SE, Dietmar-Hopp-Allee 16, 69190 Walldorf, Germany

 

T +49 6227 7-60223, M +49 151 53858523, E ma.becker@xxxxxxx

 

 

Pflichtangaben/Mandatory Disclosure Statement:

http://www.sap.com/company/legal/impressum.epx/

 

Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.

 

This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

 

 

From: <platform-ui-dev-bounces@xxxxxxxxxxx> on behalf of Fabio Zadrozny <fabiofz@xxxxxxxxx>
Reply-To: "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
Date: Wednesday, 28. June 2017 at 13:02
To: "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
Subject: Re: [platform-ui-dev] Question regarding theming

 

Hi Matthias,

 

Not sure if there's a better way, but you can ask any control to be reskinned by using:

 

IThemeEngine themeEngine = (IThemeEngine) Display.getDefault().getData("org.eclipse.e4.ui.css.swt.theme");

themeEngine.applyStyles(control, applyToChildren);

 

On PyDev I have a utility method that does:

 

    @SuppressWarnings("restriction")

    public static void setCssId(Object control, String id, boolean applyToChildren) {

        IStylingEngine engine = (IStylingEngine) UIUtils.getActiveWorkbenchWindow().

                getService(IStylingEngine.class);

        if (engine != null) {

            engine.setId(control, id);

            IThemeEngine themeEngine = (IThemeEngine) Display.getDefault().getData(

                    "org.eclipse.e4.ui.css.swt.theme");

            themeEngine.applyStyles(control, applyToChildren);

        }

    }

 

So, you can set a given id to some widget (so that you can use specific selectors on the css theme) and ask it to be reskinned...

 

The only annoying thing is that org.eclipse.e4.ui.css.swt.theme.IThemeEngine is not considered to be an API... when I added that code back in 2013 I'm sure there wasn't a better way, but maybe someone else can provide a better API today?

 

Cheers,

 

Fabio

 


Back to the top