Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Editor toolbar action visibility
Editor toolbar action visibility [message #493141] Fri, 23 October 2009 11:20 Go to next message
Matthew Dickie is currently offline Matthew DickieFriend
Messages: 56
Registered: July 2009
Member
Hi all,

I have an editor action that I would like to be visible on the toolbar
only when my editor is active. I am using the old-fashioned
org.eclipse.ui.actionSets extension point. I used JDT's toggle
Breakcrumb action as my template, as that behaves in the way that I
desire. This has retarget="true", and no class defined. The editor then
registers a global action handler for this action. Unfortunatly, my
action always seems to be visible, even it is disabled when my editor is
not active. I can't see what I am doing differently. Can anyone help?

Here is how I have declared my action:

<extension point="org.eclipse.ui.actionSets">

<actionSet
id="com.xyz.ui"
label="XYZ Actions"
visible="false">

<action
id="com.xyz.ui.toggleGridAction"
label="Toggle Grid"
style="toggle"
tooltip="Toggle Grid"

toolbarPath=" org.eclipse.ui.edit.text.actionSet.presentation/Presentation "
retarget="true">
</action>

</actionSet>

</extension>

P.S. If anyone can show me how to do this using the org.eclipse.ui.menus
extension point, I am open to that also.
Re: Editor toolbar action visibility [message #493226 is a reply to message #493141] Fri, 23 October 2009 17:48 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
Matt Dickie wrote:
> P.S. If anyone can show me how to do this using the org.eclipse.ui.menus
> extension point, I am open to that also.

If you are interested in commands, use visibleWhen with activePart
expression

See:

http://wiki.eclipse.org/Platform_Command_Framework
http://blog.eclipse-tips.com/2009/02/commands-part-5-authent ication-in-rcp.html

- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Re: Editor toolbar action visibility [message #493639 is a reply to message #493141] Tue, 27 October 2009 12:48 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Prakash is correct, it's better to use org.eclipse.ui.menus/org.eclipse.ui.commands (and possibly org.eclipse.ui.handlers) unless you already have a legacy actionSet you need to work with.

The actionSet you posted is correct (and should be disabled when your editor is not available). To make it visible depending on if your editors is active, you use actionSetPartAssociation with the actionSet.

PW


Previous Topic:How to disable Project->Build menu item in eclipse
Next Topic:.settings compatability between 3.4 and 3.5
Goto Forum:
  


Current Time: Tue Apr 23 15:38:23 GMT 2024

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

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

Back to the top