// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/core/MechanicPlugin.java
// public class MechanicPlugin extends AbstractUIPlugin {
// 
//   // The plug-in ID
//   public static final String PLUGIN_ID = "com.google.eclipse.mechanic";
// 
//   // The shared instance
//   private static MechanicPlugin plugin;
// 
//   private IMechanicPreferences mechanicPreferences;
// 
//   private volatile IPreferenceRecordingService preferenceRecordingService =
//       new PreferenceRecordingService();
// 
//   private PopupNotifier popupNotifier;
// 
//   public MechanicPlugin() {
//     plugin = this;
//   }
// 
//   @Override 
//   public void start(BundleContext context) throws Exception {
//     super.start(context);
// 
//     mechanicPreferences = new MechanicPreferences();
// 
//     // popup notifier must start before the mechanic service in order to
//     // catch the first statuses.
//     popupNotifier = new PopupNotifier(MechanicService.getInstance(), getMechanicPreferences());
//     popupNotifier.initialize();
// 
//     UriCaches.initialize();
// 
//     // immediately start the mechanic service
//     MechanicService.getInstance().start();
//   }
// 
//   @Override 
//   public void stop(BundleContext context) throws Exception {
//     MechanicService.getInstance().stop();
//     UriCaches.destroy();
//     popupNotifier.dispose();
//     TasksExtensionPoint.dispose();
//     ScannersExtensionPoint.dispose();
//     ResourceTaskProvidersExtensionPoint.dispose();
//     plugin = null;
//     super.stop(context);
//   }
// 
//   /**
//    * Keep this around as some of the generated code expects it.
//    * @return shared instance of this plug-in class
//    */
//   public static MechanicPlugin getDefault() {
//     return plugin;
//   }
// 
//   /**
//    * Returns an image descriptor for the image file at the given plug-in
//    * relative path
//    *
//    * @param path the path
//    * @return the image descriptor
//    */
//   public static ImageDescriptor getImageDescriptor(String path) {
//     return imageDescriptorFromPlugin(PLUGIN_ID, path);
//   }
// 
//   public IPreferenceRecordingService getPreferenceRecordingService() {
//     if (preferenceRecordingService == null) {
//       preferenceRecordingService = new PreferenceRecordingService();
//     }
// 
//     return preferenceRecordingService;
//   }
// 
//   public IMechanicPreferences getMechanicPreferences() {
//     return mechanicPreferences;
//   }
// }


import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import com.google.common.collect.Lists;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;
   * @param forcePluginActivationAttr the attribute name representing whether the class should be
   * instantiated even if the plugin hasn't been activated. When this is {@code null} it means the
   * extension point doesn't support variable plugin activation, and classes will be instantiated
   * even if that means starting 
   * @return A list of {@code SimpleProxy} items which can be passed to {@link #activateProxies(Collection)}
   */
  public static <T> SimpleExtensionPointManager<T> newInstance(
      String extensionPointName,
      Class<T> klass,
      String elementName,
      String classNameAttr,
      String forcePluginActivationAttr) {
    return new SimpleExtensionPointManager<T>(
        extensionPointName, klass, elementName, classNameAttr, forcePluginActivationAttr);
  }

  private List<SimpleProxy<T>> createProxies(
      String extensionPointName,
      Class<T> klass,
      String elementName,
      String classNameAttr,
      String forcePluginActivationAttr) {
    List<SimpleProxy<T>> proxies = Lists.newArrayList();

    // Load the reference to the extension.
    IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
        MechanicPlugin.PLUGIN_ID, extensionPointName);

    if (point == null) {
      LOG.log(Level.SEVERE,
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/core/MechanicPlugin.java
// public class MechanicPlugin extends AbstractUIPlugin {
// 
//   // The plug-in ID
//   public static final String PLUGIN_ID = "com.google.eclipse.mechanic";
// 
//   // The shared instance
//   private static MechanicPlugin plugin;
// 
//   private IMechanicPreferences mechanicPreferences;
// 
//   private volatile IPreferenceRecordingService preferenceRecordingService =
//       new PreferenceRecordingService();
// 
//   private PopupNotifier popupNotifier;
// 
//   public MechanicPlugin() {
//     plugin = this;
//   }
// 
//   @Override 
//   public void start(BundleContext context) throws Exception {
//     super.start(context);
// 
//     mechanicPreferences = new MechanicPreferences();
// 
//     // popup notifier must start before the mechanic service in order to
//     // catch the first statuses.
//     popupNotifier = new PopupNotifier(MechanicService.getInstance(), getMechanicPreferences());
//     popupNotifier.initialize();
// 
//     UriCaches.initialize();
// 
//     // immediately start the mechanic service
//     MechanicService.getInstance().start();
//   }
// 
//   @Override 
//   public void stop(BundleContext context) throws Exception {
//     MechanicService.getInstance().stop();
//     UriCaches.destroy();
//     popupNotifier.dispose();
//     TasksExtensionPoint.dispose();
//     ScannersExtensionPoint.dispose();
//     ResourceTaskProvidersExtensionPoint.dispose();
//     plugin = null;
//     super.stop(context);
//   }
// 
//   /**
//    * Keep this around as some of the generated code expects it.
//    * @return shared instance of this plug-in class
//    */
//   public static MechanicPlugin getDefault() {
//     return plugin;
//   }
// 
//   /**
//    * Returns an image descriptor for the image file at the given plug-in
//    * relative path
//    *
//    * @param path the path
//    * @return the image descriptor
//    */
//   public static ImageDescriptor getImageDescriptor(String path) {
//     return imageDescriptorFromPlugin(PLUGIN_ID, path);
//   }
// 
//   public IPreferenceRecordingService getPreferenceRecordingService() {
//     if (preferenceRecordingService == null) {
//       preferenceRecordingService = new PreferenceRecordingService();
//     }
// 
//     return preferenceRecordingService;
//   }
// 
//   public IMechanicPreferences getMechanicPreferences() {
//     return mechanicPreferences;
//   }
// }


// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/SimpleExtensionPointManager.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import com.google.common.collect.Lists;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;

   * @param forcePluginActivationAttr the attribute name representing whether the class should be
   * instantiated even if the plugin hasn't been activated. When this is {@code null} it means the
   * extension point doesn't support variable plugin activation, and classes will be instantiated
   * even if that means starting 
   * @return A list of {@code SimpleProxy} items which can be passed to {@link #activateProxies(Collection)}
   */
  public static <T> SimpleExtensionPointManager<T> newInstance(
      String extensionPointName,
      Class<T> klass,
      String elementName,
      String classNameAttr,
      String forcePluginActivationAttr) {
    return new SimpleExtensionPointManager<T>(
        extensionPointName, klass, elementName, classNameAttr, forcePluginActivationAttr);
  }

  private List<SimpleProxy<T>> createProxies(
      String extensionPointName,
      Class<T> klass,
      String elementName,
      String classNameAttr,
      String forcePluginActivationAttr) {
    List<SimpleProxy<T>> proxies = Lists.newArrayList();

    // Load the reference to the extension.
    IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(
        MechanicPlugin.PLUGIN_ID, extensionPointName);

    if (point == null) {
      LOG.log(Level.SEVERE,
          "Cannot load extension point " + MechanicPlugin.PLUGIN_ID + "/" + extensionPointName);