// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/TaskScanner.java
// public interface TaskScanner {
// 
//   /**
//    * Adds Tasks to the supplied collector.
//    *
//    * @param collector the collector of {@link Task}s.
//    */
//   void scan(TaskCollector collector);
// 
// }
// 
// 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.List;
import org.eclipse.core.runtime.Platform;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.eclipse.mechanic.TaskScanner;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;
/*******************************************************************************
 * Copyright (C) 2009, Google Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package com.google.eclipse.mechanic.internal;




/**
 * Code behind the {@code com.google.eclipse.mechanic.scanners} extension point.
 *
 * <p>This class interfaces with the {@link Platform}, reading all extensions of the
 * {@code scanners} extension point, providing a mechanism for translating their
 * implementations to instances of {@link TaskScanner}.
 */
public class ScannersExtensionPoint {
  private static final String EXTENSION_POINT_NAME = "scanners";
  private static final String TAG_SCANNER = "scanner";
  private static final String ATTR_CLASS = "class";

  // Initialization On Demand Holder Idiom
  // http://crazybob.org/2007/01/lazy-loading-singletons.html
  private static class SingletonHolder {
    static SimpleExtensionPointManager<TaskScanner> instance =
        SimpleExtensionPointManager.newInstance(
            EXTENSION_POINT_NAME,
            TaskScanner.class,
            TAG_SCANNER,
            ATTR_CLASS,
            null);
  }

  private ScannersExtensionPoint() {
  }

  /**
   * Return the {@link TaskScanner} supplier, initializing it if required.
   *
   * <p>The supplier is memoized, so it will return the same instantiated
   * objects upon repeated calls.
   */
  public static Supplier<List<TaskScanner>> getInstance() {
    return Suppliers.memoize(new Supplier<List<TaskScanner>>() {
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/TaskScanner.java
// public interface TaskScanner {
// 
//   /**
//    * Adds Tasks to the supplied collector.
//    *
//    * @param collector the collector of {@link Task}s.
//    */
//   void scan(TaskCollector collector);
// 
// }
// 
// 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/ScannersExtensionPoint.java
import java.util.List;
import org.eclipse.core.runtime.Platform;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.eclipse.mechanic.TaskScanner;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;

/*******************************************************************************
 * Copyright (C) 2009, Google Inc.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

package com.google.eclipse.mechanic.internal;




/**
 * Code behind the {@code com.google.eclipse.mechanic.scanners} extension point.
 *
 * <p>This class interfaces with the {@link Platform}, reading all extensions of the
 * {@code scanners} extension point, providing a mechanism for translating their
 * implementations to instances of {@link TaskScanner}.
 */
public class ScannersExtensionPoint {
  private static final String EXTENSION_POINT_NAME = "scanners";
  private static final String TAG_SCANNER = "scanner";
  private static final String ATTR_CLASS = "class";

  // Initialization On Demand Holder Idiom
  // http://crazybob.org/2007/01/lazy-loading-singletons.html
  private static class SingletonHolder {
    static SimpleExtensionPointManager<TaskScanner> instance =
        SimpleExtensionPointManager.newInstance(
            EXTENSION_POINT_NAME,
            TaskScanner.class,
            TAG_SCANNER,
            ATTR_CLASS,
            null);
  }

  private ScannersExtensionPoint() {
  }

  /**
   * Return the {@link TaskScanner} supplier, initializing it if required.
   *
   * <p>The supplier is memoized, so it will return the same instantiated
   * objects upon repeated calls.
   */
  public static Supplier<List<TaskScanner>> getInstance() {
    return Suppliers.memoize(new Supplier<List<TaskScanner>>() {
      public List<TaskScanner> get() {