当前位置: 首页>>代码示例>>C#>>正文


C# ITreeNode类代码示例

本文整理汇总了C#中ITreeNode的典型用法代码示例。如果您正苦于以下问题:C# ITreeNode类的具体用法?C# ITreeNode怎么用?C# ITreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITreeNode类属于命名空间,在下文中一共展示了ITreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessBeforeInterior

		/// <summary>
		/// Processes a node, before its descendants are processed.
		/// </summary>
		/// <param name="element">The node to process.</param>
		public override void ProcessBeforeInterior(ITreeNode element) {
			string attributeId = GetHighlightingAttributeId(element);
			if (attributeId != null) {
				DocumentRange range = element.GetHighlightingRange();
				AddHighlighting(new HighlightingInfo(range, new PredefinedHighlighting(attributeId, range)));
			}
		}
开发者ID:mnaoumov,项目名称:ForTea,代码行数:11,代码来源:T4HighlightingProcess.cs

示例2: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var statements = match.GetMatchedElementList("statements").Cast<ICSharpStatement>();

                var collectedTypes = statements.SelectMany(statement =>
                {
                    var returnTypeCollector = new ReturnTypeCollector(new UniversalContext(statement.GetPsiModule()));
                    statement.ProcessThisAndDescendants(returnTypeCollector);
                    return returnTypeCollector.CollectedTypes;
                });

                foreach (var type in collectedTypes)
                {
                    var declaredType = type as IDeclaredType;
                    if (declaredType != null)
                    {
                        var typeElement = declaredType.GetTypeElement();
                        if (typeElement != null)
                        {
                            yield return new ServiceRegistration(registrationRootElement, typeElement);
                        }
                    }
                }
            }
        }
开发者ID:dpvreony-forks,项目名称:AgentMulder,代码行数:29,代码来源:RegisterLambdaStatements.cs

示例3: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

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

                // match typeof() expressions
                var typeOfExpression = argument.Value as ITypeofExpression;
                if (typeOfExpression != null)
                {
                    var typeElement = ((IDeclaredType)typeOfExpression.ArgumentType).GetTypeElement();
                    if (typeElement == null) // can happen if the typeof() expression is empty
                    {
                        yield break;
                    }

                    yield return new ComponentRegistration(registrationRootElement, typeElement);
                }
            }
        }
开发者ID:dpvreony-forks,项目名称:AgentMulder,代码行数:26,代码来源:AddNonGeneric.cs

