public IEnumerable <Pair <IOccurrence, MatchingInfo> > GetMatchingOccurrences( IIdentifierMatcher matcher, INavigationScope scope, GotoContext gotoContext, Func <bool> checkForInterrupt) { ApplicableGeneratorsCache applicableGeneratorsCache = gotoContext.GetData(GotoGeneratorController.ApplicableGeneratorsCacheKey); Debug.Assert(applicableGeneratorsCache != null, "applicableGeneratorsCache != null"); foreach (IGenerator generator in applicableGeneratorsCache.GetApplicableGenerators()) { string name = generator.Name; string typeName = generator.GetType().Name; bool matches = matcher.Matches(name) || matcher.Matches(typeName); if (matches) { yield return(Pair.Of( (IOccurrence) new GeneratorOccurrence(generator), new MatchingInfo(matcher, typeName) )); } } }
public GotoGeneratorController( [NotNull] Lifetime lifetime, [NotNull] ISolution solution, [NotNull] IShellLocks locks, [NotNull] IDataContext context, IMainWindowPopupWindowContext mainWindowPopupWindowContext, bool enableMulticore) : base(lifetime, solution, solution, LibrariesFlag.SolutionOnly, locks, enableMulticore, new GotoByNameModel(lifetime), mainWindowPopupWindowContext) { this.EtcItemIcon = IdeThemedIcons.SearchResults.Id; this.ItemsPassFilter = new Property <Func <IOccurrence, bool> >("ItemsPassFilter", this.DefaultFilter); GotoByNameModelManager instance = GotoByNameModelManager.GetInstance(solution); instance.ProcessModel <GotoGeneratorModelInitilizer>(this.Model, lifetime, this.GetType()); ITextControl textControl = context.GetData(TextControlDataConstants.TEXT_CONTROL); Debug.Assert(textControl != null, "textControl != null"); var dataBuilder = new CSharpContextActionDataBuilder(); var generatorDataProvider = new GeneratorDataProvider((ICSharpContextActionDataProvider)dataBuilder.Build(solution, textControl)); var generatorsProvider = solution.GetComponent <GeneratorsProvider>(); var applicableGeneratorsCache = new ApplicableGeneratorsCache(generatorsProvider, generatorDataProvider); this.GotoContext.PutData(ApplicableGeneratorsCacheKey, applicableGeneratorsCache); _executionHost = context.GetComponent <GeneratorExecutionHost>(); }