List eclipse installed plugins at runtime

后端 未结 3 1700
独厮守ぢ
独厮守ぢ 2021-02-07 09:27

Here\'s something obvious that should be easy to do...

How do I retrieve a list of installed plugins at runtime? Can\'t see an obvious way to do this a Platform.getBundl

相关标签:
3条回答
  • 2021-02-07 09:53

    If you're looking to write this in your code, see VonC's answer.

    If you just want a view that does this, there's already one in eclipse: Window->Show View->Other...->PDE Runtime->Plugin Registry. This displays plugins, their extensions, dependencies, and who is providing extensions.

    0 讨论(0)
  • 2021-02-07 10:09

    From here:

    The BundleContext class has a getBundles() method that returns all installed bundles.

    You get an instance of the BundleContext when your bundle is activated BundleActivator.start(BundleContext)).

    You can use it to get some Bundle version number for instance.

    http://t-templier.developpez.com/tutoriel/java/osgi/osgi1/images/architecture-osgi-haut-niveau.png

    The interactions between the bundles are done through two complementary mechanisms: the package export/import and the service registration lookup facility.

    http://sfelix.gforge.inria.fr/osgi-security/images/osgi/osgi_interoperability.png

    The publication and lookup of services are performed through the BundleContext reference that each bundle receives at startup time.
    During the publication process, the advertising bundles registers a service by publishing a Java interface it is implementing, and by providing a class implementing this interface.
    The lookup is performed by the client bundle, which gets the service from the BundleContext and uses it as a standard Java object.

    0 讨论(0)
  • 2021-02-07 10:17

    Use following code to get the List of plugin installed in your RCP

    BundleContext ctx = FrameworkUtil.getBundle(your/Class/Name.class).getBundleContext(); 
    Bundle[] bundles = ctx.getBundles();
    
    0 讨论(0)
提交回复
热议问题