Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » selectionChanged and lazy loading
selectionChanged and lazy loading [message #304852] Fri, 16 June 2006 08:16 Go to next message
Michael Pradel is currently offline Michael PradelFriend
Messages: 26
Registered: July 2009
Junior Member
I have a IObjectActionDelegate and want to enable/disable the action in
selectionChanged(). It calls a method of my plugin, and I recognized a
strange behaviour when the action is displayed before the plugin has
been used. In this case, selectionChanged() isn't called before the
action is displayed to the user (so that a could disable is), but after
he has clicked on it (which I wanted to avoid).
I know Eclipse uses lazy loading for plugins, but shouldn't the plugin
be loaded in this case?
Is there any other way to disable the action before the plugin is started?

Thanks in advance,
Michael
Re: selectionChanged and lazy loading [message #304855 is a reply to message #304852] Fri, 16 June 2006 11:07 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Michael Pradel wrote:
> I have a IObjectActionDelegate and want to enable/disable the action in
> selectionChanged(). It calls a method of my plugin, and I recognized a
> strange behaviour when the action is displayed before the plugin has
> been used. In this case, selectionChanged() isn't called before the
> action is displayed to the user (so that a could disable is), but after
> he has clicked on it (which I wanted to avoid).
> I know Eclipse uses lazy loading for plugins, but shouldn't the plugin
> be loaded in this case?
> Is there any other way to disable the action before the plugin is started?

What extension point did you use to create this? org.eclipse.ui.popupMenus?

You are right, the lazy loading means that your code will never get
called, until the user clicks on your action at least once (or something
else causes your plugin to load).

But you can add declarative visibility and enablement expressions that
are used before your plugin is loaded. Both objectContributions and
actions can have enablement elements, and I think objectContributions
support visibility elements as well.

Click on the extension point and you can open the extension point
documentation.

Later,
PW


Re: selectionChanged and lazy loading [message #305159 is a reply to message #304855] Sat, 24 June 2006 11:51 Go to previous message
Michael Pradel is currently offline Michael PradelFriend
Messages: 26
Registered: July 2009
Junior Member
> What extension point did you use to create this?
> org.eclipse.ui.popupMenus?

Yes.

> But you can add declarative visibility and enablement expressions that
> are used before your plugin is loaded. Both objectContributions and
> actions can have enablement elements, and I think objectContributions
> support visibility elements as well.

Thanks for the hint with <visibility>! The objectContribution is now
hidden if the plugin is not started (using <pluginState>).


Greetings,
Michael
Previous Topic:Using ant from within Eclipse Plugin
Next Topic:controling newWizard menu positioning
Goto Forum:
  


Current Time: Fri Mar 29 01:11:46 GMT 2024

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

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

Back to the top