Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Why does a bundle need to be activated to load an adapter factory?
icon9.gif  Why does a bundle need to be activated to load an adapter factory? [message #692377] Mon, 04 July 2011 10:27 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I have a bundle which didn't need an activator. Views, perspective extensions, etc. in plugin.xml work fine without it. However, after adding an adapter factory, I spent entirely too much time to figure out that it wasn't being loaded due to a check in AdapterFactoryProxy.loadFactory(boolean).
Re: Why does a bundle need to be activated to load an adapter factory? [message #698015 is a reply to message #692377] Mon, 18 July 2011 15:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Which check? A quick scan of the method doesn't show anything activator related.

Even without an Activator you still need to make sure "Activate this plug-in when one of its classes is loaded" is checked in the PDE editor. The AdapterFactory (like many of the lazy-loading strategies in Eclipse Platform) won't load an adapter if the plugin has not been activated yet.

PW


Re: Why does a bundle need to be activated to load an adapter factory? [message #698277 is a reply to message #698015] Tue, 19 July 2011 07:39 Go to previous messageGo to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Quote:
Even without an Activator you still need to make sure "Activate this plug-in when one of its classes is loaded" is checked in the PDE editor. The AdapterFactory (like many of the lazy-loading strategies in Eclipse Platform) won't load an adapter if the plugin has not been activated yet.

That's what I am asking about. Is there some circumstance when you would want not to activate a plug-in when a class is loaded?
Re: Why does a bundle need to be activated to load an adapter factory? [message #698405 is a reply to message #698277] Tue, 19 July 2011 12:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

With eclipse plugins, you always want to have your bundle activated when the first class is loaded.

AFAIK it's not an important distinction in the OSGi world where you communicate with services and you use to have to start your plugin to get your sevice registered (although it may be useful now when using Declarative Services) but in Eclipse you would always want that checked.

PW


Re: Why does a bundle need to be activated to load an adapter factory? [message #735824 is a reply to message #698405] Wed, 12 October 2011 20:08 Go to previous messageGo to next message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
I've seen this issue posted several times but I still see no fix. The real world case is having a plugin-A with a declared AdapterFactory and plugin-B with a menu contribution based on "adapts" which fails unless A is started/active/loaded. We don't need any classes from A, the XML provides knowledge of whether the factory exists and that it can adapt one class to another - but for some reason this is ignored. This seems very similar to declaring a view and having it appear in the Show View dialog without starting/activating/loading the plugin that declares it.

Understandably if the "adapt" has a "test" child, classes will need to be loaded, similar to when a view is selected to be opened, classes are loaded.

The workaround we use in-house is (too) many of our plugins have "startup" extensions and are bloating the runtime just to present a menu contribution that may never get selected. Something's wrong here and needs to be fixed.

Can the "adapters" extension point mechanism be changed to treat its extensions the way "views" extensions are treated, i.e. make UI contributions without starting/activating/loading the plugin that declares them until that is needed?

Craig Foote
Re: Why does a bundle need to be activated to load an adapter factory? [message #736019 is a reply to message #735824] Thu, 13 October 2011 11:16 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 2011-10-12 22:08, Craig Foote wrote:
> The workaround we use in-house is (too) many of our plugins have
> "startup" extensions and are bloating the runtime just to present a menu
> contribution that may never get selected. Something's wrong here and
> needs to be fixed.
>
> Can the "adapters" extension point mechanism be changed to treat its
> extensions the way "views" extensions are treated, i.e. make UI
> contributions without starting/activating/loading the plugin that
> declares them until that is needed?

I had submitted a bugzilla entry a long time ago:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=82973

where I suggested to make a backward-compatible change to the
org.eclipse.core.runtime.adapters extension point. There seems to be not
much interest in fixing that.

- Daniel
Re: Why does a bundle need to be activated to load an adapter factory? [message #736384 is a reply to message #736019] Fri, 14 October 2011 00:35 Go to previous message
Craig Foote is currently offline Craig FooteFriend
Messages: 217
Registered: July 2009
Senior Member
Thanks for replying Daniel. Your bug report has some interesting discussion and it's still open but, as you said, there doesn't appear to be any resources applied to it right now. I voted for the fix and maybe now others will too. I'd like to take a swipe at changing the code myself and proposing a patch but I fear it's beyond my experience level.

Craig
Previous Topic:Eclipse triggers full builds ... and we don't know why
Next Topic:Drop object in Navigator view (Project Explorer)
Goto Forum:
  


Current Time: Fri Apr 19 22:09:41 GMT 2024

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

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

Back to the top