# HG changeset patch # User wpaul # Date 1282178946 18000 # Node ID dc0f51078b9e451b03fe97c812d7eacad68ec7de # Parent 5741137411ecd99f2f3adfe9443a2b252e8f0426 allow feature tracker to support multiple clients. cleaned up feature constants. diff -r 5741137411ec -r dc0f51078b9e core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerConsts.java --- a/core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerConsts.java Wed Aug 18 18:51:04 2010 -0500 +++ b/core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerConsts.java Wed Aug 18 19:49:06 2010 -0500 @@ -16,12 +16,9 @@ public class FeatureUseTrackerConsts { public static final String CARBIDE_APP_TRK = "Carbide_App_TRK"; - public static final String CARBIDE_CUSTKITS = "Carbide_CustKits"; // deprecated public static final String CARBIDE_UI_DESIGNER = "Carbide_UI_Designer"; - public static final String CARBIDE_KERNELAWARE = "Carbide_KernelAware"; // symbian os data view public static final String CARBIDE_SYS_TRK = "Carbide_Sys_TRK"; public static final String CARBIDE_PROFILER = "Carbide_Profiler"; - public static final String CARBIDE_APPDEP = "Carbide_AppDep"; // dependency explorer public static final String CARBIDE_CODESCANNER = "Carbide_CodeScanner"; public static final String CARBIDE_OST_TRACE = "Carbide_OST_Trace"; public static final String CARBIDE_IDE = "Carbide_IDE"; // did user launch IDE diff -r 5741137411ec -r dc0f51078b9e core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerProxy.java --- a/core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerProxy.java Wed Aug 18 18:51:04 2010 -0500 +++ b/core/com.nokia.carbide.cpp.featureTracker/src/com/nokia/carbide/cpp/internal/featureTracker/FeatureUseTrackerProxy.java Wed Aug 18 19:49:06 2010 -0500 @@ -13,6 +13,9 @@ package com.nokia.carbide.cpp.internal.featureTracker; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; @@ -24,7 +27,6 @@ /** * Proxy to a client implementing the 'featureUseTracker' extension point. - * There can only be one client registered as a time to this extension. * */ public class FeatureUseTrackerProxy implements IFeatureUseTracker { @@ -32,40 +34,31 @@ public static final String FEATURE_USE_EXTENSION_ID = FeatureUseTrackerPlugin.PLUGIN_ID + ".featureUseTracker"; //$NON-NLS-1$ - private IFeatureUseTracker featureClient; + private List featureClients = new ArrayList(); private boolean featureClientInited; public void startUsingFeature(String featureName) { - if (featureClient == null && featureClientInited) { - return; // no client plug-in installed, do nothing because we've all ready checked - - } else if (featureClient == null) { - featureClient = checkForFeatureExtension(); + if (!featureClientInited) { + checkForClients(); featureClientInited = true; } - if (featureClient != null) { - featureClient.startUsingFeature(featureName); + for (IFeatureUseTracker client : featureClients) { + client.startUsingFeature(featureName); } - } public void stopUsingFeature(String featureName) { - if (featureClient == null) { - return; // no feature client, nothing to do - } else { - featureClient.stopUsingFeature(featureName); + for (IFeatureUseTracker client : featureClients) { + client.stopUsingFeature(featureName); } - } /** - * Find clients of the 'featureUseTracker' extension point and return the first one - * @return the first client that is found implementing IFeatureUseTracker + * Find clients of the 'featureUseTracker' extension point */ - private IFeatureUseTracker checkForFeatureExtension() { + private void checkForClients() { - IFeatureUseTracker result = null; IExtensionRegistry er = Platform.getExtensionRegistry(); IExtensionPoint ep = er.getExtensionPoint(FEATURE_USE_EXTENSION_ID); IExtension[] extensions = ep.getExtensions(); @@ -80,22 +73,15 @@ if (providerElement.getAttribute("class") != null) { //$NON-NLS-1$ try { - result = (IFeatureUseTracker) providerElement - .createExecutableExtension("class"); //$NON-NLS-1$ + featureClients.add((IFeatureUseTracker) providerElement + .createExecutableExtension("class")); //$NON-NLS-1$ } catch (CoreException e) { // ignore - // e.printStackTrace(); } - return result; - } - } - } } - return result; - } }