Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Disabled icons in application model
Disabled icons in application model [message #1403088] Mon, 21 July 2014 09:59 Go to next message
Karl Puperze is currently offline Karl PuperzeFriend
Messages: 36
Registered: August 2011
Member
I can add an icon URI HandleToolItem. Where can I add the disabled icon? I only get the OS grayed icons.

[Updated on: Mon, 21 July 2014 10:02]

Report message to a moderator

Re: Disabled icons in application model [message #1403251 is a reply to message #1403088] Tue, 22 July 2014 16:06 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 757
Registered: January 2012
Senior Member

You can add hints to the MHandledToolItem's transientData using the keys defined on
org.eclipse.e4.ui.workbench.IPresentationEngine#DISABLED_ICON_IMAGE_KEY
.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Disabled icons in application model [message #1403349 is a reply to message #1403251] Wed, 23 July 2014 07:08 Go to previous messageGo to next message
Karl Puperze is currently offline Karl PuperzeFriend
Messages: 36
Registered: August 2011
Member
I know that, but I want to add this information at modeling time (in the application model). Transient data is available at runtime only.
Re: Disabled icons in application model [message #1404094 is a reply to message #1403349] Tue, 29 July 2014 15:13 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 757
Registered: January 2012
Senior Member

That's a good point: please file a bug.

Brian.


Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Disabled icons in application model [message #1754233 is a reply to message #1404094] Wed, 15 February 2017 15:29 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 840
Registered: July 2009
Senior Member
Filed bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=512238

Brian de Alwis wrote on Tue, 29 July 2014 17:13
That's a good point: please file a bug.

Brian.

Re: Disabled icons in application model [message #1771855 is a reply to message #1754233] Thu, 31 August 2017 12:40 Go to previous message
Guido Schnepp is currently offline Guido SchneppFriend
Messages: 10
Registered: March 2013
Junior Member
Hello,

for my own reference and as a possible solution to others. I've found a workaround where the disabled Icon URI can be set in the application model similar to the normal icon URI:

Add a tag on the Supplementary tab like:

e4_disabled_icon_image_key=platform:/plugin/de.credo.{...}/hand_touch.png


where e4_disabled_icon_image_key is the constant value for IPresentationEngine.DISABLED_ICON_IMAGE_KEY. Do this with all of your icons which require special disabled icon versions.

Place the following code for example in the @PostConstruct routine of your part's code, inject MWindow and you're done. This routine copies tag values with known names (here: IPresentationEngine.DISABLED_ICON_IMAGE_KEY) to the relevant TransientData map.

	for (MTrimBar trimBar: window.getTrimBars()) {
		for (MTrimElement toolBar: trimBar.getChildren()) {
			if (toolBar instanceof MToolBar) {
				for (MToolBarElement toolBarElement: ((MToolBar) toolBar).getChildren()) {
					for (String tag: toolBarElement.getTags()) {
						if (tag.startsWith(IPresentationEngine.DISABLED_ICON_IMAGE_KEY)) {
							String disabledIconURI = tag.substring(IPresentationEngine.DISABLED_ICON_IMAGE_KEY.length() + 1);
							toolBarElement.getTransientData().put(IPresentationEngine.DISABLED_ICON_IMAGE_KEY, disabledIconURI);
						}
					}
				}
			}
		}
	}


Regards
Guido
Previous Topic:Preferences IPropertyChangeListener
Next Topic:Key bindings scheme
Goto Forum:
  


Current Time: Mon Jun 25 02:49:58 GMT 2018

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

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

Back to the top