Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » dynamically adding extensions
dynamically adding extensions [message #540426] Wed, 16 June 2010 06:51 Go to next message
No real name is currently offline No real nameFriend
Messages: 5
Registered: June 2010
Junior Member
Hi,
I've defined an extension point. I use this to add additional functionality to my headless RCP application. This works fine so far.
IExtensionRegistry reg = Platform.getExtensionRegistry();
IExtension[] extensions = reg.getExtensionPoint(CUSTOM_TASK_EXTENSION).getExtensions() ;
provides all the extensions I need.
But I also want that a new extension can be dropped during runtime in the /plugins folder and another call of the to the registry would provide an updated list.
This is not the case, I always get the initial list.
Is there a way to reload/update that registry?

Thanks in advance for any help.

Cheers, Stephan
Re: dynamically adding extensions [message #540461 is a reply to message #540426] Wed, 16 June 2010 08:42 Go to previous messageGo to next message
Stefan Liebig is currently offline Stefan LiebigFriend
Messages: 124
Registered: July 2009
Senior Member
Hi Stephan,

This is just a guess!
I think you need to restart the bundle with the new extension or add the
extension programmatically to the extension registry with
registry.addContribution(..).
I do not think that the extension registry is monitoring changes within
a plugin.xml.

Tschüß,
Stefan

On 16.06.2010 08:51, stephan.paulicke@web.de wrote:
> Hi,
> I've defined an extension point. I use this to add additional
> functionality to my headless RCP application. This works fine so far.
> IExtensionRegistry reg = Platform.getExtensionRegistry();
> IExtension[] extensions =
> reg.getExtensionPoint(CUSTOM_TASK_EXTENSION).getExtensions() ;
> provides all the extensions I need.
> But I also want that a new extension can be dropped during runtime in
> the /plugins folder and another call of the to the registry would
> provide an updated list.
> This is not the case, I always get the initial list.
> Is there a way to reload/update that registry?
>
> Thanks in advance for any help.
>
> Cheers, Stephan
Re: dynamically adding extensions [message #540466 is a reply to message #540461] Wed, 16 June 2010 09:19 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 5
Registered: June 2010
Junior Member
Hi,
thanks for the answer. I've found some code snippets on that, but they didn't really help. I somehow add a contributor, but ended up with ClassNotFound exceptions.
Do you have perhaps a sample snippet?

Thanks in advance.
Re: dynamically adding extensions [message #540480 is a reply to message #540466] Wed, 16 June 2010 10:49 Go to previous messageGo to next message
Stefan Liebig is currently offline Stefan LiebigFriend
Messages: 124
Registered: July 2009
Senior Member
Hi,

I use this within unit tests to ´manually´ provide new
extensions/extension points:
final IExtensionRegistry registry = RegistryFactory.getRegistry();
final InputStream inputStream = forLoad.getResourceAsStream(pluginResource);
final IContributor contributor =
ContributorFactoryOSGi.createContributor(getContext().getBun dle());
final boolean success = registry.addContribution(inputStream,
contributor, false, pluginResource, null,
((ExtensionRegistry) registry).getTemporaryUserToken());

hth

Tschüß,
Stefan

On 16.06.2010 11:19, stephan.paulicke@web.de wrote:
> Hi,
> thanks for the answer. I've found some code snippets on that, but they
> didn't really help. I somehow add a contributor, but ended up with
> ClassNotFound exceptions.
> Do you have perhaps a sample snippet?
>
> Thanks in advance.
Re: dynamically adding extensions [message #540523 is a reply to message #540426] Wed, 16 June 2010 12:41 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Just adding a plugin to eclipse/plugins or eclipse/dropins will not
update anything while your app is running.

But you can use Bundle/BundleContext to install your plugin into your
running eclipse. That will also allow any IRegistryChangeListener to be
notified of the new, incoming extensions.

See the below test files:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.test s/Eclipse%20UI%20Tests/org/eclipse/ui/tests/dynamicplugins/D ynamicUtils.java?view=co
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.test s/Eclipse%20UI%20Tests/org/eclipse/ui/tests/dynamicplugins/T estInstallUtil.java?view=co

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: dynamically adding extensions [message #540537 is a reply to message #540523] Wed, 16 June 2010 13:18 Go to previous message
No real name is currently offline No real nameFriend
Messages: 5
Registered: June 2010
Junior Member
Thanks,
I'll try this. This looks very promising. Smile
Previous Topic:Log service set DEBUG level
Next Topic:Random ClassCircularityError
Goto Forum:
  


Current Time: Thu Apr 25 07:39:17 GMT 2024

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

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

Back to the top