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


C# ModelElement.ToString方法代码示例

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


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

示例1: CreateAndAssignName

        /// <summary>
        /// Method used to create a new elements nam'e based on the range of available names and assign it to the element. 
        /// Excluded are names used by the child elements embedded in the given parent element.
        /// </summary>
        /// <param name="parent">Parent element, embedding the model element.</param>
        /// <param name="modelElement">ModelElement to create and assign the name for.</param>
        /// <returns>Created name for the given ModelElement. Null if the method did not succeed. </returns>
		public virtual string CreateAndAssignName(ModelElement parent, ModelElement modelElement)
        {	
			string name = CreateName(parent, modelElement);
			if( name == null )
				throw new System.NotSupportedException("modelElement: " + modelElement.ToString() + " has no name");
			
			SetName(modelElement, name);
			return name;
		}
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:16,代码来源:ModelElementNameProvider.cs

示例2: AddChildElement

        protected virtual BaseModelElementTreeViewModel AddChildElement(ElementLink relationship, ModelElement element, bool isInDeserialization)
        {
            if (element == null || relationship == null)
                return null;

            // check if already added
            if (!isInDeserialization)
                foreach (Tum.PDE.ToolFramework.Modeling.Visualization.ViewModel.ModelTree.BaseModelElementTreeViewModel vm in this.Children)
                    // this can actually happen without any error occuring, because it depends on
                    // the order of transactions.. e.g.:
                    // 1. Add parent in first transaction. Add child in second --> this clause will not occur.
                    // 2. Add parent and child in one transaction. This clause will occur, because parent
                    //    automatically adds its children and there is no easy way of preventing this method from
                    //    beeing called.
                    if (vm.Element.Id == element.Id)
                        return vm;

            // create new view model for this specified element
            ModelElementTreeViewModel viewModel = this.ViewModelStore.Factory.CreateModelElementTreeViewModel(element, relationship,
                GetTargetDomainRole(relationship.GetDomainRelationship()).Id, this, DoHookUpEvents, DoCreateContextMenus, this.MainModelTreeViewModel);

            if (viewModel == null)
                throw new System.ArgumentNullException("Could not resolve VM for " + element.ToString());

            // add new VModellvariante into children collection
            this.AddElementToCollection(relationship, viewModel);

            // set selection to new element
            if (!isInDeserialization)
                if (this.MainModelTreeViewModel != null)
                    if (this.MainModelTreeViewModel.IsActiveView && !this.ViewModelStore.InLoad)
                    {
                        //viewModel.IsSelected = true;
                        if (viewModel.Parent != null)
                            if (!viewModel.Parent.IsExpanded)
                                viewModel.Parent.IsExpanded = true;
                    }

            return viewModel;
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:40,代码来源:ModelElementTreeViewModel.cs


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