コード例 #1
0
        public override IEnumerable <FilteredRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var argument = match.GetMatchedElement("argument") as ICSharpArgument;
                if (argument == null)
                {
                    yield break;
                }

                var typeofExpression = argument.Value as ITypeofExpression;
                if (typeofExpression != null)
                {
                    var declaredType = typeofExpression.ArgumentType as IDeclaredType;
                    if (declaredType != null)
                    {
                        ITypeElement typeElement = declaredType.GetTypeElement();
                        if (typeElement != null)
                        {
                            yield return(registrationCreator.Create(registrationRootElement, typeElement));
                        }
                    }
                }
            }
        }
コード例 #2
0
        public override IEnumerable <BasedOnRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var declarationsCache = registrationRootElement.GetPsiServices().CacheManager.GetDeclarationsCache(DeclarationCacheLibraryScope.FULL, false);

                ITypeElement objectTypeElement = declarationsCache.GetTypeElementByCLRName("System.Object");
                if (objectTypeElement != null)
                {
                    yield return(registrationCreator.Create(registrationRootElement, objectTypeElement));
                }
            }
        }
コード例 #3
0
ファイル: Pick.cs プロジェクト: nataliaheliova/AgentMulder
        public override IEnumerable <FilteredRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                ITypeElement objectTypeElement = registrationRootElement.GetPsiModule()
                                                 .GetPredefinedType()
                                                 .Object.GetTypeElement();

                if (objectTypeElement != null)
                {
                    yield return(registrationCreator.Create(registrationRootElement, objectTypeElement));
                }
            }
        }
コード例 #4
0
        public override IEnumerable <FilteredRegistrationBase> GetBasedOnRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var matchedType = match.GetMatchedType("type") as IDeclaredType;
                if (matchedType != null)
                {
                    ITypeElement typeElement = matchedType.GetTypeElement();
                    if (typeElement != null)
                    {
                        yield return(registrationCreator.Create(registrationRootElement, typeElement));
                    }
                }
            }
        }