Bug 501163 - E4 needs to have public API to set element id (and asking for it to be restyled).
Summary: E4 needs to have public API to set element id (and asking for it to be restyl...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 465666
  Show dependency tree
 
Reported: 2016-09-09 13:18 EDT by Fabio Zadrozny CLA
Modified: 2020-03-02 08:41 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Zadrozny CLA 2016-09-09 13:18:35 EDT
Sometimes, elements are not reachable in a meaningful way, so, this is a request to make it possible to set the id of some element and ask it to be restyled.

I.e.: something as:

public class Styling {

	/**
	 * Sets the css id for some widget and asks the theme engine to restyle it (and optionally its
	 * children too).
	 * 
	 * @param widget the control which we want to style
	 * @param id the id we want to set (which can later be referred in CSS -- for instance, setting
	 *            the id as MyClassId, it's possible to style the widget later on through
	 *            #MyClassId).
	 * @param applyToChildren whether the style should be reapplied to children.
	 */
	public static void setCssId(Object widget, String id, boolean applyToChildren) {
		IStylingEngine engine= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IStylingEngine.class);
		if (engine != null) {
			engine.setId(widget, id);
			IThemeEngine themeEngine= (IThemeEngine) Display.getDefault().getData(
					"org.eclipse.e4.ui.css.swt.theme"); //$NON-NLS-1$
			themeEngine.applyStyles(widget, applyToChildren);
		}
	}
}


in a project which has a public API (the css theming plugins currently don't have a public API, so, it may be needed to create a project for this, or at least, make a part of it API).

This is a pre-requisite for https://bugs.eclipse.org/bugs/show_bug.cgi?id=465666
Comment 1 Eclipse Genie CLA 2020-03-02 08:41:14 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.