private void CommandEventsOnAfterExecute(string guid, int id1, object customIn, object customOut) { if (_vsInstance == null) { return; } var command = _vsInstance.Commands.Item(guid, id1); //string logLine = $"Name:{command.Name} | GUID:{command.Guid} | ID:{command.ID}"; //Logger.Log(logLine); foreach (var actionName in StepActionNames) { if (command.Name != actionName) { continue; } if (Check == null) { OnCheckPass.Fire(true); } else { _shellLocks.QueueReadLock("StepActionChecker.CheckOnAfterAction", () => _psiFiles.CommitAllDocumentsAsync(CheckCode)); } } }
public GotoWordController( [NotNull] Lifetime lifetime, [NotNull] IShellLocks locks, [NotNull] IProjectModelElement projectElement, [CanBeNull] ITextControl textControl) : base(lifetime, new GotoByNameModel(lifetime), locks) { myLocks = locks; myTextControl = textControl; myProjectElement = projectElement; var projectFile = projectElement as IProjectFile; if (projectFile != null) { myCurrentFile = projectFile.ToSourceFile(); } lifetime.AddAction(DropHighlightings); SelectedItem = new Property <object>(lifetime, "SelectedItem"); SelectedItem.Change.Advise(lifetime, x => { if (x.HasNew) { var localOccurrence = x.New as LocalOccurrence; if (localOccurrence != null) { if (textControl != null) { //var textControlPosRange = textControl.Scrolling.ViewportRange.Value; //GC.KeepAlive(textControlPosRange); myLocks.QueueReadLock("Aa", () => { // todo: merge with highlighting updater? var target = textControl.Coords.FromDocLineColumn( new DocumentCoords((Int32 <DocLine>)(Math.Max(localOccurrence.LineNumber - 2, 0)), (Int32 <DocColumn>) 0)); textControl.Scrolling.ScrollTo(target, TextControlScrollType.TopOfView); }); if (myLocal != null) { UpdateLocalHighlightings(textControl.Document, myLocal); } } } } }); InitializeModel(lifetime, Model); }
public StepNavigationChecker(Lifetime lifetime, ISolution solution, IPsiFiles psiFiles, TextControlManager textControlManager, IShellLocks shellLocks) { var lifetime1 = lifetime; Solution = solution; _psiFiles = psiFiles; EventHandler caretMoved = (sender, args) => { shellLocks.QueueReadLock(lifetime1, "StepNavigationChecker.CheckOnCaretChange", CheckCode); }; lifetime1.AddBracket( () => textControlManager.Legacy.CaretMoved += caretMoved, () => textControlManager.Legacy.CaretMoved -= caretMoved); OnCheckPass = new Signal <bool>(lifetime, "StepNavigationChecker.AfterNavigationDone"); }
public NodeUnderCaretDetector(Lifetime lifetime, ISolution solution, DocumentManager documentManager, ITextControlManager textControlManager, IShellLocks shellLocks) { Solution = solution; _lifetime = lifetime; _documentManager = documentManager; _textControlManager = textControlManager; _shellLocks = shellLocks; NodeUnderCaret = new Property <ITreeNode>("NodeUnderCaretDetector.NodeUnderCaret"); NodeReferencedElements = new Property <IEnumerable <IDeclaredElement> >("NodeUnderCaretDetector.NodeReferencedElements"); EventHandler caretMoved = (sender, args) => { _shellLocks.QueueReadLock("NodeUnderCaretDetector.CaretMoved", Refresh); }; lifetime.Bracket ( () => _textControlManager.Legacy.CaretMoved += caretMoved, () => _textControlManager.Legacy.CaretMoved -= caretMoved ); }
public StepNavigationChecker(Lifetime lifetime, ISolution solution, IPsiFiles psiFiles, TextControlManager textControlManager, IShellLocks shellLocks, IEditorManager editorManager, DocumentManager documentManager, IUIApplication environment) { _lifetime = lifetime; _solution = solution; _psiFiles = psiFiles; _textControlManager = textControlManager; _shellLocks = shellLocks; _documentManager = documentManager; _environment = environment; _editorManager = editorManager; EventHandler caretMoved = (sender, args) => { _shellLocks.QueueReadLock(_lifetime, "StepNavigationChecker.CheckOnCaretChange", CheckCode); }; _lifetime.AddBracket( () => textControlManager.Legacy.CaretMoved += caretMoved, () => textControlManager.Legacy.CaretMoved -= caretMoved); AfterNavigationDone = new Signal <bool>(lifetime, "StepNavigationChecker.AfterNavigationDone"); }
private void OnPsiChanged() { _shellLocks.QueueReadLock("StepPsiChecker.CheckOnPsiChanged", () => _psiFiles.CommitAllDocumentsAsync(CheckCode)); }