Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » bundle starting order
bundle starting order [message #717041] Fri, 19 August 2011 02:52 Go to next message
Maxime Jeanmart is currently offline Maxime Jeanmart
Messages: 35
Registered: November 2010
Member
Hi all,

I'm building an OSGi service which is listing all eclipse plugins which hold a specific type of EMF model, then loads that model.
The installed plugins which hold that model declare themselves to the OSGi service when they load and it's working fine.

However, I also want to list those plugins that are still in development in the workspace. So I created a scanner OSGi service that is finding those plugins and models in the workspace. This scanner only runs at Eclipse startup.
Unfortunately, It runs too early. I cannot load some models because some dependencies are not loaded yet. For example, I have model B in workspace which has a dependency on model A in an installed plugin. The scanner runs before A declares itself so B cannot be loaded.

I tried to manually start the plugins I depend on using this:

IPluginModelBase model = PluginRegistry.findModel(project);
BundleDescription desc = model.getBundleDescription();
for (BundleSpecification requiredBundle : desc.getRequiredBundles())
{
   BundleContext context = Activator.getContext();
   Bundle bundle = context.getBundle(requiredBundle.getName());
   bundle.start();
}

but the bundle variable is null.

Is there something I missed here? Is there another technique I should use to solve my problem?

Thanks for your help,
Max

[Updated on: Fri, 19 August 2011 02:56]

Report message to a moderator

Re: bundle starting order [message #717197 is a reply to message #717041] Fri, 19 August 2011 10:58 Go to previous message
Maxime Jeanmart is currently offline Maxime Jeanmart
Messages: 35
Registered: November 2010
Member
I solved the problem by using Platform.getBundle instead of context.getBundle
Previous Topic:How to control bundles' lifesycle with code?
Next Topic:Drools install problem
Goto Forum:
  


Current Time: Wed Aug 20 16:32:39 EDT 2014

Powered by FUDForum. Page generated in 0.01578 seconds