Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Are id's in plugin.xml files are globally unique
Are id's in plugin.xml files are globally unique [message #321741] Thu, 25 October 2007 10:20 Go to next message
Eclipse UserFriend
Originally posted by: Jan-Hendrik.Diederich.bredex.de

Hello,
I have a question:
Are the "id" definitions in plugin.xml files generally unique? Or do the
bundles work at some places as implicit namespaces?

So that id="hello.world" can exist in myPlugin.jar/plugin.xml, and there
is absolute no problem to have id="hello.world" in
otherPlugin.jar/plugin.xml?
Or must they differ?

Does anyone know this for sure?
Not: "I think so" / "Very Likely" / etcetera.

Ideas?
Jan Diederich
Re: Are id's in plugin.xml files are globally unique [message #321744 is a reply to message #321741] Thu, 25 October 2007 10:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Jan,

I think in something like an extension point, to refer to that ID
elsewhere, you need to qualify it with the plugin ID. Other places you
need to define a fully qualified ID directly.


Jan Diederich wrote:
> Hello,
> I have a question:
> Are the "id" definitions in plugin.xml files generally unique? Or do
> the bundles work at some places as implicit namespaces?
>
> So that id="hello.world" can exist in myPlugin.jar/plugin.xml, and
> there is absolute no problem to have id="hello.world" in
> otherPlugin.jar/plugin.xml?
> Or must they differ?
>
> Does anyone know this for sure?
> Not: "I think so" / "Very Likely" / etcetera.
>
> Ideas?
> Jan Diederich
>
Re: Are id's in plugin.xml files are globally unique [message #321750 is a reply to message #321741] Thu, 25 October 2007 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Do you mean an id attribute as the plugin identifier? or (as Ed
mentioned) the id attribute for an extension point description?

Or just an id attribute in general in plugin.xml (in
org.eclipse.ui.commands, in org.eclipse.ui.views, etc).

I think the general convention is that an id should be unique within an
extension point-extension, as opposed to say the XML convention which is
"id" should be unique within the document.

Most (although not all :-) of the platform extension points try to
mention this: "id - uniquely identify the viewer contribution" etc. But
as far as I know there's nothing in the registry that enforces this, our
registry Readers simply logs an error if it finds two elements with the
same id.

That's kinda rambling but hopefully mostly clear :-)

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
Re: Are id's in plugin.xml files are globally unique [message #321795 is a reply to message #321750] Fri, 26 October 2007 08:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Jan-Hendrik.Diederich.bredex.de

Hi,
I want to describe more precisely what I mean:
I mean the id name of an entry at an extension point.
Like: <org.eclipse.view.Point> <view class="bla"
id="Hopefully.unique.id"/>...
And I want to know if this is unique, so that all other declarations which
use this id in every of Eclipses plugins from there on only _refer_ to
this id, and not declaring it again.

If I understood you right, this is not enforced but the usual case. Right?

Thanks,
Jan Diederich
Re: Are id's in plugin.xml files are globally unique [message #321797 is a reply to message #321795] Fri, 26 October 2007 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Jan,

I think so. I believe the convention is to use your plugin's ID
followed by something unique within the plugin.xml and hence by
convention it would be globally unique. I doubt it's enforced but there
are likely parts of the system that rely on it...


Jan Diederich wrote:
> Hi,
> I want to describe more precisely what I mean:
> I mean the id name of an entry at an extension point.
> Like: <org.eclipse.view.Point> <view class="bla"
> id="Hopefully.unique.id"/>...
> And I want to know if this is unique, so that all other declarations
> which use this id in every of Eclipses plugins from there on only
> _refer_ to this id, and not declaring it again.
>
> If I understood you right, this is not enforced but the usual case.
> Right?
>
> Thanks,
> Jan Diederich
>
Re: Are id's in plugin.xml files are globally unique [message #321799 is a reply to message #321797] Fri, 26 October 2007 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Ed Merks wrote:
> Jan,
>
> I think so. I believe the convention is to use your plugin's ID
> followed by something unique within the plugin.xml and hence by
> convention it would be globally unique. I doubt it's enforced but there
> are likely parts of the system that rely on it...

Right ... so for example, if you define a org.eclipse.ui.views/view
id="com.example.myId" we expect that ID to be unique. As it turns out
ViewRegistry keeps it in a SortedSet unique by ID, so if plugins *were*
to contribute multiple views with the same ID, a random one (determined
by the IExtensionRegistry) would win (the last one in).

Other extension point readers that require unique IDs keep the first one
found and emit errors if they find a second contribution with the same ID.

I'd say a large part of the system relies on it but it's only enforced
in a hap-hazard fashion :-)

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
Re: Are id's in plugin.xml files are globally unique [message #321821 is a reply to message #321799] Mon, 29 October 2007 05:23 Go to previous message
Eclipse UserFriend
Originally posted by: Jan-Hendrik.Diederich.bredex.de

Thanks for all the answers.
This "uniqueness" makes life a lot easier for me (and everyone else) :-)
Previous Topic:IFile creation in an existing project
Next Topic:view title
Goto Forum:
  


Current Time: Sun Nov 09 01:48:10 EST 2025

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

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

Back to the top