Skip to main content



      Home
Home » Eclipse Projects » Equinox » Loading class from extension point
Loading class from extension point [message #1107507] Thu, 12 September 2013 10:02 Go to next message
Eclipse UserFriend
Hi all,

We have an extension point which specifies class name as one of its attribute. We need to obtain the class instance from the provided class name String.

So far we only find IConfigurationElement#createExecutableExtension, but this one creates object instance instead of class instance. Actually we need something like Bundle#loadClass, but how to get reference to Bundle from IExtensionRegistry ?

Any help would be greatly appreciated.

Thanks & Regards,

Setya
Re: Loading class from extension point [message #1107968 is a reply to message #1107507] Fri, 13 September 2013 02:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

I've found the following works:

Bundle bundle = OSGIUtils.getDefault().getBundle(element.getContributor().getName());
Class<?> clazz = bundle.loadClass(className);


But the thing is OSGIUtils is internal, so I'm open for any suggestions.


Thanks & Regards,

Setya
Re: Loading class from extension point [message #1108246 is a reply to message #1107968] Fri, 13 September 2013 11:04 Go to previous messageGo to next message
Eclipse UserFriend
Use Platform.getBundle instead:

http://help.eclipse.org/kepler/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/Platform.html#getBundle(java.lang.String)

HTH

Tom.
Re: Loading class from extension point [message #1108283 is a reply to message #1108246] Fri, 13 September 2013 12:19 Go to previous message
Eclipse UserFriend
Hi Tom,

It works like a charm.

Thanks a lot for your help.


Regards,

Setya
Previous Topic:ServiceTracker and DS combined?
Next Topic:[p2] List IUs of installation plan
Goto Forum:
  


Current Time: Sun Jul 13 18:53:12 EDT 2025

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

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

Back to the top