Community
Participate
Working Groups
202 - Stream. Need this to fix bug 21347. Scenario from bug 21347: When new features are installed they need to start their perspective and welcome editor as well as run code to configure the default perspective and default editors. So the workbench is opening perspectives and welcome editors for all new features and activating the feature plugin so they can run code to configure that workbench. The problem: When the workbench is started it gets a list of features by using the API "IPlatformConfiguration().getConfiguredFeatureEntries()". And this API is returning all the features including the ones that the user did not enable yet so that the workbench can't compute what are the new features after the user enables the new installed features. These features are not installed usind the update manager. They are copied to the file system instead. Options: a) change getConfiguredFeatureEntries() to return only the enable features. b) new API c) command line to say enable all new installed features. The option 'c)' is the prefered one.
You called the wrong API. This is what you need to call: try { // get the local site handle ILocalSite localSite = SiteManager.getLocalSite(); // get the current configuration IInstallConfiguration config = localSite.getCurrentConfiguration(); // loop through the configured sites IConfiguredSite [] csites = config.getConfiguredSites(); for (int i=0; i<csites.length; i++) { IConfiguredSite csite = csites[i]; // get handles to the configured features in the site IFeatureReference [] crefs = csite.getConfiguredFeatures(); for (j=0; j<crefs.length; j++) { IFeatureReference cref = crefs[j]; try { // get the feature from the handle IFeature feature = cref.getFeature(); } catch (CoreException ex) { // cannot load the feature } } } } catch (CoreException e) { } Configured sites are sites that are known to the configuration. In a simple product installation, there will be only one (default) configured site containing all the features. In a complex product installation where there is the initial product and links to product extensions, there will be a configured site for the product itself and a site for each linked extension.
A very important point in the code above is that we called 'IConfiguredSite.getConfiguredFeatures'. If we called 'IConfiguredSite.getFeatureReferences', we would get references to ALL the features in the site, both configured and unconfigured.
Released change using proposed code and it worked.
I will resolve this bug since the required API exists and the sample code has been provided.