OnStatusMessageUpdate() public method

public OnStatusMessageUpdate ( string message ) : void
message string
return void
Exemplo n.º 1
0
            public async Task<IList<ICodeInspectionResult>> FindIssuesAsync(RubberduckParserState state, CancellationToken token)
            {
                if (state == null || !state.AllUserDeclarations.Any())
                {
                    return new ICodeInspectionResult[] { };
                }

                await Task.Yield();

                state.OnStatusMessageUpdate(RubberduckUI.CodeInspections_Inspecting);
                UpdateInspectionSeverity();
                //OnReset();

                var allIssues = new ConcurrentBag<ICodeInspectionResult>();

                var inspections = _inspections.Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow)
                    .Select(inspection =>
                        new Task(() =>
                        {
                            token.ThrowIfCancellationRequested();
                            var inspectionResults = inspection.GetInspectionResults();
                            var results = inspectionResults as IList<InspectionResultBase> ?? inspectionResults.ToList();

                            if (results.Any())
                            {
                                //OnIssuesFound(results);

                                foreach (var inspectionResult in results)
                                {
                                    allIssues.Add(inspectionResult);
                                }
                            }
                        })).ToArray();

                foreach (var inspection in inspections)
                {
                    inspection.Start();
                }

                Task.WaitAll(inspections);
                state.OnStatusMessageUpdate(RubberduckUI.ResourceManager.GetString("ParserState_" + state.Status)); // should be "Ready"

                return allIssues.ToList();
            }
            public List<ICodeInspectionResult> Inspect(RubberduckParserState state)
            {
                if (state == null || !state.AllUserDeclarations.Any())
                {
                    return new List<ICodeInspectionResult>();
                }

                state.OnStatusMessageUpdate(RubberduckUI.CodeInspections_Inspecting);

                var allIssues = new ConcurrentBag<ICodeInspectionResult>();

                // Prepare ParseTreeWalker based inspections
                var parseTreeWalkResults = GetParseTreeResults(state);
                foreach (var parseTreeInspection in _inspections.Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow && inspection is IParseTreeInspection))
                {
                    (parseTreeInspection as IParseTreeInspection).ParseTreeResults = parseTreeWalkResults;
                }

                var inspections = _inspections.Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow)
                    .Select(inspection =>
                        new Task(() =>
                        {
                            var inspectionResults = inspection.GetInspectionResults();
                            
                            foreach (var inspectionResult in inspectionResults)
                            {
                                allIssues.Add(inspectionResult);
                            }
                        })).ToArray();

                foreach (var inspection in inspections)
                {
                    inspection.Start();
                }

                Task.WaitAll(inspections);

                return allIssues.ToList();
            }
Exemplo n.º 3
0
        private void SyncComReferences(IReadOnlyList <VBProject> projects)
        {
            foreach (var vbProject in projects)
            {
                var projectId = QualifiedModuleName.GetProjectId(vbProject);
                // use a 'for' loop to store the order of references as a 'priority'.
                // reference resolver needs this to know which declaration to prioritize when a global identifier exists in multiple libraries.
                for (var priority = 1; priority <= vbProject.References.Count; priority++)
                {
                    var reference           = vbProject.References.Item(priority);
                    var referencedProjectId = GetReferenceProjectId(reference, projects);

                    ReferencePriorityMap map = null;
                    foreach (var item in _projectReferences)
                    {
                        if (item.ReferencedProjectId == referencedProjectId)
                        {
                            map = map != null ? null : item;
                        }
                    }

                    if (map == null)
                    {
                        map = new ReferencePriorityMap(referencedProjectId)
                        {
                            { projectId, priority }
                        };
                        _projectReferences.Add(map);
                    }
                    else
                    {
                        map[projectId] = priority;
                    }

                    if (!map.IsLoaded)
                    {
                        _state.OnStatusMessageUpdate(ParserState.LoadingReference.ToString());
                        var items = _comReflector.GetDeclarationsForReference(reference);
                        foreach (var declaration in items)
                        {
                            _state.AddDeclaration(declaration);
                        }
                        map.IsLoaded = true;
                    }
                }
            }

            var mappedIds = new List <string>();

            foreach (var item in _projectReferences)
            {
                mappedIds.Add(item.ReferencedProjectId);
            }

            var unmapped = new List <Reference>();

            foreach (var project in projects)
            {
                foreach (Reference item in project.References)
                {
                    if (!mappedIds.Contains(GetReferenceProjectId(item, projects)))
                    {
                        unmapped.Add(item);
                    }
                }
            }

            foreach (var reference in unmapped)
            {
                UnloadComReference(reference, projects);
            }
        }