Пример #1
0
        public void Execute(Action <DaemonStageResult> commiter)
        {
            PsiManager  manager = PsiManager.GetInstance(myDaemonProcess.Solution);
            ICSharpFile file    = manager.GetPsiFile(myDaemonProcess.SourceFile, CSharpLanguage.Instance) as ICSharpFile;

            if (file == null)
            {
                return;
            }

            // Running visitor against the PSI
            var elementProcessor = new MakeEnumComparisonTypeSafeFinderElementProcessor(myDaemonProcess);

            file.ProcessDescendants(elementProcessor);

            // Checking if the daemon is interrupted by user activity
            if (myDaemonProcess.InterruptFlag)
            {
                throw new ProcessCancelledException();
            }

            // Fill in the result
            DaemonStageResult result = new DaemonStageResult(elementProcessor.Highlightings);

            commiter(result);
        }
        public void Execute(Action<DaemonStageResult> commiter)
        {
            PsiManager manager = PsiManager.GetInstance(myDaemonProcess.Solution);
            ICSharpFile file = manager.GetPsiFile(myDaemonProcess.SourceFile, CSharpLanguage.Instance) as ICSharpFile;
            if (file == null)
                return;

            // Running visitor against the PSI
            var elementProcessor = new MakeEnumComparisonTypeSafeFinderElementProcessor(myDaemonProcess);
            file.ProcessDescendants(elementProcessor);

            // Checking if the daemon is interrupted by user activity
            if (myDaemonProcess.InterruptFlag)
                throw new ProcessCancelledException();

            // Fill in the result
            DaemonStageResult result = new DaemonStageResult(elementProcessor.Highlightings);
            commiter(result);
        }