示例4: CodeMustNotContainMultipleWhitespaceInARow

        /// <summary>
        /// The code must not contain multiple whitespace in a row.
        /// </summary>
        /// <param name="node">
        /// The node.
        /// </param>
        public void CodeMustNotContainMultipleWhitespaceInARow(ITreeNode node)
        {
            for (ITreeNode currentNode = node; currentNode != null; currentNode = currentNode.NextSibling)
            {
                if (currentNode is ITokenNode)
                {
                    ITokenNode currentToken = currentNode as ITokenNode;
                    ITokenNode previousToken = currentToken.GetPrevToken();

                    if (previousToken != null)
                    {
                        if (currentToken.GetTokenType() == CSharpTokenType.WHITE_SPACE && previousToken.GetTokenType() == CSharpTokenType.WHITE_SPACE)
                        {
                            using (WriteLockCookie.Create(true))
                            {
                                LowLevelModificationUtil.DeleteChild(currentToken);
                            }
                        }
                    }
                }

                if (currentNode.FirstChild != null)
                {
                    this.CodeMustNotContainMultipleWhitespaceInARow(currentNode.FirstChild);
                }
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:33,代码来源:SpacingRules.cs

示例5: TreeConnection

 public TreeConnection(ITreeNode ignParent, ITreeNode ignChild, List<DPoint> lstPt)
     : this()
 {
     IgnChild = ignChild;
     IgnParent = ignParent;
     LstPt = lstPt;
 }
开发者ID:2hanson,项目名称:cminus,代码行数:7,代码来源:TreeConnection.cs

示例6: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            // This entire thing is one big hack. Need to come back to it one day :)
            // There is (currently) no way to create a pattern that would match the Bind() call with implicit this in ReSharper SSR.
            // Therefore I'm only matching by the method name only, and later verifying that the method invocation's qualifier
            // is indeed derived from global::Ninject.Syntax.IBindingRoot

            if (!IsNinjectBindCall(registrationRootElement))
            {
                yield break;
            }

            IExpressionStatement statement = GetParentExpressionStatemenmt(registrationRootElement);
            if (statement == null)
            {
                yield break;
            }
            foreach (var toPattern in toPatterns)
            {
                var implementedByRegistration = toPattern.GetComponentRegistrations(statement.Expression)
                    .Cast<ComponentRegistration>()
                    .FirstOrDefault();

                if (implementedByRegistration != null)
                {
                    foreach (var registration in DoCreateRegistrations(statement.Expression).OfType<ComponentRegistration>())
                    {
                        registration.Implementation = implementedByRegistration.ServiceType;
                        yield return registration;
                    }
                }
            }
        }
开发者ID:hotgazpacho,项目名称:AgentMulder,代码行数:33,代码来源:BindBasePattern.cs

示例7: IsAssignment

 private static bool IsAssignment(ITreeNode referenceExpression)
 {
     var binaryexpression = referenceExpression.Parent as IBinaryExpression;
     return binaryexpression != null &&
            binaryexpression.LeftOperand == referenceExpression &&
            IsAssignmentImpl(binaryexpression);
 }
开发者ID:vitrilo,项目名称:ReSharper.ReTS,代码行数:7,代码来源:VariableInfo.cs

示例8: PrintTree

        private static void PrintTree(IDomainTree domainTree, ITreeNode node, String tab = "")
        {
            var outputAttributeId = domainTree.Attributes.Count - 1;

            if (node.IsLeaf())
            {
                var values = domainTree.GetAllSymbolicValuesOfAttribute(SymbolicDomainDataParams.CreateIt(node.Data, outputAttributeId));
                if (values.Length == 0)
                {
                    Console.WriteLine("{0}\t{1} = \"null\";", tab, domainTree.Attributes[outputAttributeId]);
                }
                else
                {
                    Console.WriteLine("{0}\t{1} = \"{2}\";", tab, domainTree.Attributes[outputAttributeId],
                                  domainTree.Domain[outputAttributeId][values[0]]);
                }

                return;
            }

            var numvalues = node.Children.Length;
            for (var i = 0; i < numvalues; i++)
            {
                Console.WriteLine(tab + "if( " + domainTree.Attributes[node.TestAttribute] + " == \"" +
                                  domainTree.Domain[node.TestAttribute][i] + "\") {");
                PrintTree(domainTree, node.Children[i], tab + "\t");

                if (i != numvalues - 1)
                    Console.Write(tab + "} else ");
                else
                    Console.WriteLine(tab + "}");
            }
        }
开发者ID:spolnik,项目名称:MSc_TaskManagementSystem_MachineLearning,代码行数:33,代码来源:TreePrinter.cs

示例9: GetNodePairs

 private static void GetNodePairs(ITreeNode firstNode, ITreeNode lastNode, IList<FormattingRange> list)
 {
     var firstChild = firstNode;
     var lastChild = lastNode;
     var commonParent = firstNode.FindCommonParent(lastNode);
     while (firstChild != null && firstChild.Parent != commonParent)
     {
         firstChild = firstChild.Parent;
     }
     while (lastChild != null && lastChild.Parent != commonParent)
     {
         lastChild = lastChild.Parent;
     }
     Assertion.Assert(firstChild != null, "firstChild != null");
     Assertion.Assert(lastChild != null, "lastChild != null");
     var node = firstChild;
     while (node != null && node != lastChild.NextSibling)
     {
         if (!node.IsWhitespaceToken())
         {
             GetNodePairs(node, list, commonParent);
         }
         node = node.NextSibling;
     }
 }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:25,代码来源:SecretFormattingStage.cs

示例10: HasReference

 // Same
 public bool HasReference(ITreeNode element, ICollection<string> names)
 {
     var literal = element as ILiteralExpression;
     if (literal != null && literal.ConstantValue.Value is string)
         return names.Contains((string)literal.ConstantValue.Value);
     return false;
 }
开发者ID:EddieGarmon,项目名称:resharper-xunit,代码行数:8,代码来源:VBPropertyDataReferenceProviderFactory.cs

示例11: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            var parentExpression = registrationRootElement.GetParentExpression<IExpressionStatement>();
            if (parentExpression == null)
            {
                yield break;
            }

            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var expression = match.GetMatchedElement<ICSharpExpression>("expression");

                if (IsResolvedToObject(expression))
                {
                    yield break;
                }

                IEnumerable<IComponentRegistration> componentRegistrations = GetRegistrationsFromExpression(registrationRootElement, expression);

                IEnumerable<FilteredRegistrationBase> basedOnRegistrations = basedOnPatterns.SelectMany(
                   basedOnPattern => basedOnPattern.GetBasedOnRegistrations(parentExpression.Expression)).ToList();

                var registrations = componentRegistrations.Concat(basedOnRegistrations).ToList();

                if (registrations.Any())
                {
                    yield return new CompositeRegistration(registrationRootElement, registrations);
                }
            }
        }
