Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Action enabling without selection ?
Action enabling without selection ? [message #127287] Thu, 11 September 2003 06:01 Go to next message
Eclipse UserFriend
Hello there. This question was in a previous thread, but I don't think I
was
really clear.

The simplified issue is :
I have a player plugin providing 2 actions :
* Play
* Stop
(these are defined in a org.eclipse.ui.actionsSets extension)

Initially 'Play' must be enabled and 'Stop' disabled.
'Stop' only gets enabled after 'Play' has been triggered,
so the plugin has ben loaded.

When the user presses 'Play', the plugin is loaded,
the delegate for 'play' is instanciated, we execute code,
and at that point we decide that 'Stop' must now get enabled.

But...
- Due to lazy loading, the 'Stop' delegate isn't even instantiated,
so when we decide to enable it, how to do it ? Seems it needs
to go into the extension points of the plugin and tweak
the CoolBar, but it's not generic enough (action may also be in a menu),

- How can I tell in the action set extension that the stop action is
initially disabled, since its enabling does not depend on selection ?
(of course without forcing the plugin to be loaded ;-)

Has someone some ideas or examples of plugins doing a similar
thing ? Maybe I should log a RFP.

Thanks

--Steve
Re: Action enabling without selection ? [message #127388 is a reply to message #127287] Thu, 11 September 2003 09:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eicher.gmx.ch.nodomain

Action enablement is limited as long as your plugin has not been loaded.
But why don't you put your actions in the same plug-in, this way you can
do anything you want once the "Play" action has been executed, as the
plugin is loaded by then.

-tom

Eric Estievenart wrote:
>
> Hello there. This question was in a previous thread, but I don't think I
> was
> really clear.
>
> The simplified issue is :
> I have a player plugin providing 2 actions :
> * Play
> * Stop
> (these are defined in a org.eclipse.ui.actionsSets extension)
>
> Initially 'Play' must be enabled and 'Stop' disabled.
> 'Stop' only gets enabled after 'Play' has been triggered,
> so the plugin has ben loaded.
>
> When the user presses 'Play', the plugin is loaded,
> the delegate for 'play' is instanciated, we execute code,
> and at that point we decide that 'Stop' must now get enabled.
>
> But...
> - Due to lazy loading, the 'Stop' delegate isn't even instantiated,
> so when we decide to enable it, how to do it ? Seems it needs
> to go into the extension points of the plugin and tweak
> the CoolBar, but it's not generic enough (action may also be in a menu),
>
> - How can I tell in the action set extension that the stop action is
> initially disabled, since its enabling does not depend on selection ?
> (of course without forcing the plugin to be loaded ;-)
>
> Has someone some ideas or examples of plugins doing a similar
> thing ? Maybe I should log a RFP.
>
> Thanks
>
> --Steve
Re: Action enabling without selection ? [message #127444 is a reply to message #127287] Thu, 11 September 2003 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.ibm.oti.lab

Once a plugin is loaded, all of its action delegates are loaded. If that is
not the case, please open a bug report against Platform - UI with a sample
plugin showing the problem

Simon :-)

"Eric Estievenart" <eric.estievenart@peregrine.com> wrote in message
news:oprvbx5djt9ck0a6@localhost...
>
> Hello there. This question was in a previous thread, but I don't think I
> was
> really clear.
>
> The simplified issue is :
> I have a player plugin providing 2 actions :
> * Play
> * Stop
> (these are defined in a org.eclipse.ui.actionsSets extension)
>
> Initially 'Play' must be enabled and 'Stop' disabled.
> 'Stop' only gets enabled after 'Play' has been triggered,
> so the plugin has ben loaded.
>
> When the user presses 'Play', the plugin is loaded,
> the delegate for 'play' is instanciated, we execute code,
> and at that point we decide that 'Stop' must now get enabled.
>
> But...
> - Due to lazy loading, the 'Stop' delegate isn't even instantiated,
> so when we decide to enable it, how to do it ? Seems it needs
> to go into the extension points of the plugin and tweak
> the CoolBar, but it's not generic enough (action may also be in a menu),
>
> - How can I tell in the action set extension that the stop action is
> initially disabled, since its enabling does not depend on selection ?
> (of course without forcing the plugin to be loaded ;-)
>
> Has someone some ideas or examples of plugins doing a similar
> thing ? Maybe I should log a RFP.
>
> Thanks
>
> --Steve
Re: Action enabling without selection ? [message #128053 is a reply to message #127444] Fri, 12 September 2003 06:26 Go to previous messageGo to next message
Eclipse UserFriend
On Thu, 11 Sep 2003 10:21:02 -0400, Simon Arsenault <simon@ibm.oti.lab>
wrote:

> Once a plugin is loaded, all of its action delegates are loaded. If that
> is
> not the case, please open a bug report against Platform - UI with a
> sample
> plugin showing the problem
>
> Simon :-)

It is the case... except that the delegates are created using an asyncExec
(in Workbench.refreshPluginActions()), so when I click on the
'Play' action it is first executed and after that the 'Stop' delegate is
instantiated...

I missed that the last time, but now it's fairly clear.
Not too bad for me since my actions have a common base class, which can
do the run asynchronously. But the behaviour is a bit disturbing.

By the way, is there a simple way to set the enablement to false
in the plugin.xml ?

Something like <enablement><false/></enablement>
or <enablement value="false"/>
would be great, but it does not seem to be supported,
so to have a disabled action I must do something like

<enablement><pluginState id="plugin_which_does_not_exist"
value="installed"/></enablement>

Thanks, it helped a lot.

--Steve

PS: I feel my news reader (Opera 7.11) is a bit weird and posts messages
which are missing
references, so the threads are broken. Someone experiencing that with my
posts ?
Re: Action enabling without selection ? [message #128302 is a reply to message #128053] Fri, 12 September 2003 11:28 Go to previous message
Eclipse UserFriend
Originally posted by: simon.ibm.oti.lab

"Eric Estievenart" <eric.estievenart@peregrine.com> wrote in message
news:oprvdtx1gs9ck0a6@localhost...
> On Thu, 11 Sep 2003 10:21:02 -0400, Simon Arsenault <simon@ibm.oti.lab>
> wrote:
>
> > Once a plugin is loaded, all of its action delegates are loaded. If that
> > is
> > not the case, please open a bug report against Platform - UI with a
> > sample
> > plugin showing the problem
> >
> > Simon :-)
>
> It is the case... except that the delegates are created using an asyncExec
> (in Workbench.refreshPluginActions()), so when I click on the
> 'Play' action it is first executed and after that the 'Stop' delegate is
> instantiated...
>
> I missed that the last time, but now it's fairly clear.
> Not too bad for me since my actions have a common base class, which can
> do the run asynchronously. But the behaviour is a bit disturbing.
>
> By the way, is there a simple way to set the enablement to false
> in the plugin.xml ?

No unfortunately. What you did is fine.

Simon :-)

>
> Something like <enablement><false/></enablement>
> or <enablement value="false"/>
> would be great, but it does not seem to be supported,
> so to have a disabled action I must do something like
>
> <enablement><pluginState id="plugin_which_does_not_exist"
> value="installed"/></enablement>
>
> Thanks, it helped a lot.
>
> --Steve
>
> PS: I feel my news reader (Opera 7.11) is a bit weird and posts messages
> which are missing
> references, so the threads are broken. Someone experiencing that with my
> posts ?
Previous Topic:Eclipse Java Builder and External Tools Builders
Next Topic:action contribution to PackageExplorer?
Goto Forum:
  


Current Time: Tue Jul 22 02:22:18 EDT 2025

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

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

Back to the top