0

In my application, the target platform is set to contain some of my custom plugins apart from the eclipse plugins. During the application's usage, I want to check the contents of the target platform against an installed folder which is supposed to contain my custom plugins.

Effectively, I would like to get a list of all the bundles in the target platform (Eclipse plugins + my custom plugins).

I have tried using getBundleContext() in both ResourcesPlugin and PDEPlugin but that returns only the eclipse bas plugins and not my custom plugins.

matt
  • 10,892
  • 3
  • 22
  • 34
  • Are you sure your bundles are installed? Usually, BundleContext#getBundles() is the way how to get all installed bundles. – isnot2bad Nov 19 '13 at 09:45
  • Yes, my application runs fine by building against those extra set of bundles. I want to add a check to make sure they are present in the target platform. – Chandra Vikas Nov 19 '13 at 10:01
  • The target platform information won't be available in your running application. You will only have information on the plugins included in your application. – greg-449 Nov 19 '13 at 10:11
  • @Greg - But since I can get the eclipse base plugins, isn't it logical to get the other plugins as well because all of these are part of one target definition as in a single ITargetDefinition object ? Am i missing something there ? – Chandra Vikas Nov 19 '13 at 10:22
  • Is your application an Eclipse RCP which uses a workspace and is the target platform defined in that workspace? – greg-449 Nov 19 '13 at 10:31
  • Yes it is an Eclipse RCP using a workspace and the target platform's been modified in that workspace – Chandra Vikas Nov 19 '13 at 10:32

1 Answers1

0
ITargetPlatformService service = PDECore.getDefault().acquireService(ITargetPlatformService.class);
            for (TargetBundle targetBundle: service.getWorkspaceTargetDefinition().getBundles()) {
//then get name of plugin via targetBundle.getBundleInfo().getSymbolicName()
}

The problem with this code is that you get a warning similar to: Discouraged access: The type 'PDECore' is not API (restriction on required library '...\eclipse-rcp-photon-R-win32-x86_64\plugins\org.eclipse.pde.core_3.12.0.v20180516-1159.jar')