Exemplo 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();
 }
Exemplo 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();
 }
Exemplo 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();
 }
Exemplo n.º 6
0
		public CodeElement(CodeModelContext context, ISymbolModel symbolModel)
		{
			this.context = context;
			this.symbolModel = symbolModel;
			if (symbolModel.ParentProject != null)
				this.Language = symbolModel.ParentProject.GetCodeModelLanguage();
		}
Exemplo 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();
 }
Exemplo 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;
		}
Exemplo 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;
        }
Exemplo 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;
		}
Exemplo 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;
        }
Exemplo 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
			};
		}
Exemplo 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
            };
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
			}
		}
Exemplo 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);
			}
		}
Exemplo 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");
			}
		}
Exemplo 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());
				}
			}
		}
Exemplo 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));
            }
        }
Exemplo n.º 22
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");
            }
        }
Exemplo n.º 23
0
 public CodeClass2(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Exemplo n.º 24
0
 public CodeDelegate(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Exemplo n.º 25
0
 public CodeParameter2(CodeModelContext context, IParameter parameter)
     : base(context, parameter)
 {
 }
Exemplo n.º 26
0
 public CodeProperty2(CodeModelContext context, IProperty property)
     : base(context, property)
 {
 }
Exemplo n.º 27
0
 public CodeAttribute2(CodeModelContext context, IAttribute attribute)
     : base(context, attribute)
 {
 }
 public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName)
     : this(context, new NamespaceName(namespaceName))
 {
 }
Exemplo n.º 29
0
 public CodeVariable(CodeModelContext context, IField field)
     : base(context, field)
 {
     this.field = field;
 }
Exemplo n.º 30
0
 public CodeInterface(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
     : base(context, typeDefinition, typeArguments)
 {
 }
Exemplo n.º 31
0
 public CodeElement(CodeModelContext context, IEntity entity)
 {
     this.context  = context;
     this.entity   = entity;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Exemplo n.º 32
0
 public CodeVariable(CodeModelContext context, IField field)
     : base(context, field)
 {
     this.field = field;
 }
Exemplo n.º 33
0
 public CodeElement(CodeModelContext context)
 {
     this.context = context;
 }
Exemplo n.º 34
0
 public CodeFunction2(CodeModelContext context, IMethod method)
     : base(context, method)
 {
 }
Exemplo n.º 35
0
 public CodeClass2(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Exemplo n.º 36
0
 public CodeProperty(CodeModelContext context, IProperty property)
     : base(context, property)
 {
     this.property = property;
 }
Exemplo n.º 37
0
 public CodeStruct(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Exemplo n.º 38
0
 public CodeClass(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition, typeDefinition.TypeArguments.ToArray())
 {
 }
Exemplo n.º 39
0
 public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type)
     : base(context, parent, type)
 {
 }
Exemplo n.º 40
0
 internal static TextPoint CreateStartPoint(CodeModelContext context, DomRegion region)
 {
     return new TextPoint(region.FileName, region.Begin, context.DocumentLoader);
 }
Exemplo n.º 41
0
 public CodeProperty2(CodeModelContext context, IProperty property)
     : base(context, property)
 {
 }
Exemplo n.º 42
0
 public CodeModel(CodeModelContext context, Project project)
 {
     this.context = context;
     this.project = project;
 }
Exemplo n.º 43
0
 public CodeParameter(CodeModelContext context, IParameter parameter)
     : base(context)
 {
     this.parameter = parameter;
 }
Exemplo n.º 44
0
 public CodeElementsInNamespace(CodeModelContext context, INamespace ns)
 {
     this.context = context;
     this.ns      = ns;
     GetCodeElements();
 }
Exemplo n.º 45
0
 public CodeTypeRef(CodeModelContext context, CodeElement parent, IType type)
 {
     this.context = context;
     this.parent  = parent;
     this.type    = type;
 }
Exemplo n.º 46
0
		public CodeFunction2(CodeModelContext context, IMethodModel methodModel)
			: base(context, methodModel)
		{
		}
Exemplo n.º 47
0
 public CodeFunction(CodeModelContext context, IMethod method)
     : base(context, method)
 {
     this.method = method;
 }
Exemplo n.º 48
0
		public CodeAttribute(CodeModelContext context, IAttribute attribute)
			: base(context)
		{
			this.attribute = attribute;
		}
Exemplo 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;
		}
Exemplo n.º 50
0
 public CodeModel(CodeModelContext context, Project project)
 {
     this.context = context;
     this.project = project;
 }
Exemplo n.º 51
0
 public CodeAttribute(CodeModelContext context, IAttribute attribute)
     : base(context)
 {
     this.attribute = attribute;
 }
Exemplo n.º 52
0
 public CodeInterface(CodeModelContext context, ITypeDefinition typeDefinition, params IType[] typeArguments)
     : base(context, typeDefinition, typeArguments)
 {
 }
Exemplo n.º 53
0
 public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type)
     : base(context, parent, type)
 {
 }
Exemplo n.º 54
0
 public CodeElementsInNamespace(CodeModelContext context)
     : this(context, context.DteProject.GetCompilationUnit().RootNamespace)
 {
 }
Exemplo 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");
     }
 }
Exemplo n.º 56
0
 public FileCodeModelCodeNamespace(CodeModelContext context, string namespaceName)
     : this(context, new NamespaceName(namespaceName))
 {
 }
Exemplo n.º 57
0
 public CodeElement(CodeModelContext context, IEntity entity)
 {
     this.context = context;
     this.entity = entity;
     this.Language = context.CurrentProject.GetCodeModelLanguage();
 }
Exemplo n.º 58
0
		public CodeClass(CodeModelContext context, ITypeDefinitionModel typeModel)
			: base(context, typeModel)
		{
		}
Exemplo n.º 59
0
 public CodeDelegate(CodeModelContext context, ITypeDefinition typeDefinition)
     : base(context, typeDefinition)
 {
 }
Exemplo n.º 60
0
 public CodeElement(CodeModelContext context)
 {
     this.context = context;
 }