Esempio n. 1
0
		public CodeType(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
			: base(context, typeDefinition)
		{
			this.typeDefinition = typeDefinition;
			this.typeArguments = typeArguments;
			this.InfoLocation = GetInfoLocation();
		}
 public CodeNamespace(CodeModelContext context, INamespace ns)
     : base(context)
 {
     this.ns           = ns;
     this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
     this.Language     = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 3
0
 public CodeNamespace(CodeModelContext context, INamespace ns)
     : base(context)
 {
     this.ns = ns;
     this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 4
0
 public CodeType(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
     : base(context, typeDefinition)
 {
     this.typeDefinition = typeDefinition;
     this.typeArguments  = typeArguments;
     this.InfoLocation   = GetInfoLocation();
 }
 FileCodeModelCodeNamespace(CodeModelContext context, NamespaceName namespaceName)
 {
     this.context = context;
     this.namespaceName = namespaceName;
     this.InfoLocation = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 6
0
		public CodeElement(CodeModelContext context, ISymbolModel symbolModel)
		{
			this.context = context;
			this.symbolModel = symbolModel;
			if (symbolModel.ParentProject != null)
				this.Language = symbolModel.ParentProject.GetCodeModelLanguage();
		}
Esempio n. 7
0
 FileCodeModelCodeNamespace(CodeModelContext context, NamespaceName namespaceName)
 {
     this.context       = context;
     this.namespaceName = namespaceName;
     this.InfoLocation  = global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal;
     this.Language      = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 8
0
		internal static CodeType Create(CodeModelContext context, IType type)
		{
			ITypeDefinition typeDefinition = type.GetDefinition();
			if (typeDefinition != null) {
				return Create(context.WithFilteredFileName(null), typeDefinition, type.TypeArguments.ToArray());
			}
			return null;
		}
Esempio n. 9
0
        public FileCodeModel2(CodeModelContext context, Project project)
        {
            if (context == null || context.FilteredFileName == null) {
                throw new ArgumentException("context must be restricted to a file");
            }

            this.context = context;
            this.project = project;
        }
Esempio n. 10
0
		public static CodeType Create(CodeModelContext context, IType type)
		{
			var typeDef = type.GetDefinition();
			if (typeDef != null) {
				var typeModel = typeDef.GetModel();
				if (typeModel != null)
					return Create(context.WithFilteredFileName(null), typeModel);
			}
			return null;
		}
Esempio n. 11
0
        internal static CodeType Create(CodeModelContext context, IType type)
        {
            ITypeDefinition typeDefinition = type.GetDefinition();

            if (typeDefinition != null)
            {
                return(Create(context.WithFilteredFileName(null), typeDefinition, type.TypeArguments.ToArray()));
            }
            return(null);
        }
        public FileCodeModel2(CodeModelContext context, Project project)
        {
            if (context == null || context.FilteredFileName == null)
            {
                throw new ArgumentException("context must be restricted to a file");
            }

            this.context = context;
            this.project = project;
        }
Esempio n. 13
0
		public override void SetUp()
		{
			base.SetUp();
			project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage);
			codeGenerator = MockRepository.GenerateStrictMock<CodeGenerator>();
			codeModelContext = new CodeModelContext {
				CodeGenerator = codeGenerator,
				CurrentProject = project
			};
		}
Esempio n. 14
0
        public override void SetUp()
        {
            base.SetUp();
            project.Stub(p => p.Language).Return(null).WhenCalled(mi => mi.ReturnValue = projectLanguage);

            codeGenerator = MockRepository.GenerateMock<CodeGenerator>();
            languageBinding = MockRepository.GenerateMock<ILanguageBinding>();
            languageBinding.Stub(binding => binding.CodeGenerator).Return(codeGenerator);
            project.Stub(p => p.LanguageBinding).Return(languageBinding);

            codeModelContext = new CodeModelContext {
                CurrentProject = project
            };
        }
Esempio n. 15
0
        public Project(
			MSBuildBasedProject project,
			IPackageManagementProjectService projectService,
			IPackageManagementFileService fileService)
        {
            this.MSBuildProject = project;
            this.projectService = projectService;
            this.fileService = fileService;

            context = new CodeModelContext {
                CurrentProject = project,
                DteProject = this
            };

            CreateProperties();
            Object = new ProjectObject(this);
            ProjectItems = new ProjectItems(this, this);
        }
Esempio n. 16
0
        public Project(
            MSBuildBasedProject project,
            IPackageManagementProjectService projectService,
            IPackageManagementFileService fileService)
        {
            this.MSBuildProject = project;
            this.projectService = projectService;
            this.fileService    = fileService;

            context = new CodeModelContext {
                CurrentProject = project,
                DteProject     = this
            };

            CreateProperties();
            Object       = new ProjectObject(this);
            ProjectItems = new ProjectItems(this, this);
        }
Esempio n. 17
0
		internal static CodeType Create(
			CodeModelContext context,
			ITypeDefinition typeDefinition,
			params IType[] typeArguments)
		{
			switch (typeDefinition.Kind) {
				case TypeKind.Class:
					return new CodeClass2(context, typeDefinition);
				case TypeKind.Interface:
					return new CodeInterface(context, typeDefinition, typeArguments);
				case TypeKind.Module:
				case TypeKind.Struct:
				case TypeKind.Void:
				case TypeKind.Delegate:
				case TypeKind.Enum:
				default:
					return new CodeType(context, typeDefinition, typeArguments);
			}
		}
Esempio n. 18
0
		public static CodeType Create(CodeModelContext context, ITypeDefinitionModel typeModel)
		{
			switch (typeModel.TypeKind) {
				case TypeKind.Class:
				case TypeKind.Module:
					goto default;
				case TypeKind.Interface:
					goto default;
				case TypeKind.Struct:
				case TypeKind.Void:
					goto default;
				case TypeKind.Delegate:
					goto default;
				case TypeKind.Enum:
					goto default;
				default:
					return new CodeType(context, typeModel);
			}
		}
Esempio n. 19
0
		public static CodeElement CreateMember(CodeModelContext context, IMemberModel m)
		{
			switch (m.SymbolKind) {
				case SymbolKind.Field:
					return new CodeVariable(context, (IFieldModel)m);
				case SymbolKind.Property:
				case SymbolKind.Indexer:
//					return new CodeProperty2(m);
					throw new NotImplementedException();
				case SymbolKind.Event:
					return null; // events are not supported in EnvDTE?
				case SymbolKind.Method:
				case SymbolKind.Operator:
				case SymbolKind.Constructor:
				case SymbolKind.Destructor:
					return new CodeFunction2(context, (IMethodModel)m);
				default:
					throw new NotSupportedException("Invalid value for SymbolKind");
			}
		}
Esempio n. 20
0
		public FileCodeModel2(CodeModelContext context)
		{
			if (context == null || context.FilteredFileName == null)
				throw new ArgumentException("context must be restricted to a file");
			this.context = context;
			var compilation = SD.ParserService.GetCompilation(context.CurrentProject);
			
			var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent;
			if (projectContent != null) {
				IUnresolvedFile file = projectContent.GetFile(context.FilteredFileName);
				if (file != null) {
					var csharpFile = file as CSharpUnresolvedFile;
					if (csharpFile != null)
						AddUsings(codeElements, csharpFile.RootUsingScope, compilation);
					
					var resolveContext = new SimpleTypeResolveContext(compilation.MainAssembly);
					AddTypes(file.TopLevelTypeDefinitions
					         .Select(td => td.Resolve(resolveContext) as ITypeDefinition)
					         .Where(td => td != null).Distinct());
				}
			}
		}
Esempio n. 21
0
        internal static CodeType Create(
            CodeModelContext context,
            ITypeDefinition typeDefinition,
            params IType[] typeArguments)
        {
            switch (typeDefinition.Kind)
            {
            case TypeKind.Class:
                return(new CodeClass2(context, typeDefinition));

            case TypeKind.Interface:
                return(new CodeInterface(context, typeDefinition, typeArguments));

            case TypeKind.Module:
            case TypeKind.Struct:
            case TypeKind.Void:
            case TypeKind.Delegate:
            case TypeKind.Enum:
            default:
                return(new CodeType(context, typeDefinition, typeArguments));
            }
        }
        internal static CodeElement CreateMember(CodeModelContext context, IMember member)
        {
            switch (member.SymbolKind)
            {
            case SymbolKind.Field:
                return(new CodeVariable(context, (IField)member));

            case SymbolKind.Property:
            case SymbolKind.Indexer:
                return(new CodeProperty2(context, (IProperty)member));

            case SymbolKind.Event:
                return(null);

            case SymbolKind.Method:
            case SymbolKind.Operator:
            case SymbolKind.Constructor:
            case SymbolKind.Destructor:
                return(new CodeFunction2(context, (IMethod)member));

            default:
                throw new NotSupportedException("Invalid value for SymbolKind");
            }
        }
Esempio n. 23
0
 public CodeClass2(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
 public CodeDelegate(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Esempio n. 25
0
 public CodeParameter2(CodeModelContext context, IParameter parameter)
     : base(context, parameter)
 {
 }
Esempio n. 26
0
 public CodeProperty2(CodeModelContext context, IProperty property)
     : base(context, property)
 {
 }
Esempio n. 27
0
 public CodeAttribute2(CodeModelContext context, IAttribute attribute)
     : base(context, attribute)
 {
 }
 public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName)
     : this(context, new NamespaceName(namespaceName))
 {
 }
Esempio n. 29
0
 public CodeVariable(CodeModelContext context, IField field)
     : base(context, field)
 {
     this.field = field;
 }
Esempio n. 30
0
 public CodeInterface(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
     : base(context, typeDefinition, typeArguments)
 {
 }
 public CodeElement(CodeModelContext context, IEntity entity)
 {
     this.context  = context;
     this.entity   = entity;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 32
0
 public CodeVariable(CodeModelContext context, IField field)
     : base(context, field)
 {
     this.field = field;
 }
Esempio n. 33
0
 public CodeElement(CodeModelContext context)
 {
     this.context = context;
 }
Esempio n. 34
0
 public CodeFunction2(CodeModelContext context, IMethod method)
     : base(context, method)
 {
 }
Esempio n. 35
0
 public CodeClass2(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Esempio n. 36
0
 public CodeProperty(CodeModelContext context, IProperty property)
     : base(context, property)
 {
     this.property = property;
 }
Esempio n. 37
0
 public CodeStruct(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Esempio n. 38
0
 public CodeClass(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition, typeDefinition.TypeArguments.ToArray())
 {
 }
Esempio n. 39
0
 public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type)
     : base(context, parent, type)
 {
 }
Esempio n. 40
0
 internal static TextPoint CreateStartPoint(CodeModelContext context, DomRegion region)
 {
     return new TextPoint(region.FileName, region.Begin, context.DocumentLoader);
 }
Esempio n. 41
0
 public CodeProperty2(CodeModelContext context, IProperty property)
     : base(context, property)
 {
 }
Esempio n. 42
0
 public CodeModel(CodeModelContext context, Project project)
 {
     this.context = context;
     this.project = project;
 }
Esempio n. 43
0
 public CodeParameter(CodeModelContext context, IParameter parameter)
     : base(context)
 {
     this.parameter = parameter;
 }
Esempio n. 44
0
 public CodeElementsInNamespace(CodeModelContext context, INamespace ns)
 {
     this.context = context;
     this.ns      = ns;
     GetCodeElements();
 }
 public CodeTypeRef(CodeModelContext context, CodeElement parent, IType type)
 {
     this.context = context;
     this.parent  = parent;
     this.type    = type;
 }
Esempio n. 46
0
		public CodeFunction2(CodeModelContext context, IMethodModel methodModel)
			: base(context, methodModel)
		{
		}
Esempio n. 47
0
 public CodeFunction(CodeModelContext context, IMethod method)
     : base(context, method)
 {
     this.method = method;
 }
Esempio n. 48
0
		public CodeAttribute(CodeModelContext context, IAttribute attribute)
			: base(context)
		{
			this.attribute = attribute;
		}
Esempio n. 49
0
		/// <summary>
		/// Note that projectContent may be different to the IClass.ProjectContent since the class
		/// is retrieved from the namespace contents and could belong to a separate project or
		/// referenced assembly.
		/// </summary>
		public CodeType(CodeModelContext context, ITypeDefinitionModel typeModel)
			: base(context, typeModel)
		{
			this.typeModel = typeModel;
		}
Esempio n. 50
0
 public CodeModel(CodeModelContext context, Project project)
 {
     this.context = context;
     this.project = project;
 }
Esempio n. 51
0
 public CodeAttribute(CodeModelContext context, IAttribute attribute)
     : base(context)
 {
     this.attribute = attribute;
 }
Esempio n. 52
0
 public CodeInterface(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
     : base(context, typeDefinition, typeArguments)
 {
 }
Esempio n. 53
0
 public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type)
     : base(context, parent, type)
 {
 }
Esempio n. 54
0
 public CodeElementsInNamespace(CodeModelContext context)
     : this(context, context.DteProject.GetCompilationUnit().RootNamespace)
 {
 }
Esempio n. 55
0
 internal static CodeElement CreateMember(CodeModelContext context, IMember member)
 {
     switch (member.SymbolKind) {
         case SymbolKind.Field:
             return new CodeVariable(context, (IField)member);
         case SymbolKind.Property:
         case SymbolKind.Indexer:
             return new CodeProperty2(context, (IProperty)member);
         case SymbolKind.Event:
             return null;
         case SymbolKind.Method:
         case SymbolKind.Operator:
         case SymbolKind.Constructor:
         case SymbolKind.Destructor:
             return new CodeFunction2(context, (IMethod)member);
         default:
             throw new NotSupportedException("Invalid value for SymbolKind");
     }
 }
Esempio n. 56
0
 public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName)
     : this(context, new NamespaceName(namespaceName))
 {
 }
Esempio n. 57
0
 public CodeElement(CodeModelContext context, IEntity entity)
 {
     this.context = context;
     this.entity = entity;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Esempio n. 58
0
		public CodeClass(CodeModelContext context, ITypeDefinitionModel typeModel)
			: base(context, typeModel)
		{
		}
Esempio n. 59
0
 public CodeDelegate(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
 public CodeElement(CodeModelContext context)
 {
     this.context = context;
 }