Bug 24454 - Need to compute the list of new installed features.
Summary: Need to compute the list of new installed features.
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 2.0.2   Edit
Hardware: PC Windows 2000
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Platform-Update-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 21347
  Show dependency tree
 
Reported: 2002-10-07 11:01 EDT by Eduardo Pereira CLA
Modified: 2002-10-07 14:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Pereira CLA 2002-10-07 11:01:57 EDT
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.
Comment 1 Dejan Glozic CLA 2002-10-07 11:28:26 EDT
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. 
Comment 2 Dejan Glozic CLA 2002-10-07 11:30:16 EDT
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.
Comment 3 Eduardo Pereira CLA 2002-10-07 14:15:03 EDT
Released change using proposed code and it worked.
Comment 4 Dejan Glozic CLA 2002-10-07 14:24:35 EDT
I will resolve this bug since the required API exists and the sample code has 
been provided.