Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsRe: Extension Point and Class Loading Error
https://www.eclipse.org/forums/index.php/mv/msg/164860/522135/#msg_522135
Given you have "element", an IConfigurationElement, you could use this
approach to consult the class loader of the extender
Gaurav Vaish wrote:
> Hi,
>
> I have created an extension point that allows an extension to specify a
> class that this plugin will load. Let's call them BasePlugin (that defines
> the extension point), UsePlugin (that defines the extension).
>
> Usage is something like:
>
> <extension point="my.point.name">
> <item class="fully.qualified.name.of.ClassName" />
> </extension>
>
>
> In BasePlugin, I am able to get the class name (using IExtensionRegistry)
> but results in ClassNotFoundException during
> getClass().getClassLoader.loadClass(...).
>
>
> Is there a resolution other than using
> Eclipse-BuddyPolicy: registered
> and
> Eclipse-RegisterBuddy: id.of.base.extension
>
>
> Because, say, while working with org.eclipse.ui plugin, I don't need to do
> anything like that... then why for custom plugins?
>
>
>
>
> Sorry for cross posting.
> Thanks in advance.
>
>
> --
> Happy Hacking,
> Gaurav Vaish
> www.mastergaurav.com
>
>
>]]>Ed Merks2010-03-20T06:06:07-00:00Extension Point and Class Loading Error
https://www.eclipse.org/forums/index.php/mv/msg/164860/522121/#msg_522121
Originally posted by: eclipse-nospam-gaurav-vaish.gmail.com
Hi,
I have created an extension point that allows an extension to specify a
class that this plugin will load. Let's call them BasePlugin (that defines
the extension point), UsePlugin (that defines the extension).
In BasePlugin, I am able to get the class name (using IExtensionRegistry)
but results in ClassNotFoundException during
getClass().getClassLoader.loadClass(...).
Is there a resolution other than using
Eclipse-BuddyPolicy: registered
and
Eclipse-RegisterBuddy: id.of.base.extension
Because, say, while working with org.eclipse.ui plugin, I don't need to do
anything like that... then why for custom plugins?
Sorry for cross posting.
Thanks in advance.
--
Happy Hacking,
Gaurav Vaish
www.mastergaurav.com]]>2010-03-20T08:19:15-00:00Re: Extension Point and Class Loading Error
https://www.eclipse.org/forums/index.php/mv/msg/164860/522196/#msg_522196
Originally posted by: eclipse-nospam-gaurav-vaish.gmail.com
"Ed Merks" <Ed.Merks@gmail.com> wrote in message
news:ho29cd$jkt$1@build.eclipse.org...
> Gaurav,
>
> Given you have "element", an IConfigurationElement, you could use this
> approach to consult the class loader of the extender
>
> Class<?> javaClass =
> Platform.getBundle(element.getDeclaringExtension().getContri butor().getName()).loadClass(element.getAttribute(attributeN ame));
>
>
> Gaurav Vaish wrote:
>> Hi,
>>
>> I have created an extension point that allows an extension to specify a
>> class that this plugin will load. Let's call them BasePlugin (that
>> defines the extension point), UsePlugin (that defines the extension).
>>
>> Usage is something like:
>>
>> <extension point="my.point.name">
>> <item class="fully.qualified.name.of.ClassName" />
>> </extension>
>>
>>
>> In BasePlugin, I am able to get the class name (using IExtensionRegistry)
>> but results in ClassNotFoundException during
>> getClass().getClassLoader.loadClass(...).
>>
>>
>> Is there a resolution other than using
>> Eclipse-BuddyPolicy: registered
>> and
>> Eclipse-RegisterBuddy: id.of.base.extension
>>
>>
>> Because, say, while working with org.eclipse.ui plugin, I don't need to
>> do anything like that... then why for custom plugins?
>>
>>
>>
>>
>> Sorry for cross posting.
>> Thanks in advance.
>>
>>
>> --
>> Happy Hacking,
>> Gaurav Vaish
>> www.mastergaurav.com
>>
>>]]>2010-03-20T15:54:54-00:00Re: Extension Point and Class Loading Error
https://www.eclipse.org/forums/index.php/mv/msg/164860/522359/#msg_522359
Originally posted by: richkulp.us.NOSPAM.ibm.com
Hi,
Actually IConfigurationElement provides a direct method to do this
It does all of the bundle stuff for you. It actually returns an instance
of the class, not the class itself. But that is what the extension point
system was designed for.