Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Extensions broken in e4?(Following tutorial on Extensions gives broken results)
Extensions broken in e4? [message #537977] Fri, 04 June 2010 11:39 Go to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

Followed this tutorial here - http://www.vogella.de/articles/EclipseExtensionPoint/article .html using e4 M6

The extension point creation works fine. But when I go to create the extension itself instead of the extension point id showing in the Extensions dialog after hitting the Add... button I get a listing that shows the plugin name (where the EP is defined) concatenated with the extension point id. If I select this to Add, then that works, but then clicking on the "Open extension point schema" link throws

	at org.eclipse.pde.internal.core.schema.SchemaDescriptor.<init>(SchemaDescriptor.java:46)
	at org.eclipse.pde.internal.ui.editor.schema.SchemaInputContext.createExternalModel(SchemaInputContext.java:76)
	at org.eclipse.pde.internal.ui.editor.schema.SchemaInputContext.createModel(SchemaInputContext.java:57)
	at org.eclipse.pde.internal.ui.editor.context.InputContext.create(InputContext.java:134)
	at org.eclipse.pde.internal.ui.editor.schema.SchemaInputContext.<init>(SchemaInputContext.java:42)
	at org.eclipse.pde.internal.ui.editor.schema.SchemaEditor.createSystemFileContexts(SchemaEditor.java:103)
	at org.eclipse.pde.internal.ui.editor.PDEFormEditor.createInputContexts(PDEFormEditor.java:206)


If I edit the plugin.xml directly to use the proper EP Id then it says it does not exist. Looks to me like the plugin publishing the EP is using the concatenated plugin name and EP Id and the plugin providing the Extension expects just the EP Id.

Thx.

David

[Updated on: Fri, 04 June 2010 11:42]

Report message to a moderator

Re: Extensions broken in e4? [message #538656 is a reply to message #537977] Tue, 08 June 2010 11:00 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

Further information on this. I added

					IExtensionPoint[] allPoints = Platform.getExtensionRegistry().getExtensionPoints();
					CharSequence backsub = "flat";
					for(int i=0; i<allPoints.length; i++) {
						IConfigurationElement[] elements = allPoints[i].getConfigurationElements();
						for(int j=0; j<elements.length; j++) {
							if(elements[j].getName().contains(backsub)) {
								String val = elements[j].getName();
							}			
						}
					}


So I could inspect the ConfigurationElements. I found my plugin class listed in the objectManager.extensionPoints.keyTable. The associated value was 872, which I assume is in the keyValue table, since they look like the same format.

So the question is can I retreive my extoensionPo9int based on this id rather than using

	private static final String ITESTER_ID = "com.hsbcib.grds.testui.flatfiletester";
...
	IConfigurationElement[] config = Platform.getExtensionRegistry()
														.getConfigurationElementsFor(ITESTER_ID);



?

Thx.

David
Re: Extensions broken in e4? [message #538675 is a reply to message #538656] Tue, 08 June 2010 11:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Did you ever tried that in a 3.x environment? 4.0 SDK is using
unmodified sources of Equinox, PDE, ... .

And naturally we ourselves are using Extension Points so the system works.

Our code e.g. looks like this:

> IExtensionRegistry registry = RegistryFactory.getRegistry();
> IExtensionPoint extPoint = registry
> .getExtensionPoint("org.eclipse.e4.ui.css.swt.theme");
>
> for (IExtension e : extPoint.getExtensions()) {
> for (IConfigurationElement ce : getPlatformMatches(e.getConfigurationElements())) {
> if (ce.getName().equals("theme")) {
> registerTheme(ce.getAttribute("id"), ce
> .getAttribute("label"), "platform:/plugin/"
> + ce.getContributor().getName() + "/" + ce
> .getAttribute("basestylesheeturi"));
> }
> }
> }

One problem could be that your bundle is NOT marked as a Singleton which
is a requirement for exporting an extension point.

Tom

Am 08.06.10 13:00, schrieb David Wynter:
> Hi,
>
> Further information on this. I added
>
>
> IExtensionPoint[] allPoints =
> Platform.getExtensionRegistry().getExtensionPoints();
> CharSequence backsub = "flat";
> for(int i=0; i<allPoints.length; i++) {
> IConfigurationElement[] elements =
> allPoints[i].getConfigurationElements();
> for(int j=0; j<elements.length; j++) {
> if(elements[j].getName().contains(backsub)) {
> String val = elements[j].getName();
> }
> }
> }
>
>
> So I could inspect the ConfigurationElements. I found my plugin class
> listed in the objectManager.extensionPoints.keyTable. The associated
> value was 872, which I assume is in the keyValue table, since they look
> like the same format.
> So the question is can I retreive my extoensionPo9int based on this id
> rather than using
>
> private static final String ITESTER_ID =
> "com.hsbcib.grds.testui.flatfiletester";
> ..
> IConfigurationElement[] config = Platform.getExtensionRegistry()
>
> .getConfigurationElementsFor(ITESTER_ID);
>
>
>
> ?
>
> Thx.
>
> David
Re: Extensions broken in e4? [message #539552 is a reply to message #538675] Fri, 11 June 2010 09:32 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
I tried using the same Extension plugin in a simple plugin providing the Extension Point in 3.5.2, it worked just fine. But when I look at the plugin.xml for the e4 based plugin that is providing the same extension point I see a warning triangle on this

   <extension-point id="com.hsbcib.grds.test.tester" name="Flat File Tester" schema="schema/com.hsbcib.grds.test.tester.exsd"/>


The warning triangle says ' Illegal value 'com.hsbcib.grds.test.tester' for attribute "id". Legal characters as "a-z", "A-Z", "0-9", and "_" '

The consequence of this appears to be that when I click on Add.. in Extensions dialog of the plugin providing the extension I get at the top of my list
"com.hsbcib.grds.testui.com.hsbcib.grds.test.tester" where com.hsbcib.grds.testui is the plugin id with the extension point defined and com.hsbcib.grds.test.tester is the extension point id value. From this point nothing will work due to incorrect id.

I also tried one with no '.' in the extension point id, same deal. it concatenates the plugin id with the extension point id. If I manually alter the plugin xml to reflect the actual extensino point id, it cannot find it, whereas in 3.5.2 it does.

I am going to have to embed my plugin providing the extension in the other plugin as do not have the time to pursue this further at the moment ( deadlines).

Thx.

David
Re: Extensions broken in e4? [message #539557 is a reply to message #539552] Fri, 11 June 2010 09:50 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
One extra bit of information,. It is only the "Open extension point schema" that is actually broken as in my first email.

When I run this

	private static final String ITESTER_ID = "com.hsbcib.grds.testui.flatfiletester";
...
					try {
						IExtensionRegistry registry = RegistryFactory.getRegistry();
						IExtensionPoint extPoint = registry.getExtensionPoint(ITESTER_ID);
						
						for (IExtension e : extPoint.getExtensions()) {							
							for (IConfigurationElement ce : e.getConfigurationElements()) {
								System.out.println("Evaluating extension");
...

I can see the plugin id plus extension point id (in this case the extension point id is 'flatfiletester') in registry.registryObjects.extensionPoints.keyTable, but getExtensionPoint does NOT return it. I assume there is still some mismatch between what one is publishing as the id (plugin id + extension point id) and what the getExtensionPoint expects as the id (extension point id).

David
Re: Extensions broken in e4? [message #539635 is a reply to message #539557] Fri, 11 June 2010 14:52 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Progessed further but still not there.

I changed the code to this
					try {
						IExtensionRegistry registry = RegistryFactory.getRegistry();
						IExtensionPoint[] extPoints = registry.getExtensionPoints();
						for(IExtensionPoint extPoint : extPoints) {
							if(extPoint.getUniqueIdentifier().equals(ITESTER_ID)) {
								for (IExtension e : extPoint.getExtensions()) {							
...

This finds my extension point, but the extPoint.getExtensions() returns an empty array. So I cannot help but think there is a difference of expectations between the plugin defining the extension point and the extension that implements that extension point.

Thx.

David
Re: Extensions broken in e4? [message #539878 is a reply to message #539635] Mon, 14 June 2010 07:46 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
I followed Lars Extension Point example to the letter using e4M6, it has exactly the same issue as I had. This is a bug, I will raise it.

David
Re: Extensions broken in e4? [message #539883 is a reply to message #539878] Mon, 14 June 2010 07:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
.... but if the extension system is broken why:
a) Is our theme stuff working
b) Is our model stuff working
c) Is the compat layer working

Could you provide us the plugins, you've developed to take a look our
own what's wrong.

Tom

Am 14.06.10 09:46, schrieb David Wynter:
> I followed Lars Extension Point example to the letter using e4M6, it has
> exactly the same issue as I had. This is a bug, I will raise it.
>
> David
Re: Extensions broken in e4? [message #539940 is a reply to message #539878] Mon, 14 June 2010 11:03 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
I noticed that the 'class' was found, but that there were 2 extensions satisfying the Choice, the second does not have 'class' defined as the client, and that was the one that showed me the error. No idea yet where this 2nd extension comes from. Will dig further.

Re: Extensions broken in e4? [message #540178 is a reply to message #539940] Tue, 15 June 2010 09:45 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
At this point I have the vogella extension point example working in e4M6. But all the things wrong I stated about my extension point above are still true. It concatenates the plugin id with the extension piont id in the registry for my plugin, but does not for the vogella example.

I compare the exsd from both example and mine and find them identical excepting the ids and interface defined.

I compare the plugin.xml for both extensions and find them identical apart from the point and class strings. and of course that if I do not use the plugin id and exension point id concatenated it does not find the extension point id in the editor.

I compare the plugin.xml for the extension points and find them identical for the extension-point definitions, excepting that my ext point has a warning on the id saying that the value had an illegal character, it does not allow the '.'., weird.

Then at runtime it finds the extension point id but does not find any extension associated with it in the regsitry.

Kinda stuck.

Thx.

David
Re: Extensions broken in e4? [message #540185 is a reply to message #539883] Tue, 15 June 2010 10:18 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Problem solved. Although not sure why one concatenates the plugin id ithe the exension point id and the other does not.

I simply failed at the last hurdle, I had not included the extension in the runtime configuration, thus it could not find it. A big doooooh.

Thx for your help.

David
Re: Extensions broken in e4? [message #577210 is a reply to message #537977] Tue, 08 June 2010 11:00 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Hi,

Further information on this. I added


IExtensionPoint[] allPoints = Platform.getExtensionRegistry().getExtensionPoints();
CharSequence backsub = "flat";
for(int i=0; i<allPoints.length; i++) {
IConfigurationElement[] elements = allPoints[i].getConfigurationElements();
for(int j=0; j<elements.length; j++) {
if(elements[j].getName().contains(backsub)) {
String val = elements[j].getName();
}
}
}


So I could inspect the ConfigurationElements. I found my plugin class listed in the objectManager.extensionPoints.keyTable. The associated value was 872, which I assume is in the keyValue table, since they look like the same format.

So the question is can I retreive my extoensionPo9int based on this id rather than using


private static final String ITESTER_ID = "com.hsbcib.grds.testui.flatfiletester";
...
IConfigurationElement[] config = Platform.getExtensionRegistry()
.getConfigurationElementsFor(ITESTER_ID);



?

Thx.

David
Re: Extensions broken in e4? [message #577250 is a reply to message #577210] Tue, 08 June 2010 11:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Did you ever tried that in a 3.x environment? 4.0 SDK is using
unmodified sources of Equinox, PDE, ... .

And naturally we ourselves are using Extension Points so the system works.

Our code e.g. looks like this:

> IExtensionRegistry registry = RegistryFactory.getRegistry();
> IExtensionPoint extPoint = registry
> .getExtensionPoint("org.eclipse.e4.ui.css.swt.theme");
>
> for (IExtension e : extPoint.getExtensions()) {
> for (IConfigurationElement ce : getPlatformMatches(e.getConfigurationElements())) {
> if (ce.getName().equals("theme")) {
> registerTheme(ce.getAttribute("id"), ce
> .getAttribute("label"), "platform:/plugin/"
> + ce.getContributor().getName() + "/" + ce
> .getAttribute("basestylesheeturi"));
> }
> }
> }

One problem could be that your bundle is NOT marked as a Singleton which
is a requirement for exporting an extension point.

Tom

Am 08.06.10 13:00, schrieb David Wynter:
> Hi,
>
> Further information on this. I added
>
>
> IExtensionPoint[] allPoints =
> Platform.getExtensionRegistry().getExtensionPoints();
> CharSequence backsub = "flat";
> for(int i=0; i<allPoints.length; i++) {
> IConfigurationElement[] elements =
> allPoints[i].getConfigurationElements();
> for(int j=0; j<elements.length; j++) {
> if(elements[j].getName().contains(backsub)) {
> String val = elements[j].getName();
> }
> }
> }
>
>
> So I could inspect the ConfigurationElements. I found my plugin class
> listed in the objectManager.extensionPoints.keyTable. The associated
> value was 872, which I assume is in the keyValue table, since they look
> like the same format.
> So the question is can I retreive my extoensionPo9int based on this id
> rather than using
>
> private static final String ITESTER_ID =
> "com.hsbcib.grds.testui.flatfiletester";
> ..
> IConfigurationElement[] config = Platform.getExtensionRegistry()
>
> .getConfigurationElementsFor(ITESTER_ID);
>
>
>
> ?
>
> Thx.
>
> David
Re: Extensions broken in e4? [message #577404 is a reply to message #538675] Fri, 11 June 2010 09:32 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
I tried using the same Extension plugin in a simple plugin providing the Extension Point in 3.5.2, it worked just fine. But when I look at the plugin.xml for the e4 based plugin that is providing the same extension point I see a warning triangle on this


<extension-point id="com.hsbcib.grds.test.tester" name="Flat File Tester" schema="schema/com.hsbcib.grds.test.tester.exsd"/>


The warning triangle says ' Illegal value 'com.hsbcib.grds.test.tester' for attribute "id". Legal characters as "a-z", "A-Z", "0-9", and "_" '

The consequence of this appears to be that when I click on Add.. in Extensions dialog of the plugin providing the extension I get at the top of my list
"com.hsbcib.grds.testui.com.hsbcib.grds.test.tester" where com.hsbcib.grds.testui is the plugin id with the extension point defined and com.hsbcib.grds.test.tester is the extension point id value. From this point nothing will work due to incorrect id.

I also tried one with no '.' in the extension point id, same deal. it concatenates the plugin id with the extension point id. If I manually alter the plugin xml to reflect the actual extensino point id, it cannot find it, whereas in 3.5.2 it does.

I am going to have to embed my plugin providing the extension in the other plugin as do not have the time to pursue this further at the moment ( deadlines).

Thx.

David
Re: Extensions broken in e4? [message #577617 is a reply to message #539878] Mon, 14 June 2010 07:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
.... but if the extension system is broken why:
a) Is our theme stuff working
b) Is our model stuff working
c) Is the compat layer working

Could you provide us the plugins, you've developed to take a look our
own what's wrong.

Tom

Am 14.06.10 09:46, schrieb David Wynter:
> I followed Lars Extension Point example to the letter using e4M6, it has
> exactly the same issue as I had. This is a bug, I will raise it.
>
> David
Re: Extensions broken in e4? [message #577642 is a reply to message #539878] Mon, 14 June 2010 11:03 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
I noticed that the 'class' was found, but that there were 2 extensions satisfying the Choice, the second does not have 'class' defined as the client, and that was the one that showed me the error. No idea yet where this 2nd extension comes from. Will dig further.
Re: Extensions broken in e4? [message #577684 is a reply to message #577642] Tue, 15 June 2010 09:45 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
At this point I have the vogella extension point example working in e4M6. But all the things wrong I stated about my extension point above are still true. It concatenates the plugin id with the extension piont id in the registry for my plugin, but does not for the vogella example.

I compare the exsd from both example and mine and find them identical excepting the ids and interface defined.

I compare the plugin.xml for both extensions and find them identical apart from the point and class strings. and of course that if I do not use the plugin id and exension point id concatenated it does not find the extension point id in the editor.

I compare the plugin.xml for the extension points and find them identical for the extension-point definitions, excepting that my ext point has a warning on the id saying that the value had an illegal character, it does not allow the '.'., weird.

Then at runtime it finds the extension point id but does not find any extension associated with it in the regsitry.

Kinda stuck.

Thx.

David
Re: Extensions broken in e4? [message #577701 is a reply to message #539883] Tue, 15 June 2010 10:18 Go to previous messageGo to next message
David Wynter is currently offline David WynterFriend
Messages: 4624
Registered: July 2009
Senior Member
Problem solved. Although not sure why one concatenates the plugin id ithe the exension point id and the other does not.

I simply failed at the last hurdle, I had not included the extension in the runtime configuration, thus it could not find it. A big doooooh.

Thx for your help.

David
Re: Extensions broken in e4? [message #1787629 is a reply to message #577701] Wed, 30 May 2018 10:01 Go to previous message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

For the late comers, for me it was an issue with the Eclipse target version. Since it is defined as a comment at the begging of your plugin.xml file it is easy to overlook:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
...


With version 3.0 I got the complaints about dots in the extension id, but without them (the dots) my elipse would refuse to find the extensions when adding them to other plugins.

When I changed the version to 3.4 the extension points where found (remember to restart your eclipse - it likes to cache stuff that makes this type of changes not to be picked). Also, with 3.4 dots can be used in the extension id. I think what they did is that the information is taken from the schema and not the entry in the plugin.xml (the id in the schema had no dots in my case).


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Previous Topic:Trace compass crashes on Ubuntu 18.04
Next Topic:e4 Creation Review
Goto Forum:
  


Current Time: Thu Mar 28 07:19:44 GMT 2024

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

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

Back to the top