How can I obtain the version number of a custom Eclipse feature at runtime? -
I would like to display the version number of a custom eclipse feature which I am developing in the title bar of its perspective. Is there a way to get version number from runtime plugin and / or workbench?
Something like this:
Platform.getBundle ("my.feature .id "). GetHeaders (). Receive ("bundle-version"); should do the trick.
Note that this can not be used anywhere in the plugin:
This.getBundle () is not valid when Up to super.start (BundleContext) has been called on your plugin.
so if you are using this.getBundle ()) inside your constructor or initially (bundlanktext) before calling super .start () Then this blank space will return.
If it fails, then you have it here:
public stable string getPlatformVersion () {string version = zero; Try {dictionary = org.eclipse.ui.internal.WorkbenchPlugin.getDefault (). GetBundle () GetHeaders (); Version = (string) dictionarygate ("bundle-version"); // $ NON-NLS-1 $} Catch (Knocksfuffed Error E) {version = getProductVersion (); } Return Version; } Public stable string getProductVersion () {string version = zero; Try {// This approach fails in "Ration Application Developer 6.0.1" IProduct product = Platform.getProduct (); String aboutText = product.getProperty ("aboutText"); // $ NON-NLS-1 $ string pattern = "version: (. *) \ N"; // $ NON-NLS-1 $ pattern P = pattern. Com (pattern); Matcher M = P. Metture (approximate text); Boolean found = m.fund (); If (found) {version = m.group (1); }} Hold (exception e) {} return version; }
Comments
Post a Comment