Initial Ruler Action Enablement [message #335681] |
Tue, 21 April 2009 08:42  |
Eclipse User |
|
|
|
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 05:41  |
Eclipse User |
|
|
|
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.)
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02842 seconds