public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(
            [NotNull] MatchingInfo navigationInfo, [NotNull] INavigationScope scope, [NotNull] GotoContext gotoContext, [NotNull] Func <bool> checkForInterrupt)
        {
            var occurrences = gotoContext.GetData(GoToWordOccurrences);

            return(occurrences ?? EmptyList <IOccurence> .InstanceList);
        }
Exemplo n.º 2
0
        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)
                                     ));
                }
            }
        }
Exemplo n.º 3
0
        public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext)
        {
            var fileMembersMap = gotoContext.GetData(ClrFileMembersMap.ClrFileMembersMapKey);

            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];

            foreach (var clrFileMemberData in membersData)
            {
                var occurence = CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return(occurence);
                }
            }
        }
    /// <summar>Gets occurences by given matchingInfo </summar><param name="navigationInfo"/><param name="scope"/><param name="gotoContext"/><param name="checkForInterrupt"/>
    /// <returns/>
    public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func<bool> checkForInterrupt)
    {
      var occurrences = gotoContext.GetData(SitecoreItemOccurrences);

      return occurrences ?? EmptyList<ItemOccurence>.InstanceList;
    }
        public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func <bool> checkCancelled)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);

            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];

            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return(occurence);
                }
            }

            /*
             *
             * ISolution solution = scope.GetSolution();
             * var cache = this.GetCache(scope, solution, gotoContext);
             * var namespaceNavigationScope = scope as NamespaceNavigationScope;
             * if (namespaceNavigationScope != null)
             * {
             *  INamespace namespaceScope = namespaceNavigationScope.DeclaredElement as INamespace;
             *  if (namespaceScope != null)
             *  {
             *      return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
             *  }
             *  //return Enumerable.Select<IClrDeclaredElement, IOccurence>(Enumerable.Where<IClrDeclaredElement>(Enumerable.Where<IClrDeclaredElement>(ChainedScopesUtil.GetAllSubElements(namespaceScope, cache, true), (Func<IClrDeclaredElement, bool>)(element => element.ShortName == navigationInfo.Identifier)), new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)), (Func<IClrDeclaredElement, IOccurence>)(x => (IOccurence)new ChainedCodeModelOccurence((IDeclaredElement)x, navigationInfo, OccurencePresentationOptions.DefaultOptions)));
             * }
             * if (!(scope is SolutionNavigationScope))
             * {
             *  return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
             * }
             * List<IClrDeclaredElement> list1 = new List<IClrDeclaredElement>();
             * foreach (ITypeMember typeMember in cache.GetSourceMembers(navigationInfo.Identifier))
             * {
             *  if (!typeMember.IsSynthetic() && !(typeMember is IAccessor))
             *  {
             *      list1.Add((IClrDeclaredElement)typeMember);
             *  }
             * }
             * List<IClrDeclaredElement> list2 = new List<IClrDeclaredElement>();
             * if (scope.ExtendedSearchFlag == LibrariesFlag.SolutionAndLibraries)
             * {
             *  foreach (ITypeMember typeMember in cache.GetCompiledMembers(navigationInfo.Identifier))
             *  {
             *      list2.Add((IClrDeclaredElement)typeMember);
             *  }
             * }
             * IClrDeclaredElement[] elementsByShortName = cache.GetElementsByShortName(navigationInfo.Identifier);
             * return
             *  Enumerable.Select<IClrDeclaredElement, IOccurence>(
             *      Enumerable.Where<IClrDeclaredElement>(
             *          Enumerable.Concat<IClrDeclaredElement>(
             *              CollectionUtil.Concat<IClrDeclaredElement>(
             *                  (IEnumerable<IClrDeclaredElement>)list1, elementsByShortName),
             *              (IEnumerable<IClrDeclaredElement>)list2),
             *          new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)),
             *      (Func<IClrDeclaredElement, IOccurence>)
             *      (x => (IOccurence)new DeclaredElementOccurence((IDeclaredElement)x, OccurenceType.Occurence)));*/
        }
        public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo,
            INavigationScope scope,
            GotoContext gotoContext,
            Func<bool> checkForInterrupt)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);
            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];
            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return occurence;
                }
            }
        }
        public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func<bool> checkCancelled)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);
            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];
            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return occurence;
                }
            }
            /*

            ISolution solution = scope.GetSolution();
            var cache = this.GetCache(scope, solution, gotoContext);
            var namespaceNavigationScope = scope as NamespaceNavigationScope;
            if (namespaceNavigationScope != null)
            {
                INamespace namespaceScope = namespaceNavigationScope.DeclaredElement as INamespace;
                if (namespaceScope != null)
                {
                    return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
                }
                //return Enumerable.Select<IClrDeclaredElement, IOccurence>(Enumerable.Where<IClrDeclaredElement>(Enumerable.Where<IClrDeclaredElement>(ChainedScopesUtil.GetAllSubElements(namespaceScope, cache, true), (Func<IClrDeclaredElement, bool>)(element => element.ShortName == navigationInfo.Identifier)), new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)), (Func<IClrDeclaredElement, IOccurence>)(x => (IOccurence)new ChainedCodeModelOccurence((IDeclaredElement)x, navigationInfo, OccurencePresentationOptions.DefaultOptions)));
            }
            if (!(scope is SolutionNavigationScope))
            {
                return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
            }
            List<IClrDeclaredElement> list1 = new List<IClrDeclaredElement>();
            foreach (ITypeMember typeMember in cache.GetSourceMembers(navigationInfo.Identifier))
            {
                if (!typeMember.IsSynthetic() && !(typeMember is IAccessor))
                {
                    list1.Add((IClrDeclaredElement)typeMember);
                }
            }
            List<IClrDeclaredElement> list2 = new List<IClrDeclaredElement>();
            if (scope.ExtendedSearchFlag == LibrariesFlag.SolutionAndLibraries)
            {
                foreach (ITypeMember typeMember in cache.GetCompiledMembers(navigationInfo.Identifier))
                {
                    list2.Add((IClrDeclaredElement)typeMember);
                }
            }
            IClrDeclaredElement[] elementsByShortName = cache.GetElementsByShortName(navigationInfo.Identifier);
            return
                Enumerable.Select<IClrDeclaredElement, IOccurence>(
                    Enumerable.Where<IClrDeclaredElement>(
                        Enumerable.Concat<IClrDeclaredElement>(
                            CollectionUtil.Concat<IClrDeclaredElement>(
                                (IEnumerable<IClrDeclaredElement>)list1, elementsByShortName),
                            (IEnumerable<IClrDeclaredElement>)list2),
                        new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)),
                    (Func<IClrDeclaredElement, IOccurence>)
                    (x => (IOccurence)new DeclaredElementOccurence((IDeclaredElement)x, OccurenceType.Occurence)));*/
        }