diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
index 6eeeaf551d..7ac8ae7bc8 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
@@ -85,7 +85,9 @@ namespace CSharpBinding
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
{
CSharpProject p = new CSharpProject(info);
- p.ImportOptions(projectOptions.Attributes);
+ if (projectOptions != null) {
+ p.ImportOptions(projectOptions.Attributes);
+ }
return p;
}
}
diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
index 071e3b7ef7..792f880c16 100644
--- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
+++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
@@ -85,7 +85,9 @@ namespace VBNetBinding
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
{
VBNetProject p = new VBNetProject(info);
- p.ImportOptions(projectOptions.Attributes);
+ if (projectOptions != null) {
+ p.ImportOptions(projectOptions.Attributes);
+ }
return p;
}
}
diff --git a/src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs b/src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
index da5c5ce3dd..ea8d0657ba 100644
--- a/src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
+++ b/src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
@@ -118,8 +118,14 @@ namespace ICSharpCode.FormDesigner
this.viewContent = viewContent;
this.textAreaControlProvider = viewContent as ITextEditorControlProvider;
- Reload();
-
+ }
+
+ bool isInitialized = false;
+
+ void Initialize()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
@@ -168,6 +174,7 @@ namespace ICSharpCode.FormDesigner
public void Reload()
{
+ Initialize();
bool dirty = viewContent.IsDirty;
// TODO:
// loader.TextContent = Document.TextContent;
@@ -179,7 +186,7 @@ namespace ICSharpCode.FormDesigner
p.Controls.Add(designer);
}
} catch (Exception e) {
- Console.WriteLine(e);
+ MessageService.ShowError(e);
}
}
@@ -224,6 +231,7 @@ namespace ICSharpCode.FormDesigner
public override void Selected()
{
+ Reload();
IsFormDesignerVisible = true;
foreach(AxSideTab tab in ToolboxProvider.SideTabs) {
if (!SharpDevelopSideBar.SideBar.Tabs.Contains(tab)) {
@@ -233,7 +241,6 @@ namespace ICSharpCode.FormDesigner
SharpDevelopSideBar.SideBar.Refresh();
propertyContainer.Host = Host;
UpdateSelectableObjects();
- Reload();
}
public override void Deselected()
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 1a58b3ef26..f232bbc61f 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -84,18 +84,18 @@
-
+
-
+
-
+
-
+
@@ -110,7 +110,7 @@
-
+
@@ -121,7 +121,6 @@
-
@@ -361,9 +360,6 @@
-
-
-
diff --git a/src/Main/Base/Project/Src/Dom/IClass.cs b/src/Main/Base/Project/Src/Dom/IClass.cs
index 11867a1090..853a5d9869 100644
--- a/src/Main/Base/Project/Src/Dom/IClass.cs
+++ b/src/Main/Base/Project/Src/Dom/IClass.cs
@@ -46,10 +46,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get;
}
- IRegion BodyRegion {
- get;
- }
-
List BaseTypes {
get;
}
@@ -82,10 +78,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get;
}
- object DeclaredIn {
- get;
- }
-
IClass BaseClass {
get;
}
diff --git a/src/Main/Base/Project/Src/Dom/IUsing.cs b/src/Main/Base/Project/Src/Dom/IUsing.cs
index 5641350240..a615cf6fcd 100644
--- a/src/Main/Base/Project/Src/Dom/IUsing.cs
+++ b/src/Main/Base/Project/Src/Dom/IUsing.cs
@@ -6,7 +6,6 @@
//
using System;
-using System.Collections;
using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
@@ -21,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom
get;
}
- SortedList Aliases {
+ SortedList Aliases {
get;
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractComment.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractComment.cs
deleted file mode 100644
index 3641a7d06d..0000000000
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractComment.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-//
-//
-//
-//
-//
-using System;
-using System.Collections.Generic;
-
-namespace ICSharpCode.SharpDevelop.Dom {
-
- [Serializable]
- public abstract class AbstractComment : System.MarshalByRefObject, IComment
- {
- protected bool isBlockComment;
- protected string commentTag;
- protected string commentText;
- protected IRegion region;
-
- public virtual bool IsBlockComment {
- get {
- return isBlockComment;
- }
- }
-
- public virtual string CommentTag {
- get {
- return commentTag;
- }
- }
-
- public virtual string CommentText {
- get {
- return commentText;
- }
- }
-
- public virtual IRegion Region {
- get {
- return region;
- }
- }
- }
-}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs
index 1ff785e0d6..526fb49d4f 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs
@@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Dom
[Serializable]
public abstract class AbstractDecoration : MarshalByRefObject, IDecoration
{
- protected ModifierEnum modifiers = ModifierEnum.None;
- protected List attributes = null;
+ ModifierEnum modifiers = ModifierEnum.None;
+ List attributes = null;
IClass declaringType;
object userData = null;
@@ -26,7 +26,6 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
-
public object UserData {
get {
return userData;
@@ -36,13 +35,16 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public virtual ModifierEnum Modifiers {
+ public ModifierEnum Modifiers {
get {
return modifiers;
}
+ set {
+ modifiers = value;
+ }
}
- public virtual List Attributes {
+ public List Attributes {
get {
if (attributes == null) {
attributes = new List();
@@ -50,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return attributes;
}
}
-
+
public abstract string DocumentationTag {
get;
}
@@ -60,13 +62,13 @@ namespace ICSharpCode.SharpDevelop.Dom
return (modifiers & ModifierEnum.Abstract) == ModifierEnum.Abstract;
}
}
-
+
public bool IsSealed {
get {
return (modifiers & ModifierEnum.Sealed) == ModifierEnum.Sealed;
}
}
-
+
public bool IsStatic {
get {
return (modifiers & ModifierEnum.Static) == ModifierEnum.Static;
@@ -78,79 +80,79 @@ namespace ICSharpCode.SharpDevelop.Dom
return (modifiers & ModifierEnum.Const) == ModifierEnum.Const;
}
}
-
+
public bool IsVirtual {
get {
return (modifiers & ModifierEnum.Virtual) == ModifierEnum.Virtual;
}
}
-
+
public bool IsPublic {
get {
return (modifiers & ModifierEnum.Public) == ModifierEnum.Public;
}
}
-
+
public bool IsProtected {
get {
return (modifiers & ModifierEnum.Protected) == ModifierEnum.Protected;
}
}
-
+
public bool IsPrivate {
get {
return (modifiers & ModifierEnum.Private) == ModifierEnum.Private;
}
}
-
+
public bool IsInternal {
get {
return (modifiers & ModifierEnum.Internal) == ModifierEnum.Internal;
}
}
-
+
public bool IsProtectedAndInternal {
get {
return (modifiers & (ModifierEnum.Internal | ModifierEnum.Protected)) == (ModifierEnum.Internal | ModifierEnum.Protected);
}
}
-
+
public bool IsProtectedOrInternal {
get {
return (modifiers & ModifierEnum.ProtectedOrInternal) == ModifierEnum.ProtectedOrInternal;
}
}
-
+
public bool IsLiteral {
get {
return (modifiers & ModifierEnum.Const) == ModifierEnum.Const;
}
}
-
+
public bool IsReadonly {
get {
return (modifiers & ModifierEnum.Readonly) == ModifierEnum.Readonly;
}
}
-
+
public bool IsOverride {
get {
return (modifiers & ModifierEnum.Override) == ModifierEnum.Override;
}
}
-
+
public bool IsFinal {
get {
return (modifiers & ModifierEnum.Final) == ModifierEnum.Final;
}
}
-
+
public bool IsSpecialName {
get {
return (modifiers & ModifierEnum.SpecialName) == ModifierEnum.SpecialName;
}
}
-
+
public bool IsNew {
get {
return (modifiers & ModifierEnum.New) == ModifierEnum.New;
@@ -206,7 +208,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
- public virtual int CompareTo(IDecoration value)
+ public virtual int CompareTo(IDecoration value)
{
int cmp;
@@ -217,7 +219,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return DiffUtility.Compare(Attributes, value.Attributes);
}
- int IComparable.CompareTo(object value)
+ int IComparable.CompareTo(object value)
{
return CompareTo((IDecoration)value);
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs
index 1ccb345a54..8bd72d9234 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs
@@ -10,7 +10,7 @@ using System.Reflection;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public abstract class AbstractEvent : AbstractMember, IEvent
+ public class DefaultEvent : AbstractMember, IEvent
{
protected IRegion bodyRegion;
protected EventAttributes eventAttributes;
@@ -29,7 +29,6 @@ namespace ICSharpCode.SharpDevelop.Dom
return bodyRegion;
}
}
-
public virtual EventAttributes EventAttributes {
get {
@@ -37,10 +36,21 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public AbstractEvent(IClass declaringType) : base(declaringType)
+ protected DefaultEvent(IClass declaringType, string name) : base(declaringType, name)
{
}
+ public DefaultEvent(string name, IReturnType type, ModifierEnum m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, name)
+ {
+ this.ReturnType = type;
+ this.Region = region;
+ this.bodyRegion = bodyRegion;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
+ }
+ }
+
public virtual int CompareTo(IEvent value)
{
int cmp;
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs
index b2aab20a49..83c8487896 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs
@@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public AbstractField(IClass declaringType) : base(declaringType)
+ public AbstractField(IClass declaringType, string name) : base(declaringType, name)
{
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractIndexer.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractIndexer.cs
index f101ea0c75..ee668b079a 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractIndexer.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractIndexer.cs
@@ -55,7 +55,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public AbstractIndexer(IClass declaringType) : base(declaringType)
+ public AbstractIndexer(IClass declaringType) : base(declaringType, null)
{
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs
index 1fe85ced1d..9fe6b40cd1 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs
@@ -12,13 +12,16 @@ namespace ICSharpCode.SharpDevelop.Dom
[Serializable]
public abstract class AbstractMember : AbstractNamedEntity, IMember
{
- protected IReturnType returnType;
- protected IRegion region;
+ IReturnType returnType;
+ IRegion region;
public virtual IRegion Region {
get {
return region;
}
+ set {
+ region = value;
+ }
}
public virtual IReturnType ReturnType {
@@ -30,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public AbstractMember(IClass declaringType) : base(declaringType)
+ public AbstractMember(IClass declaringType, string name) : base(declaringType, name)
{
}
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs
index 537dad587d..c66bd3d2be 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs
@@ -40,14 +40,14 @@ namespace ICSharpCode.SharpDevelop.Dom
parameters = value;
}
}
-
+
public virtual bool IsConstructor {
get {
- return returnType == null || Name == "#ctor";
+ return ReturnType == null || Name == "#ctor";
}
}
- public AbstractMethod(IClass declaringType) : base(declaringType)
+ public AbstractMethod(IClass declaringType, string name) : base(declaringType, name)
{
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs
index 9aa70522fa..5f4bdcf885 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs
@@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Dom
public override string DocumentationTag {
get {
- return FullyQualifiedName;
+ return "T:" + FullyQualifiedName;
}
}
@@ -84,5 +84,13 @@ namespace ICSharpCode.SharpDevelop.Dom
public AbstractNamedEntity(IClass declaringType) : base(declaringType)
{
}
+
+ public AbstractNamedEntity(IClass declaringType, string name) : base(declaringType)
+ {
+ System.Diagnostics.Debug.Assert(declaringType != null);
+ this.name = name;
+ nspace = declaringType.FullyQualifiedName;
+ fullyQualifiedName = nspace + '.' + name;
+ }
}
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs
index baaf8637f2..8a951413fd 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs
@@ -83,7 +83,7 @@ namespace ICSharpCode.SharpDevelop.Dom {
}
}
- public AbstractProperty(IClass declaringType) : base(declaringType)
+ public AbstractProperty(IClass declaringType, string name) : base(declaringType, name)
{
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractUsing.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractUsing.cs
deleted file mode 100644
index 1ea7b3ec4f..0000000000
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractUsing.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-//
-//
-//
-//
-//
-using System;
-using System.Text;
-using System.Collections;
-using System.Collections.Generic;
-using ICSharpCode.Core;
-
-namespace ICSharpCode.SharpDevelop.Dom
-{
- [Serializable]
- public abstract class AbstractUsing : MarshalByRefObject, IUsing
- {
- protected IRegion region;
-
- List usings = new List();
- SortedList aliases = new SortedList();
-
- public IRegion Region {
- get {
- return region;
- }
- }
-
- public List Usings {
- get {
- return usings;
- }
- }
-
- public SortedList Aliases {
- get {
- return aliases;
- }
- }
-
- public string SearchNamespace(string partitialNamespaceName)
- {
- if (ParserService.CurrentProjectContent.NamespaceExists(partitialNamespaceName)) {
- return partitialNamespaceName;
- }
-
- // search for partitial namespaces
- string declaringNamespace = (string)aliases[""];
- if (declaringNamespace != null) {
- while (declaringNamespace.Length > 0) {
- // TODO: case insensitive : : declaringNamespace.ToLower().EndsWith(partitialNamespaceName.ToLower()) ) && ParserService.CurrentProjectContent.NamespaceExists(declaringNamespace, caseSensitive)
- if (declaringNamespace.EndsWith(partitialNamespaceName)) {
- return declaringNamespace;
- }
- int index = declaringNamespace.IndexOf('.');
- if (index > 0) {
- declaringNamespace = declaringNamespace.Substring(0, index);
- } else {
- break;
- }
- }
- }
-
- // Remember:
- // Each namespace has an own using object
- // The namespace name is an alias which has the key ""
- foreach (DictionaryEntry entry in aliases) {
- string aliasString = entry.Key.ToString();
- // TODO: case insensitive: partitialNamespaceName.ToLower().StartsWith(aliasString.ToLower())
- if (partitialNamespaceName.StartsWith(aliasString)) {
- if (aliasString.Length >= 0) {
- string nsName = nsName = String.Concat(entry.Value.ToString(), partitialNamespaceName.Remove(0, aliasString.Length));
- if (ParserService.CurrentProjectContent.NamespaceExists(nsName)) {
- return nsName;
- }
- }
- }
- }
- return null;
- }
-
- public IClass SearchType(string partitialTypeName)
- {
- IClass c = ParserService.CurrentProjectContent.GetClass(partitialTypeName);
- if (c != null) {
- return c;
- }
-
- foreach (string str in usings) {
- string possibleType = String.Concat(str, ".", partitialTypeName);
- c = ParserService.CurrentProjectContent.GetClass(possibleType);
- if (c != null) {
- return c;
- }
- }
-
- // search class in partitial namespaces
- string declaringNamespace = (string)aliases[""];
- if (declaringNamespace != null) {
- while (declaringNamespace.Length > 0) {
- string className = String.Concat(declaringNamespace, ".", partitialTypeName);
- c = ParserService.CurrentProjectContent.GetClass(className);
- if (c != null) {
- return c;
- }
- int index = declaringNamespace.IndexOf('.');
- if (index > 0) {
- declaringNamespace = declaringNamespace.Substring(0, index);
- } else {
- break;
- }
- }
- }
-
- foreach (DictionaryEntry entry in aliases) {
- string aliasString = entry.Key.ToString();
- // TODO: case insensitive: : partitialTypeName.ToLower().StartsWith(aliasString.ToLower())
- if (partitialTypeName.StartsWith(aliasString)) {
- string className = null;
- if (aliasString.Length > 0) {
- className = String.Concat(entry.Value.ToString(), partitialTypeName.Remove(0, aliasString.Length));
- c = ParserService.CurrentProjectContent.GetClass(className);
- if (c != null) {
- return c;
- }
- }
- }
- }
- return null;
- }
-
- public override string ToString()
- {
- StringBuilder builder = new StringBuilder("[AbstractUsing: using list=");
- foreach (string str in usings) {
- builder.Append(str);
- builder.Append(", ");
- }
- builder.Append("]");
- return builder.ToString();
- }
- }
-}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractAttribute.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultAttribute.cs
similarity index 59%
rename from src/Main/Base/Project/Src/Dom/Implementations/AbstractAttribute.cs
rename to src/Main/Base/Project/Src/Dom/Implementations/DefaultAttribute.cs
index a575144efd..294c98be33 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractAttribute.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultAttribute.cs
@@ -11,12 +11,18 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public class AbstractAttributeSection : IAttributeSection
+ public class DefaultAttributeSection : IAttributeSection
{
- protected AttributeTarget attributeTarget;
+ AttributeTarget attributeTarget;
List attributes = null;
-
- public virtual AttributeTarget AttributeTarget {
+
+ public DefaultAttributeSection(AttributeTarget attributeTarget, List attributes)
+ {
+ this.attributeTarget = attributeTarget;
+ this.attributes = attributes;
+ }
+
+ public AttributeTarget AttributeTarget {
get {
return attributeTarget;
}
@@ -24,17 +30,11 @@ namespace ICSharpCode.SharpDevelop.Dom
attributeTarget = value;
}
}
-
- public virtual List Attributes {
+
+ public List Attributes {
get {
- if (attributes == null) {
- attributes = new List();
- }
return attributes;
}
- set {
- attributes = value;
- }
}
public virtual int CompareTo(IAttributeSection value) {
@@ -51,13 +51,27 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public abstract class AbstractAttribute : IAttribute
+ public class DefaultAttribute : IAttribute
{
- protected string name;
- protected ArrayList positionalArguments = new ArrayList();
- protected SortedList namedArguments = new SortedList();
-
- public virtual string Name {
+ string name;
+ ArrayList positionalArguments;
+ SortedList namedArguments;
+
+ public DefaultAttribute(string name)
+ {
+ this.name = name;
+ this.positionalArguments = new ArrayList();
+ this.namedArguments = new SortedList();
+ }
+
+ public DefaultAttribute(string name, ArrayList positionalArguments, SortedList namedArguments)
+ {
+ this.name = name;
+ this.positionalArguments = positionalArguments;
+ this.namedArguments = namedArguments;
+ }
+
+ public string Name {
get {
return name;
}
@@ -65,21 +79,15 @@ namespace ICSharpCode.SharpDevelop.Dom
name = value;
}
}
- public virtual ArrayList PositionalArguments { // [expression]
+ public ArrayList PositionalArguments { // [expression]
get {
return positionalArguments;
}
- set {
- positionalArguments = value;
- }
}
- public virtual SortedList NamedArguments { // string/expression
+ public SortedList NamedArguments { // string/expression
get {
return namedArguments;
}
- set {
- namedArguments = value;
- }
}
public virtual int CompareTo(IAttribute value) {
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractClass.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
similarity index 93%
rename from src/Main/Base/Project/Src/Dom/Implementations/AbstractClass.cs
rename to src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
index 8e03eebf94..43f869e15a 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractClass.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
@@ -16,12 +16,10 @@ using ICSharpCode.SharpDevelop;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public abstract class AbstractClass : AbstractNamedEntity, IClass, IComparable
+ public class DefaultClass : AbstractNamedEntity, IClass, IComparable
{
- protected ClassType classType;
- protected IRegion region;
- protected IRegion bodyRegion;
- protected object declaredIn;
+ ClassType classType;
+ IRegion region;
ICompilationUnit compilationUnit;
@@ -34,18 +32,24 @@ namespace ICSharpCode.SharpDevelop.Dom
List events = null;
List indexer = null;
- public override string DocumentationTag {
- get {
- return "T:" + this.FullyQualifiedName;
- }
+ public DefaultClass(ICompilationUnit compilationUnit, string fullyQualifiedName) : base(null)
+ {
+ this.compilationUnit = compilationUnit;
+ this.FullyQualifiedName = fullyQualifiedName;
}
- protected AbstractClass(ICompilationUnit compilationUnit, IClass declaringType) : base(declaringType)
+ public DefaultClass(ICompilationUnit compilationUnit, IClass declaringType) : base(declaringType)
{
this.compilationUnit = compilationUnit;
}
-
+ public DefaultClass(ICompilationUnit compilationUnit, ClassType classType, ModifierEnum modifiers, IRegion region, IClass declaringType) : base(declaringType)
+ {
+ this.compilationUnit = compilationUnit;
+ this.region = region;
+ this.classType = classType;
+ Modifiers = modifiers;
+ }
public ICompilationUnit CompilationUnit {
get {
@@ -60,31 +64,22 @@ namespace ICSharpCode.SharpDevelop.Dom
}
- public virtual ClassType ClassType {
+ public ClassType ClassType {
get {
return classType;
}
- }
-
- public virtual IRegion Region {
- get {
- return region;
- }
- }
-
- public virtual IRegion BodyRegion {
- get {
- return bodyRegion;
+ set {
+ classType = value;
}
}
- public object DeclaredIn {
+ public IRegion Region {
get {
- return declaredIn;
+ return region;
}
}
- public virtual List BaseTypes {
+ public List BaseTypes {
get {
if (baseTypes == null) {
baseTypes = new List();
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/DefaultComment.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultComment.cs
new file mode 100644
index 0000000000..6ff1375e41
--- /dev/null
+++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultComment.cs
@@ -0,0 +1,52 @@
+//
+//
+//
+//
+//
+//
+using System;
+using System.Collections.Generic;
+
+namespace ICSharpCode.SharpDevelop.Dom {
+
+ [Serializable]
+ public class DefaultComment : System.MarshalByRefObject, IComment
+ {
+ bool isBlockComment;
+ string commentTag;
+ string commentText;
+ IRegion region;
+
+ public DefaultComment(bool isBlockComment, string commentTag, string commentText, IRegion region)
+ {
+ this.isBlockComment = isBlockComment;
+ this.commentTag = commentTag;
+ this.commentText = commentText;
+ this.region = region;
+ }
+
+ public bool IsBlockComment {
+ get {
+ return isBlockComment;
+ }
+ }
+
+ public string CommentTag {
+ get {
+ return commentTag;
+ }
+ }
+
+ public string CommentText {
+ get {
+ return commentText;
+ }
+ }
+
+ public IRegion Region {
+ get {
+ return region;
+ }
+ }
+ }
+}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractCompilationUnit.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs
similarity index 75%
rename from src/Main/Base/Project/Src/Dom/Implementations/AbstractCompilationUnit.cs
rename to src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs
index b0764ff87f..2cc369d9ab 100644
--- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractCompilationUnit.cs
+++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs
@@ -13,16 +13,17 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public abstract class AbstractCompilationUnit : ICompilationUnit
+ public class DefaultCompilationUnit : ICompilationUnit
{
- protected List usings = new List();
- protected List classes = new List();
- protected List attributes = new List();
- protected bool errorsDuringCompile = false;
- protected object tag = null;
- protected List foldingRegions = new List();
- protected string fileName = "";
- protected List tagComments = new List();
+ List usings = new List();
+ List classes = new List();
+ List attributes = new List();
+ List foldingRegions = new List();
+ List tagComments = new List();
+
+ bool errorsDuringCompile = false;
+ object tag = null;
+ string fileName = "";
IProjectContent projectContent;
public string FileName {
@@ -83,12 +84,16 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public abstract List MiscComments {
- get;
+ public virtual List MiscComments {
+ get {
+ return null;
+ }
}
- public abstract List DokuComments {
- get;
+ public virtual List DokuComments {
+ get {
+ return null;
+ }
}
public virtual List TagComments {
@@ -97,8 +102,9 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- protected AbstractCompilationUnit(IProjectContent projectContent)
+ public DefaultCompilationUnit(IProjectContent projectContent)
{
+ Debug.Assert(projectContent != null);
this.projectContent = projectContent;
}
@@ -114,12 +120,12 @@ namespace ICSharpCode.SharpDevelop.Dom
- ///
- /// Returns all (nestet) classes in which the carret currently is exept
- /// the innermost class, returns an empty collection if the carret is in
+ ///
+ /// Returns all (nested) classes in which the caret currently is exept
+ /// the innermost class, returns an empty collection if the caret is in
/// no class or only in the innermost class.
- /// the most outer class is the last in the collection.
- ///
+ /// Zhe most outer class is the last in the collection.
+ ///
public List GetOuterClasses(int caretLine, int caretColumn)
{
List classes = new List();
@@ -157,7 +163,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
public override string ToString() {
- return String.Format("[AbstractCompilationUnit: classes = {0}, fileName = {1}]",
+ return String.Format("[CompilationUnit: classes = {0}, fileName = {1}]",
classes.Count,
fileName);
}
diff --git a/src/Main/Base/Project/Src/Dom/Implementations/DefaultUsing.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultUsing.cs
new file mode 100644
index 0000000000..420dda488e
--- /dev/null
+++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultUsing.cs
@@ -0,0 +1,113 @@
+//
+//
+//
+//
+//
+//
+using System;
+using System.Text;
+using System.Collections.Generic;
+using ICSharpCode.Core;
+
+namespace ICSharpCode.SharpDevelop.Dom
+{
+ [Serializable]
+ public class DefaultUsing : MarshalByRefObject, IUsing
+ {
+ IRegion region;
+ IProjectContent projectContent;
+
+ public DefaultUsing(IProjectContent projectContent)
+ {
+ this.projectContent = projectContent;
+ }
+
+ public DefaultUsing(IProjectContent projectContent, IRegion region) : this(projectContent)
+ {
+ this.region = region;
+ }
+
+ List usings = new List();
+ SortedList aliases = new SortedList();
+
+ public IRegion Region {
+ get {
+ return region;
+ }
+ }
+
+ public List Usings {
+ get {
+ return usings;
+ }
+ }
+
+ public SortedList Aliases {
+ get {
+ return aliases;
+ }
+ }
+
+ public string SearchNamespace(string partitialNamespaceName)
+ {
+ foreach (KeyValuePair entry in aliases) {
+ string aliasString = entry.Key;
+ // TODO: case insensitive: partitialNamespaceName.ToLower().StartsWith(aliasString.ToLower())
+ if (partitialNamespaceName.StartsWith(aliasString)) {
+ if (aliasString.Length >= 0) {
+ string nsName = nsName = String.Concat(entry.Value, partitialNamespaceName.Remove(0, aliasString.Length));
+ if (projectContent.NamespaceExists(nsName)) {
+ return nsName;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public IClass SearchType(string partitialTypeName)
+ {
+ foreach (string str in usings) {
+ string possibleType = String.Concat(str, ".", partitialTypeName);
+ IClass c = projectContent.GetClass(possibleType);
+ if (c != null) {
+ return c;
+ }
+ }
+
+ foreach (KeyValuePair entry in aliases) {
+ string aliasString = entry.Key;
+ // TODO: case insensitive: : partitialTypeName.ToLower().StartsWith(aliasString.ToLower())
+ if (partitialTypeName.StartsWith(aliasString)) {
+ string className = null;
+ if (aliasString.Length > 0) {
+ className = String.Concat(entry.Value, partitialTypeName.Remove(0, aliasString.Length));
+ IClass c = projectContent.GetClass(className);
+ if (c != null) {
+ return c;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public override string ToString()
+ {
+ StringBuilder builder = new StringBuilder("[AbstractUsing: ");
+ foreach (string str in usings) {
+ builder.Append(str);
+ builder.Append(", ");
+ }
+ foreach (KeyValuePair p in aliases) {
+ builder.Append(p.Key);
+ builder.Append("=");
+ builder.Append(p.Value);
+ builder.Append(", ");
+ }
+ builder.Length -= 2; // remove last ", "
+ builder.Append("]");
+ return builder.ToString();
+ }
+ }
+}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/AttributeSection.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/AttributeSection.cs
deleted file mode 100644
index 1da956b48b..0000000000
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/AttributeSection.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// created on 08.09.2003 at 16:17
-
-using ICSharpCode.SharpDevelop.Dom;
-using System.Collections;
-using System.Collections.Generic;
-
-namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
-{
- public class AttributeSection : AbstractAttributeSection
- {
- public AttributeSection(AttributeTarget attributeTarget, List attributes) {
- this.attributeTarget = attributeTarget;
- this.Attributes = attributes;
- }
- }
- public class ASTAttribute : AbstractAttribute
- {
- public ASTAttribute(string name, ArrayList positionalArguments, SortedList namedArguments)
- {
- this.name = name;
- this.positionalArguments = positionalArguments;
- this.namedArguments = namedArguments;
- }
- }
-}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Class.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Class.cs
deleted file mode 100644
index 9e757a9adb..0000000000
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Class.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// created on 06.08.2003 at 12:37
-
-using System;
-using System.Diagnostics;
-
-using ICSharpCode.SharpDevelop.Dom;
-using ICSharpCode.NRefactory.Parser.AST;
-
-namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
-{
- public class Class : AbstractClass
- {
- public Class(ICompilationUnit cu, ClassType t, Modifier m, IRegion region, IClass declaringType) : base(cu, declaringType)
- {
- classType = t;
- this.region = region;
- modifiers = (ModifierEnum)m;
- }
-
- public void UpdateModifier()
- {
- if (classType == ClassType.Enum) {
- foreach (Field f in Fields) {
- f.AddModifier(ModifierEnum.Public);
- }
- return;
- }
- if (classType != ClassType.Interface) {
- return;
- }
- foreach (Class c in InnerClasses) {
- c.modifiers = c.modifiers | ModifierEnum.Public;
- }
- foreach (IMethod m in Methods) {
- if (m is Constructor) {
- ((Constructor)m).AddModifier(ModifierEnum.Public);
- } else if (m is Method) {
- ((Method)m).AddModifier(ModifierEnum.Public);
- } else {
- Debug.Assert(false, "Unexpected type in method of interface. Can not set modifier to public!");
- }
- }
- foreach (Event e in Events) {
- e.AddModifier(ModifierEnum.Public);
- }
- foreach (Field f in Fields) {
- f.AddModifier(ModifierEnum.Public);
- }
- foreach (Indexer i in Indexer) {
- i.AddModifier(ModifierEnum.Public);
- }
- foreach (Property p in Properties) {
- p.AddModifier(ModifierEnum.Public);
- }
-
- }
- }
-}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs
index c1b4dcf886..96d3891b7a 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs
@@ -7,19 +7,13 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Constructor : AbstractMethod
{
- public void AddModifier(ModifierEnum m)
+ public Constructor(Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, "#ctor")
{
- modifiers = modifiers | m;
- }
-
- public Constructor(Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
- {
- FullyQualifiedName = "#ctor";
- this.region = region;
+ this.Region = region;
this.bodyRegion = bodyRegion;
- modifiers = (ModifierEnum)m;
- if (modifiers == ModifierEnum.None) {
- modifiers = ModifierEnum.Private;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs
index 335527dd7f..99985d15bf 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs
@@ -7,17 +7,10 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Destructor : AbstractMethod
{
- public void AddModifier(ModifierEnum m)
+ public Destructor(IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, "~" + declaringType.Name)
{
- modifiers = modifiers | m;
- }
-
- public Destructor(string className, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
- {
- FullyQualifiedName = "~" + className;
- this.region = region;
+ this.Region = region;
this.bodyRegion = bodyRegion;
- modifiers = (ModifierEnum)m;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs
index 8746395283..d42d49fd8f 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs
@@ -7,24 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Field : AbstractField
{
- public void AddModifier(ModifierEnum m)
+ public Field(ReturnType type, string name, Modifier m, IRegion region, IClass declaringType) : base(declaringType, name)
{
- modifiers = modifiers | m;
- }
-
- public Field(ReturnType type, string name, Modifier m, IRegion region, IClass declaringType) : base(declaringType)
- {
- this.returnType = type;
- this.FullyQualifiedName = declaringType.FullyQualifiedName + "." + name;
- this.region = region;
- modifiers = (ModifierEnum)m;
- if (modifiers == ModifierEnum.None) {
- modifiers = ModifierEnum.Private;
+ this.ReturnType = type;
+ this.Region = region;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
}
}
- public void SetModifiers(ModifierEnum m)
- {
- modifiers = m;
- }
}
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs
index 9f03de29e8..2fab4d938b 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs
@@ -8,20 +8,15 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Indexer : AbstractIndexer
{
- public void AddModifier(ModifierEnum m)
- {
- modifiers = modifiers | m;
- }
-
public Indexer(ReturnType type, List parameters, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
{
- returnType = type;
+ this.ReturnType = type;
this.Parameters = parameters;
- this.region = region;
+ this.Region = region;
this.bodyRegion = bodyRegion;
- modifiers = (ModifierEnum)m;
- if (modifiers == ModifierEnum.None) {
- modifiers = ModifierEnum.Private;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs
index 86667d0010..49960b2919 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs
@@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Method : AbstractMethod
{
- public void AddModifier(ModifierEnum m)
+ public Method(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, name)
{
- modifiers = modifiers | m;
- }
-
- public Method(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
- {
- FullyQualifiedName = declaringType.FullyQualifiedName + "." + name;
- returnType = type;
- this.region = region;
+ this.ReturnType = type;
+ this.Region = region;
this.bodyRegion = bodyRegion;
- modifiers = (ModifierEnum)m;
- if (modifiers == ModifierEnum.None) {
- modifiers = ModifierEnum.Private;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
index 5f6c557653..4af27b459a 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
@@ -13,15 +13,11 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
- public class Using : AbstractUsing
- {
- }
-
public class NRefactoryASTConvertVisitor : RefParser.AbstractASTVisitor
{
ICompilationUnit cu;
Stack currentNamespace = new Stack();
- Stack currentClass = new Stack();
+ Stack currentClass = new Stack();
public ICompilationUnit Cu {
get {
@@ -31,34 +27,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public NRefactoryASTConvertVisitor(IProjectContent projectContent)
{
- cu = new CompilationUnit(projectContent);
+ cu = new DefaultCompilationUnit(projectContent);
}
- Class GetCurrentClass()
+ DefaultClass GetCurrentClass()
{
return currentClass.Count == 0 ? null : currentClass.Peek();
}
-
- // TODO: kill abstract compilation unit, replace with implementation. Maybe the whole Abstract layer ?
- public class CompilationUnit : AbstractCompilationUnit
- {
- public CompilationUnit(IProjectContent projectContent) : base(projectContent)
- {
- }
-
- public override List MiscComments {
- get {
- return null;
- }
- }
- public override List DokuComments {
- get {
- return null;
- }
- }
- }
-
public override object Visit(AST.CompilationUnit compilationUnit, object data)
{
//TODO: usings, Comments
@@ -71,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.UsingDeclaration usingDeclaration, object data)
{
- Using us = new Using();
+ DefaultUsing us = new DefaultUsing(cu.ProjectContent, GetRegion(usingDeclaration.StartLocation, usingDeclaration.EndLocation));
foreach (AST.Using u in usingDeclaration.Usings) {
u.AcceptVisitor(this, us);
}
@@ -81,8 +57,8 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.Using u, object data)
{
- Debug.Assert(data is Using);
- Using us = (Using)data;
+ Debug.Assert(data is DefaultUsing);
+ DefaultUsing us = (DefaultUsing)data;
if (u.IsAlias) {
us.Aliases[u.Alias] = u.Name;
} else {
@@ -98,7 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
foreach (AST.AttributeSection section in attributes) {
List resultAttributes = new List();
foreach (AST.Attribute attribute in section.Attributes) {
- IAttribute a = new ASTAttribute(attribute.Name, new ArrayList(attribute.PositionalArguments), new SortedList());
+ IAttribute a = new DefaultAttribute(attribute.Name, new ArrayList(attribute.PositionalArguments), new SortedList());
foreach (AST.NamedArgumentExpression n in attribute.NamedArguments) {
a.NamedArguments[n.Name] = n.Expression;
}
@@ -139,7 +115,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
}
}
- IAttributeSection s = new AttributeSection(target, resultAttributes);
+ IAttributeSection s = new DefaultAttributeSection(target, resultAttributes);
result.Add(s);
}
return result;
@@ -188,11 +164,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.TypeDeclaration typeDeclaration, object data)
{
DefaultRegion region = GetRegion(typeDeclaration.StartLocation, typeDeclaration.EndLocation);
- Class c = new Class(cu, TranslateClassType(typeDeclaration.Type), typeDeclaration.Modifier, region, GetCurrentClass());
+ DefaultClass c = new DefaultClass(cu, TranslateClassType(typeDeclaration.Type), (ModifierEnum)typeDeclaration.Modifier, region, GetCurrentClass());
c.Attributes.AddRange(VisitAttributes(typeDeclaration.Attributes));
if (currentClass.Count > 0) {
- Class cur = GetCurrentClass();
+ DefaultClass cur = GetCurrentClass();
cur.InnerClasses.Add(c);
c.FullyQualifiedName = cur.FullyQualifiedName + '.' + typeDeclaration.Name;
} else {
@@ -211,18 +187,17 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
currentClass.Push(c);
object ret = typeDeclaration.AcceptChildren(this, data);
currentClass.Pop();
- c.UpdateModifier();
return ret;
}
public override object Visit(AST.DelegateDeclaration delegateDeclaration, object data)
{
DefaultRegion region = GetRegion(delegateDeclaration.StartLocation, delegateDeclaration.EndLocation);
- Class c = new Class(cu, ClassType.Delegate, delegateDeclaration.Modifier, region, GetCurrentClass());
+ DefaultClass c = new DefaultClass(cu, ClassType.Delegate, (ModifierEnum)delegateDeclaration.Modifier, region, GetCurrentClass());
c.Attributes.AddRange(VisitAttributes(delegateDeclaration.Attributes));
c.BaseTypes.Add("System.Delegate");
if (currentClass.Count > 0) {
- Class cur = GetCurrentClass();
+ DefaultClass cur = GetCurrentClass();
cur.InnerClasses.Add(c);
c.FullyQualifiedName = cur.FullyQualifiedName + '.' + delegateDeclaration.Name;
} else {
@@ -243,7 +218,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : new Point(-1, -1));
ReturnType type = new ReturnType(methodDeclaration.TypeReference);
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
Method method = new Method(methodDeclaration.Name, type, methodDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
method.Attributes.AddRange(VisitAttributes(methodDeclaration.Attributes));
@@ -264,7 +239,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
DefaultRegion region = GetRegion(constructorDeclaration.StartLocation, constructorDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body != null ? constructorDeclaration.Body.EndLocation : new Point(-1, -1));
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
Constructor constructor = new Constructor(constructorDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
constructor.Attributes.AddRange(VisitAttributes(constructorDeclaration.Attributes));
@@ -286,9 +261,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(destructorDeclaration.StartLocation, destructorDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(destructorDeclaration.EndLocation, destructorDeclaration.Body != null ? destructorDeclaration.Body.EndLocation : new Point(-1, -1));
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
- Destructor destructor = new Destructor(c.Name, destructorDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
+ Destructor destructor = new Destructor(region, bodyRegion, c);
destructor.Attributes.AddRange(VisitAttributes(destructorDeclaration.Attributes));
c.Methods.Add(destructor);
return null;
@@ -298,7 +273,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.FieldDeclaration fieldDeclaration, object data)
{
DefaultRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation);
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
if (currentClass.Count > 0) {
for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) {
AST.VariableDeclaration field = (AST.VariableDeclaration)fieldDeclaration.Fields[i];
@@ -311,7 +286,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
Field f = new Field(retType, field.Name, fieldDeclaration.Modifier, region, c);
f.Attributes.AddRange(VisitAttributes(fieldDeclaration.Attributes));
if (c.ClassType == ClassType.Enum) {
- f.SetModifiers(ModifierEnum.Const | ModifierEnum.SpecialName);
+ f.Modifiers = ModifierEnum.Const | ModifierEnum.Public;
}
c.Fields.Add(f);
@@ -326,7 +301,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion bodyRegion = GetRegion(propertyDeclaration.BodyStart, propertyDeclaration.BodyEnd);
ReturnType type = new ReturnType(propertyDeclaration.TypeReference);
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
Property property = new Property(propertyDeclaration.Name, type, propertyDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
property.Attributes.AddRange(VisitAttributes(propertyDeclaration.Attributes));
@@ -339,17 +314,17 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd);
ReturnType type = new ReturnType(eventDeclaration.TypeReference);
- Class c = GetCurrentClass();
- Event e = null;
+ DefaultClass c = GetCurrentClass();
+ DefaultEvent e = null;
if (eventDeclaration.VariableDeclarators != null) {
foreach (ICSharpCode.NRefactory.Parser.AST.VariableDeclaration varDecl in eventDeclaration.VariableDeclarators) {
- e = new Event(varDecl.Name, type, eventDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
+ e = new DefaultEvent(varDecl.Name, type, (ModifierEnum)eventDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
e.Attributes.AddRange(VisitAttributes(eventDeclaration.Attributes));
c.Events.Add(e);
}
} else {
- e = new Event(eventDeclaration.Name, type, eventDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
+ e = new DefaultEvent(eventDeclaration.Name, type, (ModifierEnum)eventDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
e.Attributes.AddRange(VisitAttributes(eventDeclaration.Attributes));
c.Events.Add(e);
}
@@ -370,7 +345,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
parameters.Add(p);
}
}
- Class c = GetCurrentClass();
+ DefaultClass c = GetCurrentClass();
c.Indexer.Add(i);
return null;
}
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
index cf7b5c5728..36b376d514 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
@@ -255,12 +255,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
private class LocalVariableField : AbstractField
{
- public LocalVariableField(IReturnType type, string name, IRegion region, IClass declaringType) : base(declaringType)
+ public LocalVariableField(IReturnType type, string name, IRegion region, IClass declaringType) : base(declaringType, name)
{
- this.returnType = type;
- this.FullyQualifiedName = name;
- this.region = region;
- this.modifiers = ModifierEnum.Private;
+ this.ReturnType = type;
+ this.Region = region;
+ this.Modifiers = ModifierEnum.Private;
}
}
#endregion
@@ -402,11 +401,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
///
public IClass SearchType(string name, IClass curType)
{
- IClass c = SearchLocalType(name);
- if (c != null)
- return c;
- else
- return projectContent.SearchType(name, curType, caretLine, caretColumn);
+ return projectContent.SearchType(name, curType, caretLine, caretColumn);
}
///
@@ -414,25 +409,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
///
public IClass SearchType(string name, IClass curType, ICompilationUnit unit)
{
- IClass c = SearchLocalType(name);
- if (c != null)
- return c;
- else
- return projectContent.SearchType(name, curType, unit, caretLine, caretColumn);
- }
-
- IClass SearchLocalType(string name)
- {
- if (cu == null) return null;
- foreach (IClass c in cu.Classes) {
- //foreach (IClass innerClass in c.InnerClasses) {
- // if (IsSameName(innerClass.FullyQualifiedName, name))
- // return innerClass;
- //}
- if (IsSameName(c.FullyQualifiedName, name))
- return c;
- }
- return null;
+ return projectContent.SearchType(name, curType, unit, caretLine, caretColumn);
}
#region Helper for TypeVisitor
diff --git a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs
index 3ceb542243..a4de90233e 100644
--- a/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs
+++ b/src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs
@@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{
public class Property : AbstractProperty
{
- public void AddModifier(ModifierEnum m)
+ public Property(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, name)
{
- modifiers = modifiers | m;
- }
-
- public Property(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
- {
- this.FullyQualifiedName = declaringType.FullyQualifiedName + "." + name;
- returnType = type;
- this.region = region;
+ this.ReturnType = type;
+ this.Region = region;
this.bodyRegion = bodyRegion;
- modifiers = (ModifierEnum)m;
- if (modifiers == ModifierEnum.None) {
- modifiers = ModifierEnum.Private;
+ Modifiers = (ModifierEnum)m;
+ if (Modifiers == ModifierEnum.None) {
+ Modifiers = ModifierEnum.Private;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs
index 1ceb5459bd..19589684cf 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs
@@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public class ReflectionClass : AbstractClass
+ public class ReflectionClass : DefaultClass
{
Type type;
@@ -137,25 +137,25 @@ namespace ICSharpCode.SharpDevelop.Dom
public ReflectionClass(ICompilationUnit compilationUnit, Type type, IClass declaringType) : base(compilationUnit, declaringType)
{
this.type = type;
- FullyQualifiedName = type.FullName.Replace("+", ".");
+ FullyQualifiedName = type.FullName.Replace('+', '.');
// set classtype
if (IsDelegate(type)) {
- classType = ClassType.Delegate;
+ this.ClassType = ClassType.Delegate;
MethodInfo invoke = type.GetMethod("Invoke");
ReflectionMethod newMethod = new ReflectionMethod(invoke, this);
Methods.Add(newMethod);
} else if (type.IsInterface) {
- classType = ClassType.Interface;
+ this.ClassType = ClassType.Interface;
} else if (type.IsEnum) {
- classType = ClassType.Enum;
+ this.ClassType = ClassType.Enum;
} else if (type.IsValueType) {
- classType = ClassType.Struct;
+ this.ClassType = ClassType.Struct;
} else {
- classType = ClassType.Class;
+ this.ClassType = ClassType.Class;
}
- modifiers = ModifierEnum.None;
+ ModifierEnum modifiers = ModifierEnum.None;
if (type.IsNestedAssembly) {
modifiers |= ModifierEnum.Internal;
@@ -181,6 +181,7 @@ namespace ICSharpCode.SharpDevelop.Dom
modifiers |= ModifierEnum.Protected;
modifiers |= ModifierEnum.Internal;
}
+ this.Modifiers = modifiers;
// set base classes
if (type.BaseType != null) { // it's null for System.Object ONLY !!!
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs
index e6cad1010a..fa2cff5da5 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs
@@ -12,7 +12,7 @@ using System.Xml;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public class ReflectionEvent : AbstractEvent
+ public class ReflectionEvent : DefaultEvent
{
EventInfo eventInfo;
@@ -24,10 +24,9 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public ReflectionEvent(EventInfo eventInfo, IClass declaringType) : base(declaringType)
+ public ReflectionEvent(EventInfo eventInfo, IClass declaringType) : base(declaringType, eventInfo.Name)
{
this.eventInfo = eventInfo;
- FullyQualifiedName = String.Concat(eventInfo.DeclaringType.FullName, ".", eventInfo.Name);
// get modifiers
MethodInfo methodBase = null;
@@ -41,6 +40,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {}
}
+ ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) {
if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static;
@@ -67,7 +67,7 @@ namespace ICSharpCode.SharpDevelop.Dom
// assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
-
+ this.Modifiers = modifiers;
}
}
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionField.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionField.cs
index c46cfa0329..bbea984349 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionField.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionField.cs
@@ -24,12 +24,11 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public ReflectionField(FieldInfo fieldInfo, IClass declaringType) : base(declaringType)
+ public ReflectionField(FieldInfo fieldInfo, IClass declaringType) : base(declaringType, fieldInfo.Name)
{
this.fieldInfo = fieldInfo;
- System.Diagnostics.Debug.Assert(fieldInfo != null);
- FullyQualifiedName = String.Concat(fieldInfo.DeclaringType.FullName, ".", fieldInfo.Name);
+ ModifierEnum modifiers = ModifierEnum.None;
if (fieldInfo.IsInitOnly) {
modifiers |= ModifierEnum.Readonly;
}
@@ -58,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (fieldInfo.IsLiteral) {
modifiers |= ModifierEnum.Const;
}
+ this.Modifiers = modifiers;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs
index c0fbbb4b83..1cc8e930d4 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs
@@ -55,8 +55,6 @@ namespace ICSharpCode.SharpDevelop.Dom
public ReflectionIndexer(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType)
{
this.propertyInfo = propertyInfo;
- // indexers does have the same name as the object that declare the indexers
- FullyQualifiedName = propertyInfo.DeclaringType.FullName;
// show the abstract layer that we have getter & setters
if (propertyInfo.CanRead) {
@@ -82,6 +80,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {}
}
+ ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) {
if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static;
@@ -106,7 +105,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
-
+ this.Modifiers = modifiers;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs
index f800d82093..ba276494de 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs
@@ -71,17 +71,12 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public ReflectionMethod(MethodBase methodBase, IClass declaringType) : base(declaringType)
+ public ReflectionMethod(MethodBase methodBase, IClass declaringType)
+ : base(declaringType, methodBase is ConstructorInfo ? "#ctor" : methodBase.Name)
{
this.methodBase = methodBase;
- string name = methodBase.Name;
- if (methodBase is ConstructorInfo) {
- name = "#ctor";
- }
- FullyQualifiedName = methodBase.DeclaringType.FullName + "." + name;
-
- modifiers = ModifierEnum.None;
+ ModifierEnum modifiers = ModifierEnum.None;
if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static;
}
@@ -107,6 +102,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract;
}
+ this.Modifiers = modifiers;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs
index b77f468045..7f13c71ec8 100644
--- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs
+++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs
@@ -23,10 +23,9 @@ namespace ICSharpCode.SharpDevelop.Dom
set {
}
}
- public ReflectionProperty(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType)
+ public ReflectionProperty(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType, propertyInfo.Name)
{
this.propertyInfo = propertyInfo;
- FullyQualifiedName = String.Concat(propertyInfo.DeclaringType.FullName, ".", propertyInfo.Name);
// show the abstract layer that we have getter & setters
if (propertyInfo.CanRead) {
@@ -52,6 +51,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {}
}
+ ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) {
if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static;
@@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
-
+ this.Modifiers = modifiers;
}
}
}
diff --git a/src/Main/Base/Project/Src/Dom/Tag.cs b/src/Main/Base/Project/Src/Dom/Tag.cs
index 45ea3832a5..cdaeeb8cff 100644
--- a/src/Main/Base/Project/Src/Dom/Tag.cs
+++ b/src/Main/Base/Project/Src/Dom/Tag.cs
@@ -9,7 +9,7 @@ using System;
namespace ICSharpCode.SharpDevelop.Dom
{
[Serializable]
- public class Tag : Comment
+ public class Tag : MarshalByRefObject //Comment
{
string key;
@@ -19,9 +19,31 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
- public Tag(string key, IRegion region) : base(region)
+ string commentString;
+ IRegion region;
+
+ public string CommentString {
+ get {
+ return commentString;
+ }
+ set {
+ commentString = value;
+ }
+ }
+
+ public IRegion Region {
+ get {
+ return region;
+ }
+ set {
+ region = value;
+ }
+ }
+
+ public Tag(string key, IRegion region)
{
this.key = key;
+ this.region = region;
}
}
}
diff --git a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
index a78d55b28e..eac0806358 100644
--- a/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
+++ b/src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
@@ -168,6 +168,7 @@ namespace ICSharpCode.SharpDevelop.Gui
void ClearText()
{
textEditorControl.Text = "";
+ textEditorControl.Refresh();
}
void CategoryTextSet(object sender, TextEventArgs e)
@@ -205,6 +206,7 @@ namespace ICSharpCode.SharpDevelop.Gui
text = String.Empty;
}
textEditorControl.Text = text;
+ textEditorControl.Refresh();
// textEditorControl.Select(text.Length , 0);
// textEditorControl.Select();
// textEditorControl.ScrollToCaret();
diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
index f8671749af..8b565332f6 100644
--- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
+++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
@@ -165,7 +165,7 @@ namespace ICSharpCode.SharpDevelop.Gui
LoadDefaultLayoutConfiguration();
}
} catch {
- LoadDefaultLayoutConfiguration();
+ // ignore errors loading configuration
}
ActivateVisiblePads();
}
diff --git a/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs
index 98532729c5..bfc4ff2c7d 100644
--- a/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs
+++ b/src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs
@@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.Project
if (info.Length < 4) {
try {
- Assembly refAssembly = Assembly.Load(referenceName);
+ Assembly refAssembly = ProjectContentRegistry.LoadGACAssembly(referenceName, true);
// if it failed, then return just the short name
if (refAssembly == null) {
diff --git a/src/Main/Base/Project/Src/Project/MSBuildProject.cs b/src/Main/Base/Project/Src/Project/MSBuildProject.cs
index e1e61f247a..68ddf141a9 100644
--- a/src/Main/Base/Project/Src/Project/MSBuildProject.cs
+++ b/src/Main/Base/Project/Src/Project/MSBuildProject.cs
@@ -26,7 +26,7 @@ namespace ICSharpCode.SharpDevelop.Project
configurations[""] = new PropertyGroup();
IdGuid = "{" + Guid.NewGuid().ToString().ToUpper() + "}";
BaseConfiguration["OutputType"] = "Exe";
- BaseConfiguration["RootNamespace"] = "RootNameSpace";
+ BaseConfiguration["RootNamespace"] = information.ProjectName;
BaseConfiguration["AssemblyName"] = information.ProjectName;
BaseConfiguration["Configuration"] = "Debug";
BaseConfiguration.SetIsGuarded("Configuration", true);
@@ -35,11 +35,13 @@ namespace ICSharpCode.SharpDevelop.Project
configurations["Debug|AnyCPU"] = new PropertyGroup();
configurations["Debug|AnyCPU"]["OutputPath"] = @"bin\Debug\";
- configurations["Debug|AnyCPU"]["Optimize"] = @"false";
+ configurations["Debug|AnyCPU"]["Optimize"] = "false";
+ configurations["Debug|AnyCPU"]["DefineConstants"] = "DEBUG;TRACE";
configurations["Release|AnyCPU"] = new PropertyGroup();
configurations["Release|AnyCPU"]["OutputPath"] = @"bin\Release\";
- configurations["Release|AnyCPU"]["Optimize"] = @"true";
+ configurations["Release|AnyCPU"]["Optimize"] = "true";
+ configurations["Release|AnyCPU"]["DefineConstants"] = "TRACE";
fileName = information.OutputProjectFileName;
}
@@ -63,7 +65,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
this.fileName = projectFileName;
using (XmlTextReader reader = new XmlTextReader(projectFileName)) {
- while (reader.Read()){
+ while (reader.Read()) {
if (reader.IsStartElement()) {
switch (reader.LocalName) {
case "PropertyGroup":
diff --git a/src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs b/src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
index 40b3840bc0..827ee5a40d 100644
--- a/src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
+++ b/src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
@@ -72,7 +72,7 @@ namespace ICSharpCode.Core
{
CaseSensitiveProjectContent newProjectContent = new CaseSensitiveProjectContent();
- ICompilationUnit assemblyCompilationUnit = new ICSharpCode.SharpDevelop.Dom.NRefactoryResolver.NRefactoryASTConvertVisitor.CompilationUnit(newProjectContent);
+ ICompilationUnit assemblyCompilationUnit = new DefaultCompilationUnit(newProjectContent);
foreach (Type type in assembly.GetTypes()) {
if (!type.FullName.StartsWith("<") && type.IsPublic) {
@@ -339,16 +339,18 @@ namespace ICSharpCode.Core
public IClass SearchType(string name, IClass curType, ICompilationUnit unit, int caretLine, int caretColumn)
{
// Console.WriteLine("SearchType({0})", name);
- if (name == null || name == String.Empty) {
+ if (name == null || name.Length == 0) {
return null;
}
- IClass c = GetClass(name);
+ // Try if name is already the full type name
+ IClass c = GetClass(name);
if (c != null) {
return c;
}
if (unit != null) {
+ // Combine name with usings
foreach (IUsing u in unit.Usings) {
- if (u != null && (u.Region == null || u.Region.IsInside(caretLine, caretColumn))) {
+ if (u != null) {
c = u.SearchType(name);
if (c != null) {
return c;
@@ -359,45 +361,22 @@ namespace ICSharpCode.Core
if (curType == null) {
return null;
}
+ // Try parent namespaces of the current class
string fullname = curType.FullyQualifiedName;
string[] namespaces = fullname.Split('.');
StringBuilder curnamespace = new StringBuilder();
for (int i = 0; i < namespaces.Length; ++i) {
curnamespace.Append(namespaces[i]);
curnamespace.Append('.');
- StringBuilder nms=new StringBuilder(curnamespace.ToString());
- nms.Append(name);
- c = GetClass(nms.ToString());
+
+ curnamespace.Append(name);
+ c = GetClass(curnamespace.ToString());
if (c != null) {
return c;
}
+ // remove class name again to try next namespace
+ curnamespace.Length -= name.Length;
}
-
- //// Alex: try to find in namespaces referenced excluding system ones which were checked already
- string[] innamespaces = GetNamespaceList("");
- foreach (string ns in innamespaces) {
-// if (Array.IndexOf(ParserService.assemblyList,ns)>=0) continue;
- ArrayList objs=GetNamespaceContents(ns);
- if (objs==null) continue;
- foreach (object o in objs) {
- if (o is IClass) {
- IClass oc=(IClass)o;
- // || oc.Name==name
- if (oc.FullyQualifiedName == name) {
- //Debug.WriteLine(((IClass)o).Name);
- /// now we can set completion data
- objs.Clear();
- objs = null;
- return oc;
- }
- }
- }
- if (objs == null) {
- break;
- }
- }
- innamespaces=null;
-//// Alex: end of mod
return null;
}
diff --git a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
index 880b014896..5cbf68abe9 100644
--- a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
+++ b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
@@ -57,7 +57,7 @@ namespace ICSharpCode.Core
}
} catch (Exception) {
try {
- assembly = Assembly.ReflectionOnlyLoad(item.Include);
+ assembly = LoadGACAssembly(item.Include, true);
if (assembly != null) {
contents[item.Include] = CaseSensitiveProjectContent.Create(assembly);
return contents[item.Include];
@@ -69,5 +69,12 @@ namespace ICSharpCode.Core
return null;
}
+
+ public static Assembly LoadGACAssembly(string partialName, bool reflectionOnly)
+ {
+ #pragma warning disable 618
+ return Assembly.LoadWithPartialName(partialName);
+ #pragma warning restore 618
+ }
}
}
diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
index 9278b4fdd9..7c80228539 100644
--- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
@@ -128,37 +128,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
caretColumn,
fileName,
document.TextContent);
- // if expression references object in another namespace (using), no results are delivered
- if (results != null) {
- AddResolveResults(results);
- } else {
- string[] namespaces = ParserService.CurrentProjectContent.GetNamespaceList("");
-
- foreach(string ns in namespaces) {
- ArrayList objs=ParserService.CurrentProjectContent.GetNamespaceContents(ns);
- if (objs==null) continue;
-
- foreach(object o in objs) {
- if (o is IClass) {
- IClass oc = (IClass)o;
- if(oc.Name == expression || oc.FullyQualifiedName==expression) {
- Debug.WriteLine(((IClass)o).Name);
- // now we can set completion data
- AddResolveResults(oc.GetAccessibleMembers(oc,true));
- // clear objects to indicate end of loop for namespaces
- objs.Clear();
- objs=null;
- break;
- }
- }
- }
- if (objs == null) {
- break;
- }
- }
- }
- results = null;
- GC.Collect(0);
+ AddResolveResults(results);
}
return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs
index 40b436cd02..20e5d05296 100644
--- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs
@@ -88,12 +88,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
if (cu.DokuComments != null) {
- foreach (Comment c in cu.DokuComments) {
+ foreach (IComment c in cu.DokuComments) {
foldMarkers.Add(new FoldMarker(document, c.Region.BeginLine - 1, c.Region.BeginColumn - 1,
c.Region.EndLine - 1, c.Region.EndColumn - 1));
}
}
-
return foldMarkers;
}
}
diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs
index 737376a807..3b01741d5b 100644
--- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs
@@ -423,8 +423,12 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
void ParseInformationUpdatedInternal(ParseInformation parseInfo)
{
- textAreaControl.Document.FoldingManager.UpdateFoldings(TitleName, parseInfo);
- textAreaControl.ActiveTextAreaControl.TextArea.Refresh(textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin);
+ try {
+ textAreaControl.Document.FoldingManager.UpdateFoldings(TitleName, parseInfo);
+ textAreaControl.ActiveTextAreaControl.TextArea.Refresh(textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin);
+ } catch (Exception ex) {
+ MessageService.ShowError(ex);
+ }
}