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


C# ModelElement.ReferenceName方法代码示例

本文整理汇总了C#中ModelElement.ReferenceName方法的典型用法代码示例。如果您正苦于以下问题:C# ModelElement.ReferenceName方法的具体用法?C# ModelElement.ReferenceName怎么用?C# ModelElement.ReferenceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelElement的用法示例。


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

示例1: ReplaceNonTerminal

        /// <summary>
        ///     Removes the prefix according to the StartRemove and EndRemove values
        /// </summary>
        /// <param name="treeNode">The tree node to replace</param>
        /// <param name="referencedElement">The element that should be replaced</param>
        /// <returns>if the replacement has been done</returns>
        private bool ReplaceNonTerminal(InterpreterTreeNode treeNode, ModelElement referencedElement)
        {
            bool retVal;

            if (ReplaceAllReferences)
            {
                // Only do the repleacement for elements defined in a dictionary
                retVal = EnclosingFinder<Dictionary>.find(referencedElement) != null;
            }
            else
            {
                // Check that the reference corresponds to the specific reference for this visitor
                retVal = referencedElement == Ref;
            }

            if (retVal)
            {
                // Removes the prefix
                if (ShouldRemovePrefix)
                {
                    ReplaceText("", StartRemove, EndRemove);
                    ResetRemoveIndexes();
                }

                string replacementValue = referencedElement.ReferenceName(User);
                ReplaceText(replacementValue, treeNode.Start, treeNode.End);
            }

            return retVal;
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:36,代码来源:RefactorTree.cs

示例2: RefactorTypedElement

 /// <summary>
 ///     Refactors an element which has a type
 /// </summary>
 /// <param name="element">The element that has been modified</param>
 /// <param name="user">The user which references this type</param>
 private static void RefactorTypedElement(ModelElement element, ITypedElement user)
 {
     if (user != null)
     {
         ModelElement enclosing = EnclosingFinder<NameSpace>.find(user, true);
         try
         {
             Function userFunction = user as Function;
             if ((user.Type == element))
             {
                 string newName = element.ReferenceName(enclosing);
                 user.TypeName = newName;
             }
             else if (userFunction != null && userFunction.ReturnType == element)
             {
                 userFunction.ReturnType = element as Type;
             }
             else if (element is NameSpace)
             {
                 string newName;
                 Function function = user as Function;
                 if (function != null)
                 {
                     newName = function.ReturnType.ReferenceName(user as ModelElement);
                     user.TypeName = newName;
                 }
                 else
                 {
                     newName = user.Type.ReferenceName(user as ModelElement);
                     user.TypeName = newName;
                 }
             }
         }
         catch (Exception e)
         {
             ((ModelElement) user).AddError("Cannot refactor this element, reason = " + e.Message);
         }
     }
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:44,代码来源:Compiler.cs


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