开发者ID:hmemcpy,项目名称:AgentMulder,代码行数:32,代码来源:RegisterLambdaExpression.cs

示例12: ProcessBeforeInterior

        public void ProcessBeforeInterior(ITreeNode element)
        {
            var declaration = element as IDeclaration;
            if (declaration == null)
                return;

            var declaredElement = declaration.DeclaredElement;
            if (declaredElement == null || declaredElement.ShortName == SharedImplUtil.MISSING_DECLARATION_NAME)
                return;

            IUnitTestElement testElement = null;
            var testClass = declaredElement as IClass;
            if (testClass != null)
                testElement = ProcessTestClass(testClass);

            var testMethod = declaredElement as IMethod;
            if (testMethod != null)
                testElement = ProcessTestMethod(testMethod);

            if (testElement != null)
            {
                var nameRange = declaration.GetNameDocumentRange().TextRange;
                var documentRange = declaration.GetDocumentRange().TextRange;
                if (nameRange.IsValid && documentRange.IsValid)
                {
                    var disposition = new UnitTestElementDisposition(testElement, psiFile.GetSourceFile().ToProjectFile(),
                                                                     nameRange, documentRange);
                    consumer(disposition);
                }
            }
        }
开发者ID:TylerCarlson1,项目名称:ReSharperFixieRunner,代码行数:31,代码来源:PsiFileExplorer.8.1.cs

示例13: InteriorShouldBeProcessed

        public bool InteriorShouldBeProcessed(ITreeNode element)
        {
            if (element is ITypeMemberDeclaration)
                return (element is ITypeDeclaration);

            return true;
        }
开发者ID:TylerCarlson1,项目名称:ReSharperFixieRunner,代码行数:7,代码来源:PsiFileExplorer.8.1.cs

示例14: GetComponentRegistrations

        /// <summary>
        /// The get component registrations.
        /// </summary>
        /// <param name="registrationRootElement">
        /// The registration root element.
        /// </param>
        /// <returns>
        /// </returns>
        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            IStructuralMatchResult match = Match(registrationRootElement);

            if (match.Matched)
            {
                var invocationExpression = match.MatchedElement as IInvocationExpression;
                if (invocationExpression == null)
                {
                    yield break;
                }

                if (invocationExpression.TypeArguments.Count > 0)
                {
                    foreach (IComponentRegistration registration in FromGenericArguments(invocationExpression))
                    {
                        yield return registration;
                    }
                }
                else
                {
                    foreach (IComponentRegistration registration in FromArguments(invocationExpression))
                    {
                        yield return registration;
                    }
                }
            }
        }
开发者ID:hotgazpacho,项目名称:AgentMulder,代码行数:36,代码来源:ServiceLocatorMethodRegistrationPatternBase.cs

示例15: GetComponentRegistrations

        public override IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement)
        {
            IExpressionStatement parentExpression = GetParentExpressionStatemenmt(registrationRootElement);
            if (parentExpression == null)
            {
                yield break;
            }

            IStructuralMatchResult match = Match(registrationRootElement);
            if (match.Matched)
            {
                var arguments = match.GetMatchedElementList("assemblies").Cast<ICSharpArgument>();

                IEnumerable<IModule> modules = arguments.SelectNotNull(argument => ModuleExtractor.GetTargetModule(argument.Value));

                foreach (IModule module in modules)
                {
                    var registration = new ModuleBasedOnRegistration(module, new DefaultScanAssemblyRegistration(registrationRootElement));

                    var basedOnRegistrations = BasedOnPatterns.SelectMany(
                        basedOnPattern => basedOnPattern.GetBasedOnRegistrations(parentExpression.Expression));

                    yield return new CompositeRegistration(registrationRootElement, registration, basedOnRegistrations.ToArray());
                }
            }
        }
开发者ID:hotgazpacho,项目名称:AgentMulder,代码行数:26,代码来源:RegisterAssemblyTypes.cs


注:本文中的ITreeNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。