protected override object NewAttribute(NewCodeElementItemParams p, string path, object newItemValue)
        {
            var value = null == newItemValue ? null : newItemValue.ToString();

            return(_codeClass.AddAttribute(path,
                                           value,
                                           p.Position.ToDTEParameter()));
        }
Esempio n. 2
0
        /// <summary>
        /// Get the specified class from the given namespace. Creates new class if no exists.
        /// </summary>
        /// <param name="p_fcm"></param>
        /// <param name="p_testingNameSpace"></param>
        /// <param name="p_className"></param>
        /// <returns></returns>
        private static CodeClass2 GetClass(FileCodeModel2 p_fcm, CodeNamespace p_testingNameSpace, string p_className)
        {
            CodeClass2 securedClass = null;

            foreach (CodeElement2 codeElement in p_fcm.CodeElements)
            {
                securedClass = FindClassRecursive(codeElement, p_className);
                if (securedClass != null)
                {
                    break;
                }
            }

            if (securedClass == null)
            {
                // Add a class to the namespace.
                securedClass = (CodeClass2)p_testingNameSpace.AddClass(p_className, -1, null, null, vsCMAccess.vsCMAccessPublic);
                securedClass.DataTypeKind = vsCMDataTypeKind.vsCMDataTypeKindPartial;
                securedClass.AddAttribute("TestClass", string.Empty);
            }
            return(securedClass);
        }
Esempio n. 3
0
 public ShellCodeAttribute AddAttribute(string Name, string Value, object Position)
 {
     return(new ShellCodeAttribute(_codeClass.AddAttribute(Name, Value, Position) as CodeAttribute2));
 }