Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Executable extension definition for <corresponding class> not found
Executable extension definition for <corresponding class> not found [message #325940] Mon, 03 March 2008 13:33 Go to next message
Eclipse UserFriend
Hello,

I've created a sample extension point in one plug-in (say plug-in p1), which
allows the plug-in that it extends to provide a name of a class. The schema
definition of the extension (*.exsd) is attached to this as "test.exsd" for
your reference. Then I created a second plug-in (say plug-in p2) and
extended the above extension point by providing the name of a newly created
class.

After both plug-ins are installed, I executed the following code in the
first plug-in (p1)

IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint =
extensionRegistry.getExtensionPoint("p1.test");
IExtension[]extensions = extensionPoint.getExtensions();

for(int i = 0; i < extensions.length; i++) {
extensions[i].getContributor().getName();
IConfigurationElement[] configurationElements =
extensions[i].getConfigurationElements();

for(int j = 0; j < configurationElements.length; j++){
try {
configurationElements[j].createExecutableExtension(configura tionElements[j].getAttribute( "att"));
}
catch (Exception e){
e.printStackTrace();
}// end try-catch block
}// end for loop
}// end for loop

I get the following exception even though class p2.Element11 in deed exists
in the second plug-in (p2) which extended the above extension point.

org.eclipse.core.runtime.CoreException: Executable extension definition for
"p2.Element11" not found.
at
org.eclipse.core.internal.registry.ConfigurationElement.thro wException(ConfigurationElement.java:62)
at
org.eclipse.core.internal.registry.ConfigurationElement.crea teExecutableExtension(ConfigurationElement.java:222)
at
org.eclipse.core.internal.registry.ConfigurationElementHandl e.createExecutableExtension(ConfigurationElementHandle.java: 51)

Then I replaced the following in the above code snippet

configurationElements[j].createExecutableExtension(
configurationElements[j].getAttribute("att"));

with the following (deprecated approach)

extensions[i].getDeclaringPluginDescriptor().getPluginClassL oader().loadClass(configurationElements[j].getAttribute( "att")).newInstance();

Amazingly, the same class "p2.Element11" was loaded successfully by the
second approach.

I would appreciate it very much if somebody could tell me why the first
(new) approach, which is given below, is failing to load the corresponding
class while the second (old) approach is not.

configurationElements[j].createExecutableExtension(configura tionElements[j].getAttribute( "att"));

Thanks in advance!

Sudarsha Wijenayake
IBM Rational Software


  • Attachment: test.exsd
    (Size: 2.73KB, Downloaded 208 times)
Re: Executable extension definition for <corresponding class> not found [message #325942 is a reply to message #325940] Mon, 03 March 2008 14:32 Go to previous message
Eclipse UserFriend
Sudarsha Wijenayake wrote:

> configurationElements[j].createExecutableExtension(configura tionElements[j].getAttribute( "att"));

It should be configurationElements[j].createExecutableExtension("att")
.... the attribute name to use, not the value.

createExecutableExtension(*) will instantiate a class contained in the
"att" attribute or the child "att" element, depending on which form is
provided.

Later,
PW


--
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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Previous Topic:Classes missing from plugin dependancy
Next Topic:How to define a new vmarg (-vmargs) in Eclipse?
Goto Forum:
  


Current Time: Mon May 05 11:23:46 EDT 2025

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

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

Back to the top