Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How do i get the styling engine for non e4 projects
How do i get the styling engine for non e4 projects [message #1860472] Tue, 08 August 2023 12:45 Go to next message
Eclipse UserFriend
I'm attempting to take an existing plugin and have it honor the dark and light themes. The plugin is not an e4 plugin. I'm having trouble figuring out how to get the styling engine. In an e4 project it looks easy, you just use injection. Here is my lame attempt that didn't work

I'm using Eclipse 4.26

		IEclipseContext context = Workbench.getInstance().getContext();
		IStylingEngine iStylingEngine = null;
		if (context != null)
			iStylingEngine = context.get(IStylingEngine.class);
		System.out.println(iStylingEngine);


The styling engine comes back as null. This wouldn't be a great solution even if it worked, the Workbench.getInstance() is not public API.

How do I get the styling engine?
Re: How do i get the styling engine for non e4 projects [message #1860473 is a reply to message #1860472] Tue, 08 August 2023 13:18 Go to previous message
Eclipse UserFriend
This seems to work.
		
		IStylingEngine iStylingEngine = null;
		Optional<MApplication> optApplication = PlatformUI.getApplication();
		if (optApplication.isPresent()) {
			MApplication application = optApplication.get();
			IEclipseContext context = application.getContext();
			if (context != null)
				iStylingEngine = context.get(IStylingEngine.class);
		}
		System.out.println(iStylingEngine);
Previous Topic:How to assign a issue from eclipse platform github to myself
Next Topic:IntelOne Mono font incorrectly rendered
Goto Forum:
  


Current Time: Sat Jun 21 17:28:50 EDT 2025

Powered by FUDForum. Page generated in 0.03963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top