private static void OnRefactorComplete(object sender, RefactorCompleteEventArgs <IDictionary <string, List <SearchMatch> > > e) { if (currentCommand.OutputResults) { foreach (KeyValuePair <string, List <SearchMatch> > entry in currentCommand.Results) { string path = entry.Key; if (!results.ContainsKey(path)) { results[path] = new List <SearchMatch>(); } results[path].AddRange(entry.Value); } } if (queue.Count > 0) { ExecuteFirst(); } else { if (results.Count > 0) { ReportResults(); } results.Clear(); currentCommand = null; } }
private static void ExecuteFirst() { try { QueueItem item = queue[0]; queue.Remove(item); currentCommand = CommandFactoryProvider.DefaultFactory.CreateMoveCommand(item.OldPathToNewPath, item.OutputResults, item.Renaming, item.UpdatePackages); currentCommand.OnRefactorComplete += OnRefactorComplete; currentCommand.Execute(); } catch (Exception ex) { queue.Clear(); results.Clear(); currentCommand = null; ErrorManager.ShowError(ex); } }
public void AddCommand(RefactorCommand command) { // Commands are added after a method returns and methods return whatever // they last executed. This means that a method which calls a method which // returns an edit will attempt to add the edit twice. This is bad so we // check for it here. if (m_commands.Count == 0 || m_commands[m_commands.Count - 1] != command) m_commands.Add(command); }