Example #1
0
        /// <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();
 }
Example #4
0
        /// <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);
        }
Example #5
0
 internal KeyBindingUtil(CommandsSnapshot snapshot)
 {
     _snapshot = snapshot;
 }
Example #6
0
 internal KeyBindingUtil(CommandsSnapshot snapshot)
 {
     _snapshot = snapshot;
 }
Example #7
0
 internal KeyBindingUtil(CommandsSnapshot snapshot, HashSet<string> importantScopeSet)
 {
     _snapshot = snapshot;
     _importantScopeSet = importantScopeSet;
 }
Example #8
0
 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);
 }