/// <summary> /// Find all of the key bindings which have been removed /// </summary> internal static List<CommandKeyBinding> FindKeyBindingsMarkedAsRemoved(this ILegacySettings settings, CommandsSnapshot commandsSnapshot) { var list = new List<CommandKeyBinding>(); if (!settings.HaveUpdatedKeyBindings) { return list; } var map = new Dictionary<string, CommandId>(); foreach (var commandKeyBinding in commandsSnapshot.CommandKeyBindings) { map[commandKeyBinding.Name] = commandKeyBinding.Id; } foreach (var commandBindingSetting in settings.RemovedBindings) { CommandId id; KeyBinding binding; if (KeyBinding.TryParse(commandBindingSetting.CommandString, out binding) && map.TryGetValue(commandBindingSetting.Name, out id)) { list.Add(new CommandKeyBinding( id, commandBindingSetting.Name, binding)); } } return list; }
public CommandKeyBindingSnapshot( CommandsSnapshot snapshot, IEnumerable<CommandKeyBinding> removed, IEnumerable<CommandKeyBinding> conflicting) { _snapshot = snapshot; _removedBindings = removed.ToList().AsReadOnly(); _conflictingBindings = conflicting.ToList().AsReadOnly(); }
public CommandKeyBindingSnapshot( CommandsSnapshot snapshot, IEnumerable <CommandKeyBinding> removed, IEnumerable <CommandKeyBinding> conflicting) { _snapshot = snapshot; _removedBindings = removed.ToList().AsReadOnly(); _conflictingBindings = conflicting.ToList().AsReadOnly(); }
/// <summary> /// Find all of the key bindings which have been removed /// </summary> internal static List <CommandKeyBinding> FindKeyBindingsMarkedAsRemoved(this ILegacySettings settings, CommandsSnapshot commandsSnapshot) { var list = new List <CommandKeyBinding>(); if (!settings.HaveUpdatedKeyBindings) { return(list); } var map = new Dictionary <string, CommandId>(); foreach (var commandKeyBinding in commandsSnapshot.CommandKeyBindings) { map[commandKeyBinding.Name] = commandKeyBinding.Id; } foreach (var commandBindingSetting in settings.RemovedBindings) { CommandId id; KeyBinding binding; if (KeyBinding.TryParse(commandBindingSetting.CommandString, out binding) && map.TryGetValue(commandBindingSetting.Name, out id)) { list.Add(new CommandKeyBinding( id, commandBindingSetting.Name, binding)); } } return(list); }
internal KeyBindingUtil(CommandsSnapshot snapshot) { _snapshot = snapshot; }
internal KeyBindingUtil(CommandsSnapshot snapshot, HashSet<string> importantScopeSet) { _snapshot = snapshot; _importantScopeSet = importantScopeSet; }
private static KeyBindingUtil Create(params string[] args) { var all = MockObjectFactory.CreateCommandList(args).Select(x => x.Object); var snapshot = new CommandsSnapshot(all); return new KeyBindingUtil(snapshot); }