public MainChecker(Lifetime lifetime, TutStep.TutorialStep step, ISolution solution, IPsiFiles psiFiles, TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager, DocumentManager documentManager) { _lifetime = lifetime; _currentStep = step; _solution = solution; _textControlManager = textControlManager; _documentManager = documentManager; _editorManager = editorManager; if (step.Check.Actions != null) { _stepActionChecker = new StepActionChecker(lifetime, shellLocks, psiFiles); } if (step.Check.Method == null) { return; } _stepPsiChecker = new StepPsiChecker(lifetime, solution, psiFiles, shellLocks); _stepNavigationChecker = new StepNavigationChecker(lifetime, solution, psiFiles, textControlManager, shellLocks); }
public void Navigate(TutStep.TutorialStep step) { if (step.NavNode == null) { return; } if (step.NavNode.RunMethod != null) { RunCustomNavigation(step.NavNode.RunMethod); return; } if (step.NavNode.TypeName == null && step.NavNode.MethodName == null && step.NavNode.TextToFind == null) { return; } _shellLocks.ExecuteOrQueueReadLock(_lifetime, "Navigate", () => { _psiFiles.CommitAllDocumentsAsync(() => { var project = PsiNavigationHelper.GetProjectByName(_solution, step.NavNode.ProjectName); var file = PsiNavigationHelper.GetCSharpFile(project, step.NavNode.FileName); var node = PsiNavigationHelper.GetTreeNodeForStep(file, step.NavNode.TypeName, step.NavNode.MethodName, step.NavNode.MethodNameOccurrence, step.NavNode.TextToFind, step.NavNode.TextToFindOccurrence); if (node == null) { MessageBox.ShowExclamation("OOPS! Someone has changed the code in an unexpected way. " + "That wasn't you, right?;) Anyway, now it would be better to restart tutorial."); } else { PsiNavigationHelper.NavigateToNode(_documentManager, _editorManager, node, true); } }); }); }