[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

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