public void ExecuteBinding(CommandKeyBinding binding) { if (binding != null && binding.IsAvailable) { binding.Execute(); } }
private void FillCustomDataBindingsRecursive(TreeListNodes nodes) { if (nodes == null || nodes.Count == 0 || _CustomInputShortcut == null) { return; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Tag is CommandKeyFolder) { FillCustomDataBindingsRecursive(nodes[i].Nodes); } else { CommandKeyBinding binding = nodes[i].Tag as CommandKeyBinding; if (binding == null) { continue; } if (binding.Matches(_CustomInputShortcut) == MatchQuality.FullMatch) { _CustomInputBindings.Add(nodes[i]); } } } }
private CommandKeyBinding Load(DecoupledStorage storage, string folderName) { if (storage == null) { return(null); } CommandKeyBinding lLastSelected = null; Hashtable lFolders = storage.GetSubFolders(folderName); foreach (DictionaryEntry lEntry in lFolders) { string lFolderName = (string)lEntry.Key; CommandKeyFolder lNewFolder = new CommandKeyFolder(this); CommandKeyBinding lLastSelectedInFolder = lNewFolder.Load(storage, lFolderName); if (lLastSelectedInFolder != null) { lLastSelected = lLastSelectedInFolder; } } _Name = ProcessFolderName(folderName); _Name = CodeRush.StrUtil.DecodeName(_Name); storage.FolderName = folderName; CommandKeyBinding lLastSelectedInBindings = LoadThisFolder(storage); if (lLastSelected == null) { lLastSelected = lLastSelectedInBindings; } return(lLastSelected); }
private void FillCommandsRecursive(TreeListNodes nodes) { if (nodes == null || nodes.Count == 0) { return; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Tag is CommandKeyFolder) { FillCommandsRecursive(nodes[i].Nodes); } else { CommandKeyBinding lBinding = nodes[i].Tag as CommandKeyBinding; if (lBinding == null) { continue; } if (lBinding.Command != null && lBinding.Command == CommandName) { _CommandBindings.Add(nodes[i]); } } } }
protected void SaveBindings(DecoupledStorage storage, CommandKeyBinding lastSelected) { if (storage == null) { return; } _CommandBindings.Save(storage, lastSelected); }
public void RemoveBinding(CommandKeyBinding binding) { if (binding == null) { return; } binding.SetParentFolder(null); _CommandBindings.Remove(binding); }
public void AddBinding(CommandKeyBinding binding) { if (binding == null) { return; } binding.SetParentFolder(this); _CommandBindings.Add(binding); }
public void Save(string category, string pageName, CommandKeyBinding lastSelected) { using (DecoupledStorage lStorage = new DecoupledStorage(category, pageName)) { lStorage.LoadSubFolders(); RemoveDeletedFolders(lStorage); lStorage.ClearAll(); Save(lStorage, lastSelected); } }
// protected methods... #region SaveThisFolder(DecoupledStorage storage, CommandKeyBinding lastSelected) protected void SaveThisFolder(DecoupledStorage storage, CommandKeyBinding lastSelected) { if (storage == null) { return; } SaveFolderInfo(storage); SaveBindings(storage, lastSelected); }
public CommandKeyBinding Find(EditorCustomInputEventArgs ea) { CommandKeyBinding keyInBindings = _CommandBindings.Find(ea); if (keyInBindings != null) { return(keyInBindings); } return(FindInFolders(ea)); }
public CommandKeyBinding Find(string name) { CommandKeyBinding lKeyInBindings = _CommandBindings.Find(name); if (lKeyInBindings != null) { return(lKeyInBindings); } return(FindInFolders(name)); }
public CommandKeyBinding Load(string category, string pageName) { CommandKeyBinding lResult = null; using (DecoupledStorage lStorage = new DecoupledStorage(category, pageName)) { lStorage.LoadSubFolders(); lResult = Load(lStorage, ""); } return(lResult); }
public void Save(DecoupledStorage aDecoupledStorage, CommandKeyBinding lastSelected) { aDecoupledStorage.WriteInt32("Header", "Count", Count); int lIndex = 0; foreach (CommandKeyBinding lCommandKeyBinding in this) { lCommandKeyBinding.Save(aDecoupledStorage, "Command" + lIndex.ToString(), lastSelected == lCommandKeyBinding); lIndex++; } }
public CommandKeyBindingCollection Clone() { CommandKeyBindingCollection lNewCollection = new CommandKeyBindingCollection(); for (int i = 0; i < this.Count; i++) { CommandKeyBinding lNewBinding = this[i].Clone(); lNewCollection.Add(lNewBinding); } return(lNewCollection); }
private void Save(DecoupledStorage storage, CommandKeyBinding lastSelected) { if (storage == null) { return; } string lFolderName = TreePath; storage.FolderName = lFolderName.Trim(STR_PathSeparator[0]); storage.Clear(); //if (CommandBindings.Count != 0) SaveThisFolder(storage, lastSelected); SaveSubFolders(storage, lastSelected); }
public CommandKeyBinding Clone() { CommandKeyBinding result = new CommandKeyBinding(); result.Command = Command; result.Comments = Comments; result.CustomData = CustomData; result.Parameters = Parameters; result.SetContext(Context); result.AltKeyDown = AltKeyDown; result.CtrlKeyDown = CtrlKeyDown; result.AnyShiftModifier = AnyShiftModifier; result.ShiftKeyDown = ShiftKeyDown; return(result); }
private CommandKeyBinding FindInFolders(EditorCustomInputEventArgs ea) { if (_Folders == null) { return(null); } for (int i = 0; i < _Folders.Count; i++) { CommandKeyFolder folder = _Folders[i] as CommandKeyFolder; CommandKeyBinding lBinding = folder.Find(ea); if (lBinding != null) { return(lBinding); } } return(null); }
private CommandKeyBinding FindInFolders(string name) { if (_Folders == null) { return(null); } for (int i = 0; i < _Folders.Count; i++) { CommandKeyFolder lFolder = _Folders[i] as CommandKeyFolder; CommandKeyBinding lBinding = lFolder.Find(name); if (lBinding != null) { return(lBinding); } } return(null); }
/// <summary> /// Loads the command key bindings from storage. /// </summary> /// <param name="aDecoupledStorage"></param> /// <returns>Returns the most recently selected command key binding.</returns> public CommandKeyBinding Load(DecoupledStorage aDecoupledStorage, CommandKeyFolder parentFolder) { Clear(); CommandKeyBinding lLastSelected = null; CommandKeyBinding lCommandKeyBinding = null; int thisCount = aDecoupledStorage.ReadInt32("Header", "Count", Count); for (int i = 0; i < thisCount; i++) { lCommandKeyBinding = new CommandKeyBinding(); lCommandKeyBinding.SetParentFolder(parentFolder); if (lCommandKeyBinding.Load(aDecoupledStorage, "Command" + i.ToString())) { lLastSelected = lCommandKeyBinding; } Add(lCommandKeyBinding); } return(lLastSelected); }
private void SaveSubFolders(DecoupledStorage storage, CommandKeyBinding lastSelected) { if (storage == null || _Folders == null) { return; } for (int i = 0; i < _Folders.Count; i++) { CommandKeyFolder lFolder = _Folders[i] as CommandKeyFolder; if (lFolder == null) { continue; } if (!lFolder.IsDeleted) { lFolder.Save(storage, lastSelected); } } }
public void Remove(CommandKeyBinding aCommandKeyBinding) { InnerList.Remove(aCommandKeyBinding); }
// public methods... #region Add public void Add(CommandKeyBinding aCommandKeyBinding) { InnerList.Add(aCommandKeyBinding); }