// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/TaskType.java
// public enum TaskType {
//   /**
//    * Indicates the task should only overwrite preferences if the file's 
//    * modification date is earlier than the changes.
//    */
//   LASTMOD,
//   
//   /**
//    * Indicates the task should overwrite any preferences that are different 
//    * from the values listed the one written here.
//    */
//   RECONCILE
// }
// 
// 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.io.File;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.eclipse.mechanic.internal.TaskType;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;

  protected Text createTextBox(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    text.addModifyListener(validateOnChange);
    return text;
  }

  @Override
  protected Control createDialogArea(Composite parent) {
    final Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout(3, false);
    container.setLayout(layout);

    if (components.contains(Component.TITLE)) {
      createLabel(container, "Title:");
      titleText = createTextBox(container);
      titleText.setEnabled(components.contains(Component.TITLE));
    }

    if (components.contains(Component.DESCRIPTION)) {
      createLabel(container, "Description:");
      descriptionText = createTextBox(container);
      descriptionText.setEnabled(components.contains(Component.DESCRIPTION));
    }

    if (components.contains(Component.TASK_TYPE)) {
      createLabel(container, "Task Type:");
      taskTypeCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
      // Ensuring the order hasn't changed, as we rely on that.
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/TaskType.java
// public enum TaskType {
//   /**
//    * Indicates the task should only overwrite preferences if the file's 
//    * modification date is earlier than the changes.
//    */
//   LASTMOD,
//   
//   /**
//    * Indicates the task should overwrite any preferences that are different 
//    * from the values listed the one written here.
//    */
//   RECONCILE
// }
// 
// 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/plugin/ui/BaseOutputDialog.java
import java.io.File;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.eclipse.mechanic.internal.TaskType;
import com.google.eclipse.mechanic.plugin.core.MechanicPlugin;


  protected Text createTextBox(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    text.addModifyListener(validateOnChange);
    return text;
  }

  @Override
  protected Control createDialogArea(Composite parent) {
    final Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout(3, false);
    container.setLayout(layout);

    if (components.contains(Component.TITLE)) {
      createLabel(container, "Title:");
      titleText = createTextBox(container);
      titleText.setEnabled(components.contains(Component.TITLE));
    }

    if (components.contains(Component.DESCRIPTION)) {
      createLabel(container, "Description:");
      descriptionText = createTextBox(container);
      descriptionText.setEnabled(components.contains(Component.DESCRIPTION));
    }

    if (components.contains(Component.TASK_TYPE)) {
      createLabel(container, "Task Type:");
      taskTypeCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY);
      // Ensuring the order hasn't changed, as we rely on that.
      Preconditions.checkState(TaskType.values()[0] == TaskType.LASTMOD);