Пример #1
0
            //TODO Input底层可能又问题
            public override bool Matches(XmlNode node)
            {
                if (!base.Matches(node))
                {
                    return(false);
                }
                IModelElementInstance modelElement = ModelUtil.GetModelElement(new DomElementImpl((XmlElement)node), Model);

                return(Type.IsAssignableFrom(modelElement.GetType()));
            }
Пример #2
0
        //TODO 可能又类型判断错误 设置ModelElementId id.DefaultValue is string
        /// <summary>
        /// Set unique identifier if the type has a String id attribute
        /// </summary>
        /// <param name="type"> the type of the model element </param>
        /// <param name="modelElementInstance"> the model element instance to set the id </param>
        public static void SetGeneratedUniqueIdentifier(IModelElementType type, IModelElementInstance modelElementInstance)
        {
            //AttributeBox id = type.GetAttribute("id");
            IAttribute /*<String>*/ id = type.GetAttribute("id");

            //if (id != null && id.ValueType ==typeof(string) && id.IdAttribute)
            if (id != null && id.IdAttribute)
            {
                ((StringAttribute)id).SetValue(modelElementInstance, ModelUtil.GetUniqueIdentifier(type));
            }
        }