39 changed files with 513 additions and 423 deletions
@ -1,58 +1,62 @@
@@ -1,58 +1,62 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeClass2 : CodeClass, global::EnvDTE.CodeClass2
|
||||
// {
|
||||
// IClassKindUpdater classKindUpdater;
|
||||
//
|
||||
// public CodeClass2(IProjectContent projectContent, IClass c, IClassKindUpdater classKindUpdater)
|
||||
// : base(projectContent, c)
|
||||
// {
|
||||
// this.classKindUpdater = classKindUpdater;
|
||||
// }
|
||||
//
|
||||
// public CodeClass2(IProjectContent projectContent, IClass c)
|
||||
// : this(projectContent, c, new ClassKindUpdater(c))
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public global::EnvDTE.CodeElements PartialClasses {
|
||||
// get { return new PartialClasses(this); }
|
||||
// }
|
||||
//
|
||||
// public static CodeClass2 CreateFromBaseType(IProjectContent projectContent, IReturnType baseType)
|
||||
// {
|
||||
// IClass baseTypeClass = baseType.GetUnderlyingClass();
|
||||
// return new CodeClass2(projectContent, baseTypeClass);
|
||||
// }
|
||||
//
|
||||
// public bool IsGeneric {
|
||||
// get { return Class.DotNetName.Contains("`"); }
|
||||
// }
|
||||
//
|
||||
// public global::EnvDTE.vsCMClassKind ClassKind {
|
||||
// get {
|
||||
// if (Class.IsPartial) {
|
||||
// return global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMClassKind.vsCMClassKindMainClass;
|
||||
// }
|
||||
// set {
|
||||
// if (value == global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass) {
|
||||
// classKindUpdater.MakeClassPartial();
|
||||
// } else {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsAbstract {
|
||||
// get { return Class.IsAbstract; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeClass2 : CodeClass, global::EnvDTE.CodeClass2 |
||||
{ |
||||
public CodeClass2(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
} |
||||
|
||||
public global::EnvDTE.CodeElements PartialClasses { |
||||
get { |
||||
var list = new CodeElementsList<CodeType>(); |
||||
var td = typeModel.Resolve(); |
||||
if (td != null) { |
||||
foreach (var fileName in td.Parts.Select(p => p.UnresolvedFile.FileName).Distinct()) { |
||||
var newContext = context.WithFilteredFileName(fileName); |
||||
list.Add(CodeType.Create(newContext, typeModel)); |
||||
} |
||||
} else { |
||||
list.Add(this); |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
public bool IsGeneric { |
||||
get { return typeModel.FullTypeName.TypeParameterCount > 0; } |
||||
} |
||||
|
||||
public global::EnvDTE.vsCMClassKind ClassKind { |
||||
get { |
||||
if (typeModel.IsPartial) { |
||||
return global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass; |
||||
} |
||||
return global::EnvDTE.vsCMClassKind.vsCMClassKindMainClass; |
||||
} |
||||
set { |
||||
if (value == this.ClassKind) |
||||
return; |
||||
if (value == global::EnvDTE.vsCMClassKind.vsCMClassKindPartialClass) { |
||||
var td = typeModel.Resolve(); |
||||
if (td == null) |
||||
throw new NotSupportedException(); |
||||
context.CodeGenerator.MakePartial(td); |
||||
} else { |
||||
throw new NotSupportedException(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool IsAbstract { |
||||
get { return typeModel.IsAbstract; } |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,24 +1,24 @@
@@ -1,24 +1,24 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeDelegate : CodeType, global::EnvDTE.CodeDelegate
|
||||
// {
|
||||
// public CodeDelegate(IProjectContent projectContent, IClass c)
|
||||
// : base(projectContent, c)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeDelegate()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementDelegate; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeDelegate : CodeType, global::EnvDTE.CodeDelegate |
||||
{ |
||||
public CodeDelegate(CodeModelContext context, ITypeDefinitionModel typeModel) |
||||
: base(context, typeModel) |
||||
{ |
||||
} |
||||
|
||||
public CodeDelegate() |
||||
{ |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementDelegate; } |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,37 +1,42 @@
@@ -1,37 +1,42 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameter : CodeElement, global::EnvDTE.CodeParameter
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
//
|
||||
// public CodeParameter(IProjectContent projectContent, IParameter parameter)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// this.Parameter = parameter;
|
||||
// }
|
||||
//
|
||||
// protected IParameter Parameter { get; private set; }
|
||||
//
|
||||
// public override global::EnvDTE.vsCMElement Kind {
|
||||
// get { return global::EnvDTE.vsCMElement.vsCMElementParameter; }
|
||||
// }
|
||||
//
|
||||
// public override string Name {
|
||||
// get { return Parameter.Name; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeTypeRef2 Type {
|
||||
// get { return new CodeTypeRef2(projectContent, this, Parameter.ReturnType); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElements Attributes {
|
||||
// get { return new CodeAttributes(Parameter); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeParameter : CodeElement, global::EnvDTE.CodeParameter |
||||
{ |
||||
protected readonly IParameter parameter; |
||||
|
||||
public CodeParameter(CodeModelContext context, IParameter parameter) |
||||
: base(context) |
||||
{ |
||||
this.parameter = parameter; |
||||
} |
||||
|
||||
public override global::EnvDTE.vsCMElement Kind { |
||||
get { return global::EnvDTE.vsCMElement.vsCMElementParameter; } |
||||
} |
||||
|
||||
public override string Name { |
||||
get { return parameter.Name; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeTypeRef2 Type { |
||||
get { return new CodeTypeRef2(context, this, parameter.Type); } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElements Attributes { |
||||
get { |
||||
var list = new CodeElementsList<CodeAttribute2>(); |
||||
foreach (var attr in parameter.Attributes) { |
||||
list.Add(new CodeAttribute2(context, attr)); |
||||
} |
||||
return list; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,36 +1,42 @@
@@ -1,36 +1,42 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameter2 : CodeParameter, global::EnvDTE.CodeParameter2
|
||||
// {
|
||||
// public CodeParameter2(IProjectContent projectContent, IParameter parameter)
|
||||
// : base(projectContent, parameter)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMParameterKind ParameterKind {
|
||||
// get { return GetParameterKind(); }
|
||||
// }
|
||||
//
|
||||
// global::EnvDTE.vsCMParameterKind GetParameterKind()
|
||||
// {
|
||||
// if (Parameter.IsOptional) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindOptional;
|
||||
// } else if (Parameter.IsOut) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindOut;
|
||||
// } else if (Parameter.IsRef) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindRef;
|
||||
// } else if (Parameter.IsParams) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindParamArray;
|
||||
// } else if (Parameter.IsIn()) {
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindIn;
|
||||
// }
|
||||
// return global::EnvDTE.vsCMParameterKind.vsCMParameterKindNone;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeParameter2 : CodeParameter, global::EnvDTE.CodeParameter2 |
||||
{ |
||||
public CodeParameter2(CodeModelContext context, IParameter parameter) |
||||
: base(context, parameter) |
||||
{ |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMParameterKind ParameterKind { |
||||
get { return GetParameterKind(); } |
||||
} |
||||
|
||||
global::EnvDTE.vsCMParameterKind GetParameterKind() |
||||
{ |
||||
global::EnvDTE.vsCMParameterKind kind = 0; |
||||
if (parameter.IsOptional) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindOptional; |
||||
} |
||||
if (parameter.IsOut) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindOut; |
||||
} |
||||
if (parameter.IsRef) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindRef; |
||||
} |
||||
if (parameter.IsParams) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindParamArray; |
||||
} |
||||
if (!(parameter.IsOut || parameter.IsRef)) { |
||||
kind |= global::EnvDTE.vsCMParameterKind.vsCMParameterKindIn; |
||||
} |
||||
return kind; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeParameters : CodeElementsList
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
//
|
||||
// public CodeParameters(IProjectContent projectContent, IEnumerable<IParameter> parameters)
|
||||
// {
|
||||
// this.projectContent = projectContent;
|
||||
// AddParameters(parameters);
|
||||
// }
|
||||
//
|
||||
// void AddParameters(IEnumerable<IParameter> parameters)
|
||||
// {
|
||||
// foreach (IParameter parameter in parameters) {
|
||||
// AddParameters(parameter);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void AddParameters(IParameter parameter)
|
||||
// {
|
||||
// AddCodeElement(new CodeParameter2(projectContent, parameter));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,52 +1,117 @@
@@ -1,52 +1,117 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeTypeRef : MarshalByRefObject, global::EnvDTE.CodeTypeRef
|
||||
// {
|
||||
// IProjectContent projectContent;
|
||||
// CodeElement parent;
|
||||
//
|
||||
// public CodeTypeRef()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public CodeTypeRef(IProjectContent projectContent, CodeElement parent, IReturnType returnType)
|
||||
// {
|
||||
// this.parent = parent;
|
||||
// this.projectContent = projectContent;
|
||||
// this.ReturnType = returnType;
|
||||
// }
|
||||
//
|
||||
// protected IReturnType ReturnType { get; private set; }
|
||||
//
|
||||
// public virtual string AsFullName {
|
||||
// get { return ReturnType.GetFullName(); }
|
||||
// }
|
||||
//
|
||||
// public virtual string AsString {
|
||||
// get {
|
||||
// if (projectContent.Language == LanguageProperties.VBNet) {
|
||||
// return ReturnType.AsVisualBasicString();
|
||||
// }
|
||||
// return ReturnType.AsCSharpString();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeElement Parent {
|
||||
// get { return parent; }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.CodeType CodeType {
|
||||
// get { return new CodeClass2(projectContent, ReturnType.GetUnderlyingClass()); }
|
||||
// }
|
||||
//
|
||||
// public virtual global::EnvDTE.vsCMTypeRef TypeKind {
|
||||
// get { return ReturnType.GetTypeKind(); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.CSharp; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeTypeRef : MarshalByRefObject, global::EnvDTE.CodeTypeRef |
||||
{ |
||||
protected readonly CodeModelContext context; |
||||
protected readonly CodeElement parent; |
||||
protected readonly IType type; |
||||
|
||||
public CodeTypeRef() |
||||
{ |
||||
} |
||||
|
||||
public CodeTypeRef(CodeModelContext context, CodeElement parent, IType type) |
||||
{ |
||||
this.context = context; |
||||
this.parent = parent; |
||||
this.type = type; |
||||
} |
||||
|
||||
public virtual string AsFullName { |
||||
get { return type.ReflectionName; } |
||||
} |
||||
|
||||
public virtual string AsString { |
||||
get { |
||||
return new CSharpAmbience().ConvertType(type); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeElement Parent { |
||||
get { return parent; } |
||||
} |
||||
|
||||
public virtual global::EnvDTE.CodeType CodeType { |
||||
get { |
||||
return EnvDTE.CodeType.Create(context, type); |
||||
} |
||||
} |
||||
|
||||
public virtual global::EnvDTE.vsCMTypeRef TypeKind { |
||||
get { |
||||
switch (type.Kind) { |
||||
case NRefactory.TypeSystem.TypeKind.Class: |
||||
if (type.IsKnownType(KnownTypeCode.String)) |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefString; |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
case NRefactory.TypeSystem.TypeKind.Struct: |
||||
var typeDef = type.GetDefinition(); |
||||
if (typeDef != null) |
||||
return GetStructTypeKind(typeDef.KnownTypeCode); |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
case NRefactory.TypeSystem.TypeKind.Delegate: |
||||
case NRefactory.TypeSystem.TypeKind.Interface: |
||||
case NRefactory.TypeSystem.TypeKind.Module: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
case NRefactory.TypeSystem.TypeKind.Void: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefVoid; |
||||
case NRefactory.TypeSystem.TypeKind.Array: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefArray; |
||||
case NRefactory.TypeSystem.TypeKind.Pointer: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefPointer; |
||||
default: |
||||
if (type.IsReferenceType == true) |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefObject; |
||||
else |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
} |
||||
} |
||||
} |
||||
|
||||
global::EnvDTE.vsCMTypeRef GetStructTypeKind(KnownTypeCode knownTypeCode) |
||||
{ |
||||
switch (knownTypeCode) { |
||||
case KnownTypeCode.Boolean: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefBool; |
||||
case KnownTypeCode.Char: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefChar; |
||||
case KnownTypeCode.SByte: |
||||
case KnownTypeCode.Byte: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefByte; |
||||
case KnownTypeCode.Int16: |
||||
case KnownTypeCode.UInt16: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefShort; |
||||
case KnownTypeCode.Int32: |
||||
case KnownTypeCode.UInt32: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefInt; |
||||
case KnownTypeCode.Int64: |
||||
case KnownTypeCode.UInt64: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefLong; |
||||
case KnownTypeCode.Single: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefFloat; |
||||
case KnownTypeCode.Double: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefDouble; |
||||
case KnownTypeCode.Decimal: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefDecimal; |
||||
case KnownTypeCode.Void: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefVoid; |
||||
case KnownTypeCode.IntPtr: |
||||
case KnownTypeCode.UIntPtr: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefPointer; |
||||
default: |
||||
return global::EnvDTE.vsCMTypeRef.vsCMTypeRefOther; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,20 +1,21 @@
@@ -1,20 +1,21 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class CodeTypeRef2 : CodeTypeRef, global::EnvDTE.CodeTypeRef2
|
||||
// {
|
||||
// public CodeTypeRef2(IProjectContent projectContent, CodeElement parent, IReturnType returnType)
|
||||
// : base(projectContent, parent, returnType)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public bool IsGeneric {
|
||||
// get { return ReturnType.DotNetName.Contains("{"); }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class CodeTypeRef2 : CodeTypeRef, global::EnvDTE.CodeTypeRef2 |
||||
{ |
||||
public CodeTypeRef2(CodeModelContext context, CodeElement parent, IType type) |
||||
: base(context, parent, type) |
||||
{ |
||||
} |
||||
|
||||
public bool IsGeneric { |
||||
get { return type.IsParameterized; } |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
|
||||
namespace ICSharpCode.PackageManagement.EnvDTE |
||||
{ |
||||
public class NamespaceName |
||||
{ |
||||
public NamespaceName(string parentNamespace, string name) |
||||
: this(GetQualifiedNamespaceName(parentNamespace, name)) |
||||
{ |
||||
} |
||||
|
||||
static string GetQualifiedNamespaceName(string parentNamespace, string name) |
||||
{ |
||||
if (String.IsNullOrEmpty(parentNamespace)) { |
||||
return name; |
||||
} |
||||
return String.Format("{0}.{1}", parentNamespace, name); |
||||
} |
||||
|
||||
public NamespaceName(string qualifiedName) |
||||
{ |
||||
this.QualifiedName = qualifiedName; |
||||
LastPart = GetLastPartOfNamespace(); |
||||
} |
||||
|
||||
string GetLastPartOfNamespace() |
||||
{ |
||||
int index = QualifiedName.LastIndexOf('.'); |
||||
return QualifiedName.Substring(index + 1); |
||||
} |
||||
|
||||
public string LastPart { get; private set; } |
||||
public string QualifiedName { get; private set; } |
||||
|
||||
public NamespaceName CreateChildNamespaceName(string name) |
||||
{ |
||||
return new NamespaceName(QualifiedName, name); |
||||
} |
||||
} |
||||
} |
||||
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.PackageManagement.EnvDTE
|
||||
//{
|
||||
// public class PartialClasses : CodeElementsList
|
||||
// {
|
||||
// public PartialClasses(CodeClass2 codeClass)
|
||||
// {
|
||||
// AddCodeElement(codeClass);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.PackageManagement.EnvDTE; |
||||
using NUnit.Framework; |
||||
|
||||
namespace PackageManagement.Tests.EnvDTE |
||||
{ |
||||
[TestFixture] |
||||
public class NamespaceNameTests |
||||
{ |
||||
NamespaceName namespaceName; |
||||
|
||||
void CreateNamespaceName(string parent, string name) |
||||
{ |
||||
namespaceName = new NamespaceName(parent, name); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedName_ParentNamespaceIsTest_ReturnsTestPrefix() |
||||
{ |
||||
CreateNamespaceName("Test", "Child"); |
||||
|
||||
string name = namespaceName.QualifiedName; |
||||
|
||||
Assert.AreEqual("Test.Child", name); |
||||
} |
||||
|
||||
[Test] |
||||
public void QualifiedName_ParentNamespaceIsEmptyString_ReturnsJustChildNamespaceName() |
||||
{ |
||||
CreateNamespaceName(String.Empty, "Child"); |
||||
|
||||
string name = namespaceName.QualifiedName; |
||||
|
||||
Assert.AreEqual("Child", name); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue