Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Proper way to get plugin ID
Proper way to get plugin ID [message #318213] Mon, 23 July 2007 13:04 Go to next message
Eclipse UserFriend
Originally posted by: daniel4321.terra.com.br

Hi,

I am a bit confused about the right way the get the plugin ID.

Many classes, like FileLocaltor, have methods that require a plugin ID.
In the documentation, I have found that
myPluginInstance.getBundle().getSymbolicName()
will return the name that is given in the manifest file.

This requires me to implement the plugin activator as a singleton, since
this is the only way (that I know ) to get the instance from anyware. Am
I doing it right?

I also read that it might return null if the manifest files does not
provide a plugin id. How should I handle this. In my opinion, it is an
error (or at least a bad programming practice) to leave the plugin ID
empty in the manifest file.

I also saw many plugins declare a static constant string, called
PLUGIN_ID, that holds exactly the same id as the manifest file. What
about this? I personally don't like it, since it does not refactor and
it remains a bit "hidden".

I would appreciate any clarification,
Thanks,
Daniel Ferber
Re: Proper way to get plugin ID [message #318223 is a reply to message #318213] Mon, 23 July 2007 13:37 Go to previous message
Eclipse UserFriend
When I use any of the "create a plugin" wizards in Eclipse, those
wizards always create that static, and make the plug-in's Activator a
singleton, and put the id into the plugin.xml and the manifest.mf. So I
just go ahead and use that.

I believe the Activator.getInstance().getBundle().getSymbolicName()
method is reliable, too.

HTH,
Paul
Previous Topic:Complicated Development Setup
Next Topic:open xml file - expanded
Goto Forum:
  


Current Time: Mon Jun 09 08:56:06 EDT 2025

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

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

Back to the top