equinox-dev-bounces@xxxxxxxxxxx wrote on 2007-05-22
> Thanks for response.
> Will Bundle/BundleContext be created if no activator is
Yes. Every bundle has a Bundle object. Every bundle
that is started has a BundleContext.
> Why there isn't a static method like
How would the implementation of BundleContext.getBundleContext()
know which BundleContext to return? Since a bundle can import packages
from other bundles, the information on the call stack cannot be used to
determine the "calling bundle". So there is no such static way
to obtain the bundle context. What some bundles do is implement a BundleActivator
class which stores the injected BundleContext into a static field which
can then be examined by other classes in the bundle. Eclipse's Plugin class
does this. I don't think it is a best practice, but it does generally do