Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Initial Ruler Action Enablement
Initial Ruler Action Enablement [message #335681] Tue, 21 April 2009 12:42 Go to next message
Nadav is currently offline NadavFriend
Messages: 29
Registered: July 2009
Junior Member
My plugin adds an action to the vertical ruler of an editor by, in
plugin.xml, extending org.eclipse.ui.popupMenus with a viewerContribution
which defines the action. The action points to a class extending
AbstractRulerActionDelegate which I implement which delegates to a
MarkerRulerAction which I also implement.

The problem I am having is that, on startup, I the ruler-action should
sometimes be enabled and sometimes disabled depending on the state of the
plugin. I implemented this logic in the MarkerRulerAction's update
function. This works except on startup of the plugin.

The first time the ruler action is clicked, it appears enabled but
produces a dialog saying "The chosen operation is not enabled.". This
apparently happens because my update function is only called the first
time I click on the action. What I want is for the action to appear
disabled so it cannot be clicked on(enabled/disabled should depend on the
same plugin state I compute in the update function).

Any ideas how I can do this?

(I see that in the extension I make there is an enablesFor field, but from
the comment on how to define it, it doesn't sound like I can put my
program-login into it.)
Re: Initial Ruler Action Enablement [message #335694 is a reply to message #335681] Wed, 22 April 2009 09:41 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Nadav wrote:
> My plugin adds an action to the vertical ruler of an editor by, in
> plugin.xml, extending org.eclipse.ui.popupMenus with a
> viewerContribution which defines the action. The action points to a
> class extending AbstractRulerActionDelegate which I implement which
> delegates to a MarkerRulerAction which I also implement.
>
> The problem I am having is that, on startup, I the ruler-action should
> sometimes be enabled and sometimes disabled depending on the state of
> the plugin. I implemented this logic in the MarkerRulerAction's
> update function. This works except on startup of the plugin.
>
> The first time the ruler action is clicked, it appears enabled but
> produces a dialog saying "The chosen operation is not enabled.". This
> apparently happens because my update function is only called the first
> time I click on the action. What I want is for the action to appear
> disabled so it cannot be clicked on(enabled/disabled should depend on
> the same plugin state I compute in the update function).
>
> Any ideas how I can do this?
There's no way. The current design is intentional to avoid loading of
all plug-ins that contribute a ruler action.

Dani
>
> (I see that in the extension I make there is an enablesFor field, but
> from the comment on how to define it, it doesn't sound like I can put
> my program-login into it.)
>
>
>
>
>
Previous Topic:programmatically select/deselect ruler
Next Topic:A crazy application question
Goto Forum:
  


Current Time: Thu Apr 18 12:52:43 GMT 2024

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

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

Back to the top