// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/RepairDecisionProvider.java
// public interface RepairDecisionProvider {
// 
//   /**
//    * Represents a user's decision to proceed or abort.
//    */
//   public enum ResponseStatus {
//     OK,
//     CANCEL
//   }
// 
//   /**
//    * Represents the possible actions a user can select for an Task.
//    */
//   public enum Decision {
// 
//     YES,
//     NO,
//     NEVER;
// 
//     public static Decision valueOf(int ord) {
//       return Decision.values()[ord];
//     }
//   }
// 
//   /**
//    * Provides implementations an opportunity to collect information
//    * from the user. Will be called before getDecisions() is called.
//    * 
//    * Returns the response status for this repair action. If the status is
//    * {@code ResponseStatus.OK}, then the service should proceed to evaluate
//    * individual repair decisions, else, the service should abort the operation.
//    */
//   public ResponseStatus initialize(List<Task> failing);
// 
//   /**
//    * Returns map of {@link Task} to the user's choice for that Task.
//    */
//   public Map<Task, Decision> getDecisions();
// 
// }


import com.google.eclipse.mechanic.Task;
import com.google.eclipse.mechanic.RepairDecisionProvider;
import org.eclipse.ui.IWorkbenchWindow;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/*******************************************************************************
 * 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.plugin.ui;




/**
 * Adapts MechanicDialog to the RepairDecisionProvider interface as needed by
 * {@link com.google.eclipse.mechanic.RepairManager}.
 *
 * @author smckay@google.com (Steve McKay)
 */
class UserChoiceDecisionProvider implements RepairDecisionProvider {

  private final IWorkbenchWindow window;

// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/RepairDecisionProvider.java
// public interface RepairDecisionProvider {
// 
//   /**
//    * Represents a user's decision to proceed or abort.
//    */
//   public enum ResponseStatus {
//     OK,
//     CANCEL
//   }
// 
//   /**
//    * Represents the possible actions a user can select for an Task.
//    */
//   public enum Decision {
// 
//     YES,
//     NO,
//     NEVER;
// 
//     public static Decision valueOf(int ord) {
//       return Decision.values()[ord];
//     }
//   }
// 
//   /**
//    * Provides implementations an opportunity to collect information
//    * from the user. Will be called before getDecisions() is called.
//    * 
//    * Returns the response status for this repair action. If the status is
//    * {@code ResponseStatus.OK}, then the service should proceed to evaluate
//    * individual repair decisions, else, the service should abort the operation.
//    */
//   public ResponseStatus initialize(List<Task> failing);
// 
//   /**
//    * Returns map of {@link Task} to the user's choice for that Task.
//    */
//   public Map<Task, Decision> getDecisions();
// 
// }


// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/ui/UserChoiceDecisionProvider.java
import com.google.eclipse.mechanic.Task;
import com.google.eclipse.mechanic.RepairDecisionProvider;
import org.eclipse.ui.IWorkbenchWindow;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/*******************************************************************************
 * 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.plugin.ui;




/**
 * Adapts MechanicDialog to the RepairDecisionProvider interface as needed by
 * {@link com.google.eclipse.mechanic.RepairManager}.
 *
 * @author smckay@google.com (Steve McKay)
 */
class UserChoiceDecisionProvider implements RepairDecisionProvider {

  private final IWorkbenchWindow window;

  private Map<Task, RepairDecisionProvider.Decision> decisions