Skip to main content

How to programmatically retrieve your plug-ins' version number


Technote (FAQ)


Question

How can you programmatically retrieve the version number of your plug-ins from the Help > About IBM Rational Software Architect for WebSphere... > Installation Details > Installed Software list in IBM Rational Software Architect?

Cause

You would like to be able to use Java code to get the plug-in information.

Answer


ANSWERS

There are a couple of possible answers to this question:

  • Use org.osgi.framework.BundleContext.getBundles(), for example, from your activator class inside your plugin in order to retrieve all the plug-ins

    OR
  • Use the following code in order to retrieve the plugins by features:
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();

    if (providers != null) {

     for (int i = 0; i < providers.length; ++i) {

      IBundleGroup[] bundleGroups = providers[i].getBundleGroups(); //bundle //group is the same as feature

      for (int j = 0; j < bundleGroups.length; ++j) {


   Bundle[] bundles = bundleGroups[j].getBundles();

       for (int k = 0; k < bundles.length; ++k) {

    System.out.println(bundles[k]);

       }

      }

     }

    }

    NOTE: Each of these two solutions might give different set of plugins, as not all plugins need to be grouped in features.


Cross reference information
Segment Product Component Platform Version Edition
Software Development Rational Software Architect for WebSphere Software Eclipse Windows 8.5, 8.5.1

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

Rational Software Architect

Eclipse


Software version:
8.5, 8.5.1


Operating system(s):
Windows


Reference #:
1625777


Modified date:
2013-02-18

Translate my page

Content navigation