// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/core/keybinding/KbaChangeSet.java
// enum Action {
//   ADD("add"),
//   REMOVE("remove"),
//   ;
// 
//   /**
//    * Label as it appears in the .kbd JSON file
//    */
//   private final String label;
// 
//   Action(String label) {
//     this.label = label;
//   }
// 
//   public static Action fromLabel(String someLabel) {
//     for (Action a : values()) {
//       if (a.label.equals(someLabel))
//         return a;
//     }
//     throw new IllegalArgumentException(String.format(
//         "'%s' is not a valid action",
//         someLabel));
//   }
// 
//   static Action forLabel(String label) {
//     for (Action action : values()) {
//       if (action.label.equals(label)) {
//         return action;
//       }
//     }
//     throw new IllegalArgumentException(label);
//   }
//     
//   @Override
//   public String toString() {
//     return label;
//   }
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/core/keybinding/KeyBindingsManualFormatter.java
// enum BindingType {
//   USER,
//   SYSTEM,
//   ;
//     
//   static BindingType from(Binding binding) {
//     return from(binding.getType());
//   }
//     
//   static BindingType from(int eclipseBindingType) {
//     if (eclipseBindingType == Binding.SYSTEM) {
//       return SYSTEM;
//     } else if (eclipseBindingType == Binding.USER) {
//       return USER;
//     } else {
//       throw new UnsupportedOperationException("Binding type: " + eclipseBindingType);
//     }
//   }
//     
// }


import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.Iterables;
import com.google.eclipse.mechanic.core.keybinding.KbaChangeSet.Action;
import com.google.eclipse.mechanic.core.keybinding.KeyBindingsManualFormatter.BindingType;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.jface.bindings.Binding;
import java.util.Map;
/*******************************************************************************
 * Copyright (C) 2011, 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.core.keybinding;




/**
 * This class has a 1-to-1 correspondence with Eclipse's {@link Binding}, except
 * with primitives (Strings) instead of Eclipse data structure.
 *
 * <p>Like {@link Binding}, this supports a null command (whereas
 * {@link KbaBinding} will not).
 *
 * <p>This only exists because these Eclipse data structures are not unit-testable.
 *
 * @author zorzella
 */
class EclBinding {
  
  private final String cid;
  private final Map<String, String> paramMap;
  private final String schemeId;
  private final String platform;
  private final String contextId;
  private final String keySequence;
  private final BindingType type;
  
  public EclBinding(final String cid,
      final Map<String, String> paramMap,
      final String schemeId,
      final String platform,
      final String contextId,
      final String keySequence,
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/core/keybinding/KbaChangeSet.java
// enum Action {
//   ADD("add"),
//   REMOVE("remove"),
//   ;
// 
//   /**
//    * Label as it appears in the .kbd JSON file
//    */
//   private final String label;
// 
//   Action(String label) {
//     this.label = label;
//   }
// 
//   public static Action fromLabel(String someLabel) {
//     for (Action a : values()) {
//       if (a.label.equals(someLabel))
//         return a;
//     }
//     throw new IllegalArgumentException(String.format(
//         "'%s' is not a valid action",
//         someLabel));
//   }
// 
//   static Action forLabel(String label) {
//     for (Action action : values()) {
//       if (action.label.equals(label)) {
//         return action;
//       }
//     }
//     throw new IllegalArgumentException(label);
//   }
//     
//   @Override
//   public String toString() {
//     return label;
//   }
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/core/keybinding/KeyBindingsManualFormatter.java
// enum BindingType {
//   USER,
//   SYSTEM,
//   ;
//     
//   static BindingType from(Binding binding) {
//     return from(binding.getType());
//   }
//     
//   static BindingType from(int eclipseBindingType) {
//     if (eclipseBindingType == Binding.SYSTEM) {
//       return SYSTEM;
//     } else if (eclipseBindingType == Binding.USER) {
//       return USER;
//     } else {
//       throw new UnsupportedOperationException("Binding type: " + eclipseBindingType);
//     }
//   }
//     
// }


// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/core/keybinding/EclBinding.java
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.Iterables;
import com.google.eclipse.mechanic.core.keybinding.KbaChangeSet.Action;
import com.google.eclipse.mechanic.core.keybinding.KeyBindingsManualFormatter.BindingType;
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.jface.bindings.Binding;
import java.util.Map;

/*******************************************************************************
 * Copyright (C) 2011, 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.core.keybinding;




/**
 * This class has a 1-to-1 correspondence with Eclipse's {@link Binding}, except
 * with primitives (Strings) instead of Eclipse data structure.
 *
 * <p>Like {@link Binding}, this supports a null command (whereas
 * {@link KbaBinding} will not).
 *
 * <p>This only exists because these Eclipse data structures are not unit-testable.
 *
 * @author zorzella
 */
class EclBinding {
  
  private final String cid;
  private final Map<String, String> paramMap;
  private final String schemeId;
  private final String platform;
  private final String contextId;
  private final String keySequence;
  private final BindingType type;
  
  public EclBinding(final String cid,
      final Map<String, String> paramMap,
      final String schemeId,
      final String platform,
      final String contextId,
      final String keySequence,
      final BindingType type) {