[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.platform] Re: [PDE] Find extensions for specific extension point in workspace
|
- From: Paul Webster <pwebster@xxxxxxxxxx>
- Date: Thu, 31 May 2007 12:15:13 -0400
- Newsgroups: eclipse.platform
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5.0.10 (X11/20070302)
Interesting that PDE is considering the IExtensionRegistry. Here's a
snippet of code that uses that approach:
Object master = new Object();
Object user = new Object();
RegistryStrategy strategy = RegistryFactory.createOSGiStrategy(null,
null, master);
IExtensionRegistry registry = RegistryFactory.createRegistry(strategy,
master, user);
IFile plugin = ...; // the plugin.xml in the workspace
String projectName = plugin.getProject.getName();
IContributor contributor = new RegistryContributor(projectName,
projectName, projectName, projectName);
registry.addContribution(plugin.getContents(), contributor, false,
contributor.getName(), null, master);
// then
IExtension[] pluginExtensions = registry.getExtensions(projectName);
This will return the extensions from the plugin.xml in the workspace.
You can repeat for all plugin.xml in the workspace.
You can get fancy and provide more correct information by reading the
headers out of the project MANIFEST.MF to get the correct name and id,
as well as provide the ResourceBundle for translations with a little
poking around.
This looks experimental but appears to be available in 3.2
Later,
PW