Browse Source

Worked on SharpDevelop.Dom (merging Implementations/Abstact* and NRefactoryResolver/*) + some bug fixes when creating new projects.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@118 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
a5d79f2499
  1. 4
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
  2. 4
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
  3. 15
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
  4. 14
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  5. 8
      src/Main/Base/Project/Src/Dom/IClass.cs
  6. 3
      src/Main/Base/Project/Src/Dom/IUsing.cs
  7. 44
      src/Main/Base/Project/Src/Dom/Implementations/AbstractComment.cs
  8. 48
      src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs
  9. 16
      src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs
  10. 2
      src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs
  11. 2
      src/Main/Base/Project/Src/Dom/Implementations/AbstractIndexer.cs
  12. 9
      src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs
  13. 6
      src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs
  14. 10
      src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs
  15. 2
      src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs
  16. 143
      src/Main/Base/Project/Src/Dom/Implementations/AbstractUsing.cs
  17. 60
      src/Main/Base/Project/Src/Dom/Implementations/DefaultAttribute.cs
  18. 47
      src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs
  19. 52
      src/Main/Base/Project/Src/Dom/Implementations/DefaultComment.cs
  20. 46
      src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs
  21. 113
      src/Main/Base/Project/Src/Dom/Implementations/DefaultUsing.cs
  22. 25
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/AttributeSection.cs
  23. 58
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Class.cs
  24. 16
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs
  25. 11
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs
  26. 22
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs
  27. 15
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs
  28. 18
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs
  29. 73
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs
  30. 35
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
  31. 18
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs
  32. 17
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs
  33. 8
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs
  34. 6
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionField.cs
  35. 5
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs
  36. 12
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs
  37. 6
      src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs
  38. 26
      src/Main/Base/Project/Src/Dom/Tag.cs
  39. 2
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  40. 2
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
  41. 2
      src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs
  42. 10
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  43. 45
      src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
  44. 9
      src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
  45. 32
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
  46. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs
  47. 8
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs

4
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs

@ -85,7 +85,9 @@ namespace CSharpBinding
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions) public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
{ {
CSharpProject p = new CSharpProject(info); CSharpProject p = new CSharpProject(info);
p.ImportOptions(projectOptions.Attributes); if (projectOptions != null) {
p.ImportOptions(projectOptions.Attributes);
}
return p; return p;
} }
} }

4
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs

@ -85,7 +85,9 @@ namespace VBNetBinding
public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions) public IProject CreateProject(ProjectCreateInformation info, XmlElement projectOptions)
{ {
VBNetProject p = new VBNetProject(info); VBNetProject p = new VBNetProject(info);
p.ImportOptions(projectOptions.Attributes); if (projectOptions != null) {
p.ImportOptions(projectOptions.Attributes);
}
return p; return p;
} }
} }

15
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs

@ -118,8 +118,14 @@ namespace ICSharpCode.FormDesigner
this.viewContent = viewContent; this.viewContent = viewContent;
this.textAreaControlProvider = viewContent as ITextEditorControlProvider; this.textAreaControlProvider = viewContent as ITextEditorControlProvider;
Reload(); }
bool isInitialized = false;
void Initialize()
{
if (isInitialized) return;
isInitialized = true;
DefaultServiceContainer serviceContainer = new DefaultServiceContainer(); DefaultServiceContainer serviceContainer = new DefaultServiceContainer();
serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService()); serviceContainer.AddService(typeof(System.Windows.Forms.Design.IUIService), new UIService());
serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService); serviceContainer.AddService(typeof(System.Drawing.Design.IToolboxService), ToolboxProvider.ToolboxService);
@ -168,6 +174,7 @@ namespace ICSharpCode.FormDesigner
public void Reload() public void Reload()
{ {
Initialize();
bool dirty = viewContent.IsDirty; bool dirty = viewContent.IsDirty;
// TODO: // TODO:
// loader.TextContent = Document.TextContent; // loader.TextContent = Document.TextContent;
@ -179,7 +186,7 @@ namespace ICSharpCode.FormDesigner
p.Controls.Add(designer); p.Controls.Add(designer);
} }
} catch (Exception e) { } catch (Exception e) {
Console.WriteLine(e); MessageService.ShowError(e);
} }
} }
@ -224,6 +231,7 @@ namespace ICSharpCode.FormDesigner
public override void Selected() public override void Selected()
{ {
Reload();
IsFormDesignerVisible = true; IsFormDesignerVisible = true;
foreach(AxSideTab tab in ToolboxProvider.SideTabs) { foreach(AxSideTab tab in ToolboxProvider.SideTabs) {
if (!SharpDevelopSideBar.SideBar.Tabs.Contains(tab)) { if (!SharpDevelopSideBar.SideBar.Tabs.Contains(tab)) {
@ -233,7 +241,6 @@ namespace ICSharpCode.FormDesigner
SharpDevelopSideBar.SideBar.Refresh(); SharpDevelopSideBar.SideBar.Refresh();
propertyContainer.Host = Host; propertyContainer.Host = Host;
UpdateSelectableObjects(); UpdateSelectableObjects();
Reload();
} }
public override void Deselected() public override void Deselected()

14
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -84,18 +84,18 @@
<Compile Include="Src\Dom\IMethod.cs" /> <Compile Include="Src\Dom\IMethod.cs" />
<Compile Include="Src\Dom\ClassType.cs" /> <Compile Include="Src\Dom\ClassType.cs" />
<Compile Include="Src\Dom\Implementations\DefaultRegion.cs" /> <Compile Include="Src\Dom\Implementations\DefaultRegion.cs" />
<Compile Include="Src\Dom\Implementations\AbstractClass.cs" /> <Compile Include="Src\Dom\Implementations\DefaultClass.cs" />
<Compile Include="Src\Dom\Implementations\AbstractProperty.cs" /> <Compile Include="Src\Dom\Implementations\AbstractProperty.cs" />
<Compile Include="Src\Dom\Implementations\AbstractField.cs" /> <Compile Include="Src\Dom\Implementations\AbstractField.cs" />
<Compile Include="Src\Dom\Implementations\AbstractEvent.cs" /> <Compile Include="Src\Dom\Implementations\AbstractEvent.cs" />
<Compile Include="Src\Dom\Implementations\AbstractComment.cs" /> <Compile Include="Src\Dom\Implementations\DefaultComment.cs" />
<Compile Include="Src\Dom\Implementations\AbstractMethod.cs" /> <Compile Include="Src\Dom\Implementations\AbstractMethod.cs" />
<Compile Include="Src\Dom\IParameter.cs" /> <Compile Include="Src\Dom\IParameter.cs" />
<Compile Include="Src\Dom\Implementations\AbstractParameter.cs" /> <Compile Include="Src\Dom\Implementations\AbstractParameter.cs" />
<Compile Include="Src\Dom\IAttribute.cs" /> <Compile Include="Src\Dom\IAttribute.cs" />
<Compile Include="Src\Dom\Implementations\AbstractAttribute.cs" /> <Compile Include="Src\Dom\Implementations\DefaultAttribute.cs" />
<Compile Include="Src\Dom\Implementations\AbstractReturnType.cs" /> <Compile Include="Src\Dom\Implementations\AbstractReturnType.cs" />
<Compile Include="Src\Dom\Implementations\AbstractCompilationUnit.cs" /> <Compile Include="Src\Dom\Implementations\DefaultCompilationUnit.cs" />
<Compile Include="Src\Services\ParserService\ParserService.cs" /> <Compile Include="Src\Services\ParserService\ParserService.cs" />
<Compile Include="Src\Services\DisplayBinding\DisplayBindingErbauer.cs" /> <Compile Include="Src\Services\DisplayBinding\DisplayBindingErbauer.cs" />
<Compile Include="Src\Internal\Auswerter\CombineOpenAuswerter.cs" /> <Compile Include="Src\Internal\Auswerter\CombineOpenAuswerter.cs" />
@ -110,7 +110,7 @@
<Compile Include="Src\Dom\ParameterModifier.cs" /> <Compile Include="Src\Dom\ParameterModifier.cs" />
<Compile Include="Src\Dom\Implementations\AbstractDecoration.cs" /> <Compile Include="Src\Dom\Implementations\AbstractDecoration.cs" />
<Compile Include="Src\Dom\Implementations\AbstractIndexer.cs" /> <Compile Include="Src\Dom\Implementations\AbstractIndexer.cs" />
<Compile Include="Src\Dom\Implementations\AbstractUsing.cs" /> <Compile Include="Src\Dom\Implementations\DefaultUsing.cs" />
<Compile Include="Src\Dom\IParser.cs" /> <Compile Include="Src\Dom\IParser.cs" />
<Compile Include="Src\Dom\ReflectionLayer\ReflectionClass.cs" /> <Compile Include="Src\Dom\ReflectionLayer\ReflectionClass.cs" />
<Compile Include="Src\Dom\ReflectionLayer\ReflectionField.cs" /> <Compile Include="Src\Dom\ReflectionLayer\ReflectionField.cs" />
@ -121,7 +121,6 @@
<Compile Include="Src\Dom\ReflectionLayer\ReflectionReturnType.cs" /> <Compile Include="Src\Dom\ReflectionLayer\ReflectionReturnType.cs" />
<Compile Include="Src\Dom\ReflectionLayer\ReflectionIndexer.cs" /> <Compile Include="Src\Dom\ReflectionLayer\ReflectionIndexer.cs" />
<Compile Include="Src\Dom\Tag.cs" /> <Compile Include="Src\Dom\Tag.cs" />
<Compile Include="Src\Dom\Comment.cs" />
<Compile Include="Src\Services\AmbienceService\IAmbience.cs" /> <Compile Include="Src\Services\AmbienceService\IAmbience.cs" />
<Compile Include="Src\Services\AmbienceService\NetAmbience.cs" /> <Compile Include="Src\Services\AmbienceService\NetAmbience.cs" />
<Compile Include="Src\Services\AmbienceService\AmbienceReflectionDecorator.cs" /> <Compile Include="Src\Services\AmbienceService\AmbienceReflectionDecorator.cs" />
@ -361,9 +360,6 @@
<Compile Include="Src\Dom\NRefactoryResolver\TypeVisitor.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\TypeVisitor.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\NRefactoryASTConvertVisitor.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\NRefactoryASTConvertVisitor.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\ReturnType.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\ReturnType.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\Event.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\AttributeSection.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\Class.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\Constructor.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\Constructor.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\Destructor.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\Destructor.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\Field.cs" /> <Compile Include="Src\Dom\NRefactoryResolver\Field.cs" />

8
src/Main/Base/Project/Src/Dom/IClass.cs

@ -46,10 +46,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get; get;
} }
IRegion BodyRegion {
get;
}
List<string> BaseTypes { List<string> BaseTypes {
get; get;
} }
@ -82,10 +78,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get; get;
} }
object DeclaredIn {
get;
}
IClass BaseClass { IClass BaseClass {
get; get;
} }

3
src/Main/Base/Project/Src/Dom/IUsing.cs

@ -6,7 +6,6 @@
// </file> // </file>
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
@ -21,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Dom
get; get;
} }
SortedList Aliases { SortedList<string, string> Aliases {
get; get;
} }

44
src/Main/Base/Project/Src/Dom/Implementations/AbstractComment.cs

@ -1,44 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
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;
}
}
}
}

48
src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs

@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Dom
[Serializable] [Serializable]
public abstract class AbstractDecoration : MarshalByRefObject, IDecoration public abstract class AbstractDecoration : MarshalByRefObject, IDecoration
{ {
protected ModifierEnum modifiers = ModifierEnum.None; ModifierEnum modifiers = ModifierEnum.None;
protected List<IAttributeSection> attributes = null; List<IAttributeSection> attributes = null;
IClass declaringType; IClass declaringType;
object userData = null; object userData = null;
@ -26,7 +26,6 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
} }
public object UserData { public object UserData {
get { get {
return userData; return userData;
@ -36,13 +35,16 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
} }
public virtual ModifierEnum Modifiers { public ModifierEnum Modifiers {
get { get {
return modifiers; return modifiers;
} }
set {
modifiers = value;
}
} }
public virtual List<IAttributeSection> Attributes { public List<IAttributeSection> Attributes {
get { get {
if (attributes == null) { if (attributes == null) {
attributes = new List<IAttributeSection>(); attributes = new List<IAttributeSection>();
@ -50,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return attributes; return attributes;
} }
} }
public abstract string DocumentationTag { public abstract string DocumentationTag {
get; get;
} }
@ -60,13 +62,13 @@ namespace ICSharpCode.SharpDevelop.Dom
return (modifiers & ModifierEnum.Abstract) == ModifierEnum.Abstract; return (modifiers & ModifierEnum.Abstract) == ModifierEnum.Abstract;
} }
} }
public bool IsSealed { public bool IsSealed {
get { get {
return (modifiers & ModifierEnum.Sealed) == ModifierEnum.Sealed; return (modifiers & ModifierEnum.Sealed) == ModifierEnum.Sealed;
} }
} }
public bool IsStatic { public bool IsStatic {
get { get {
return (modifiers & ModifierEnum.Static) == ModifierEnum.Static; return (modifiers & ModifierEnum.Static) == ModifierEnum.Static;
@ -78,79 +80,79 @@ namespace ICSharpCode.SharpDevelop.Dom
return (modifiers & ModifierEnum.Const) == ModifierEnum.Const; return (modifiers & ModifierEnum.Const) == ModifierEnum.Const;
} }
} }
public bool IsVirtual { public bool IsVirtual {
get { get {
return (modifiers & ModifierEnum.Virtual) == ModifierEnum.Virtual; return (modifiers & ModifierEnum.Virtual) == ModifierEnum.Virtual;
} }
} }
public bool IsPublic { public bool IsPublic {
get { get {
return (modifiers & ModifierEnum.Public) == ModifierEnum.Public; return (modifiers & ModifierEnum.Public) == ModifierEnum.Public;
} }
} }
public bool IsProtected { public bool IsProtected {
get { get {
return (modifiers & ModifierEnum.Protected) == ModifierEnum.Protected; return (modifiers & ModifierEnum.Protected) == ModifierEnum.Protected;
} }
} }
public bool IsPrivate { public bool IsPrivate {
get { get {
return (modifiers & ModifierEnum.Private) == ModifierEnum.Private; return (modifiers & ModifierEnum.Private) == ModifierEnum.Private;
} }
} }
public bool IsInternal { public bool IsInternal {
get { get {
return (modifiers & ModifierEnum.Internal) == ModifierEnum.Internal; return (modifiers & ModifierEnum.Internal) == ModifierEnum.Internal;
} }
} }
public bool IsProtectedAndInternal { public bool IsProtectedAndInternal {
get { get {
return (modifiers & (ModifierEnum.Internal | ModifierEnum.Protected)) == (ModifierEnum.Internal | ModifierEnum.Protected); return (modifiers & (ModifierEnum.Internal | ModifierEnum.Protected)) == (ModifierEnum.Internal | ModifierEnum.Protected);
} }
} }
public bool IsProtectedOrInternal { public bool IsProtectedOrInternal {
get { get {
return (modifiers & ModifierEnum.ProtectedOrInternal) == ModifierEnum.ProtectedOrInternal; return (modifiers & ModifierEnum.ProtectedOrInternal) == ModifierEnum.ProtectedOrInternal;
} }
} }
public bool IsLiteral { public bool IsLiteral {
get { get {
return (modifiers & ModifierEnum.Const) == ModifierEnum.Const; return (modifiers & ModifierEnum.Const) == ModifierEnum.Const;
} }
} }
public bool IsReadonly { public bool IsReadonly {
get { get {
return (modifiers & ModifierEnum.Readonly) == ModifierEnum.Readonly; return (modifiers & ModifierEnum.Readonly) == ModifierEnum.Readonly;
} }
} }
public bool IsOverride { public bool IsOverride {
get { get {
return (modifiers & ModifierEnum.Override) == ModifierEnum.Override; return (modifiers & ModifierEnum.Override) == ModifierEnum.Override;
} }
} }
public bool IsFinal { public bool IsFinal {
get { get {
return (modifiers & ModifierEnum.Final) == ModifierEnum.Final; return (modifiers & ModifierEnum.Final) == ModifierEnum.Final;
} }
} }
public bool IsSpecialName { public bool IsSpecialName {
get { get {
return (modifiers & ModifierEnum.SpecialName) == ModifierEnum.SpecialName; return (modifiers & ModifierEnum.SpecialName) == ModifierEnum.SpecialName;
} }
} }
public bool IsNew { public bool IsNew {
get { get {
return (modifiers & ModifierEnum.New) == ModifierEnum.New; 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; int cmp;
@ -217,7 +219,7 @@ namespace ICSharpCode.SharpDevelop.Dom
return DiffUtility.Compare(Attributes, value.Attributes); return DiffUtility.Compare(Attributes, value.Attributes);
} }
int IComparable.CompareTo(object value) int IComparable.CompareTo(object value)
{ {
return CompareTo((IDecoration)value); return CompareTo((IDecoration)value);
} }

16
src/Main/Base/Project/Src/Dom/Implementations/AbstractEvent.cs

@ -10,7 +10,7 @@ using System.Reflection;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public abstract class AbstractEvent : AbstractMember, IEvent public class DefaultEvent : AbstractMember, IEvent
{ {
protected IRegion bodyRegion; protected IRegion bodyRegion;
protected EventAttributes eventAttributes; protected EventAttributes eventAttributes;
@ -29,7 +29,6 @@ namespace ICSharpCode.SharpDevelop.Dom
return bodyRegion; return bodyRegion;
} }
} }
public virtual EventAttributes EventAttributes { public virtual EventAttributes EventAttributes {
get { 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) public virtual int CompareTo(IEvent value)
{ {
int cmp; int cmp;

2
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)
{ {
} }

2
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)
{ {
} }

9
src/Main/Base/Project/Src/Dom/Implementations/AbstractMember.cs

@ -12,13 +12,16 @@ namespace ICSharpCode.SharpDevelop.Dom
[Serializable] [Serializable]
public abstract class AbstractMember : AbstractNamedEntity, IMember public abstract class AbstractMember : AbstractNamedEntity, IMember
{ {
protected IReturnType returnType; IReturnType returnType;
protected IRegion region; IRegion region;
public virtual IRegion Region { public virtual IRegion Region {
get { get {
return region; return region;
} }
set {
region = value;
}
} }
public virtual IReturnType ReturnType { 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)
{ {
} }
} }

6
src/Main/Base/Project/Src/Dom/Implementations/AbstractMethod.cs

@ -40,14 +40,14 @@ namespace ICSharpCode.SharpDevelop.Dom
parameters = value; parameters = value;
} }
} }
public virtual bool IsConstructor { public virtual bool IsConstructor {
get { 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)
{ {
} }

10
src/Main/Base/Project/Src/Dom/Implementations/AbstractNamedEntity.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Dom
public override string DocumentationTag { public override string DocumentationTag {
get { get {
return FullyQualifiedName; return "T:" + FullyQualifiedName;
} }
} }
@ -84,5 +84,13 @@ namespace ICSharpCode.SharpDevelop.Dom
public AbstractNamedEntity(IClass declaringType) : base(declaringType) 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;
}
} }
} }

2
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)
{ {
} }

143
src/Main/Base/Project/Src/Dom/Implementations/AbstractUsing.cs

@ -1,143 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
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<string> usings = new List<string>();
SortedList aliases = new SortedList();
public IRegion Region {
get {
return region;
}
}
public List<string> 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();
}
}
}

60
src/Main/Base/Project/Src/Dom/Implementations/AbstractAttribute.cs → src/Main/Base/Project/Src/Dom/Implementations/DefaultAttribute.cs

@ -11,12 +11,18 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public class AbstractAttributeSection : IAttributeSection public class DefaultAttributeSection : IAttributeSection
{ {
protected AttributeTarget attributeTarget; AttributeTarget attributeTarget;
List<IAttribute> attributes = null; List<IAttribute> attributes = null;
public virtual AttributeTarget AttributeTarget { public DefaultAttributeSection(AttributeTarget attributeTarget, List<IAttribute> attributes)
{
this.attributeTarget = attributeTarget;
this.attributes = attributes;
}
public AttributeTarget AttributeTarget {
get { get {
return attributeTarget; return attributeTarget;
} }
@ -24,17 +30,11 @@ namespace ICSharpCode.SharpDevelop.Dom
attributeTarget = value; attributeTarget = value;
} }
} }
public virtual List<IAttribute> Attributes { public List<IAttribute> Attributes {
get { get {
if (attributes == null) {
attributes = new List<IAttribute>();
}
return attributes; return attributes;
} }
set {
attributes = value;
}
} }
public virtual int CompareTo(IAttributeSection 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; string name;
protected ArrayList positionalArguments = new ArrayList(); ArrayList positionalArguments;
protected SortedList namedArguments = new SortedList(); SortedList namedArguments;
public virtual string Name { 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 { get {
return name; return name;
} }
@ -65,21 +79,15 @@ namespace ICSharpCode.SharpDevelop.Dom
name = value; name = value;
} }
} }
public virtual ArrayList PositionalArguments { // [expression] public ArrayList PositionalArguments { // [expression]
get { get {
return positionalArguments; return positionalArguments;
} }
set {
positionalArguments = value;
}
} }
public virtual SortedList NamedArguments { // string/expression public SortedList NamedArguments { // string/expression
get { get {
return namedArguments; return namedArguments;
} }
set {
namedArguments = value;
}
} }
public virtual int CompareTo(IAttribute value) { public virtual int CompareTo(IAttribute value) {

47
src/Main/Base/Project/Src/Dom/Implementations/AbstractClass.cs → src/Main/Base/Project/Src/Dom/Implementations/DefaultClass.cs

@ -16,12 +16,10 @@ using ICSharpCode.SharpDevelop;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public abstract class AbstractClass : AbstractNamedEntity, IClass, IComparable public class DefaultClass : AbstractNamedEntity, IClass, IComparable
{ {
protected ClassType classType; ClassType classType;
protected IRegion region; IRegion region;
protected IRegion bodyRegion;
protected object declaredIn;
ICompilationUnit compilationUnit; ICompilationUnit compilationUnit;
@ -34,18 +32,24 @@ namespace ICSharpCode.SharpDevelop.Dom
List<IEvent> events = null; List<IEvent> events = null;
List<IIndexer> indexer = null; List<IIndexer> indexer = null;
public override string DocumentationTag { public DefaultClass(ICompilationUnit compilationUnit, string fullyQualifiedName) : base(null)
get { {
return "T:" + this.FullyQualifiedName; 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; 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 { public ICompilationUnit CompilationUnit {
get { get {
@ -60,31 +64,22 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
public virtual ClassType ClassType { public ClassType ClassType {
get { get {
return classType; return classType;
} }
} set {
classType = value;
public virtual IRegion Region {
get {
return region;
}
}
public virtual IRegion BodyRegion {
get {
return bodyRegion;
} }
} }
public object DeclaredIn { public IRegion Region {
get { get {
return declaredIn; return region;
} }
} }
public virtual List<string> BaseTypes { public List<string> BaseTypes {
get { get {
if (baseTypes == null) { if (baseTypes == null) {
baseTypes = new List<string>(); baseTypes = new List<string>();

52
src/Main/Base/Project/Src/Dom/Implementations/DefaultComment.cs

@ -0,0 +1,52 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
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;
}
}
}
}

46
src/Main/Base/Project/Src/Dom/Implementations/AbstractCompilationUnit.cs → src/Main/Base/Project/Src/Dom/Implementations/DefaultCompilationUnit.cs

@ -13,16 +13,17 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public abstract class AbstractCompilationUnit : ICompilationUnit public class DefaultCompilationUnit : ICompilationUnit
{ {
protected List<IUsing> usings = new List<IUsing>(); List<IUsing> usings = new List<IUsing>();
protected List<IClass> classes = new List<IClass>(); List<IClass> classes = new List<IClass>();
protected List<IAttributeSection> attributes = new List<IAttributeSection>(); List<IAttributeSection> attributes = new List<IAttributeSection>();
protected bool errorsDuringCompile = false; List<FoldingRegion> foldingRegions = new List<FoldingRegion>();
protected object tag = null; List<Tag> tagComments = new List<Tag>();
protected List<FoldingRegion> foldingRegions = new List<FoldingRegion>();
protected string fileName = ""; bool errorsDuringCompile = false;
protected List<Tag> tagComments = new List<Tag>(); object tag = null;
string fileName = "";
IProjectContent projectContent; IProjectContent projectContent;
public string FileName { public string FileName {
@ -83,12 +84,16 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
} }
public abstract List<IComment> MiscComments { public virtual List<IComment> MiscComments {
get; get {
return null;
}
} }
public abstract List<IComment> DokuComments { public virtual List<IComment> DokuComments {
get; get {
return null;
}
} }
public virtual List<Tag> TagComments { public virtual List<Tag> TagComments {
@ -97,8 +102,9 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
} }
protected AbstractCompilationUnit(IProjectContent projectContent) public DefaultCompilationUnit(IProjectContent projectContent)
{ {
Debug.Assert(projectContent != null);
this.projectContent = projectContent; this.projectContent = projectContent;
} }
@ -114,12 +120,12 @@ namespace ICSharpCode.SharpDevelop.Dom
/// <remarks> /// <summary>
/// Returns all (nestet) classes in which the carret currently is exept /// Returns all (nested) classes in which the caret currently is exept
/// the innermost class, returns an empty collection if the carret is in /// the innermost class, returns an empty collection if the caret is in
/// no class or only in the innermost class. /// 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.
/// </remarks> /// </summary>
public List<IClass> GetOuterClasses(int caretLine, int caretColumn) public List<IClass> GetOuterClasses(int caretLine, int caretColumn)
{ {
List<IClass> classes = new List<IClass>(); List<IClass> classes = new List<IClass>();
@ -157,7 +163,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} }
public override string ToString() { public override string ToString() {
return String.Format("[AbstractCompilationUnit: classes = {0}, fileName = {1}]", return String.Format("[CompilationUnit: classes = {0}, fileName = {1}]",
classes.Count, classes.Count,
fileName); fileName);
} }

113
src/Main/Base/Project/Src/Dom/Implementations/DefaultUsing.cs

@ -0,0 +1,113 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
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<string> usings = new List<string>();
SortedList<string, string> aliases = new SortedList<string, string>();
public IRegion Region {
get {
return region;
}
}
public List<string> Usings {
get {
return usings;
}
}
public SortedList<string, string> Aliases {
get {
return aliases;
}
}
public string SearchNamespace(string partitialNamespaceName)
{
foreach (KeyValuePair<string, string> 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<string, string> 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<string, string> 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();
}
}
}

25
src/Main/Base/Project/Src/Dom/NRefactoryResolver/AttributeSection.cs

@ -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<IAttribute> 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;
}
}
}

58
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Class.cs

@ -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);
}
}
}
}

16
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Constructor.cs

@ -7,19 +7,13 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Constructor : AbstractMethod 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; this.Region = region;
}
public Constructor(Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
{
FullyQualifiedName = "#ctor";
this.region = region;
this.bodyRegion = bodyRegion; this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m; Modifiers = (ModifierEnum)m;
if (modifiers == ModifierEnum.None) { if (Modifiers == ModifierEnum.None) {
modifiers = ModifierEnum.Private; Modifiers = ModifierEnum.Private;
} }
} }
} }

11
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Destructor.cs

@ -7,17 +7,10 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Destructor : AbstractMethod public class Destructor : AbstractMethod
{ {
public void AddModifier(ModifierEnum m) public Destructor(IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType, "~" + declaringType.Name)
{ {
modifiers = modifiers | m; this.Region = region;
}
public Destructor(string className, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
{
FullyQualifiedName = "~" + className;
this.region = region;
this.bodyRegion = bodyRegion; this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m;
} }
} }
} }

22
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Field.cs

@ -7,24 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Field : AbstractField 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; this.ReturnType = type;
} this.Region = region;
Modifiers = (ModifierEnum)m;
public Field(ReturnType type, string name, Modifier m, IRegion region, IClass declaringType) : base(declaringType) if (Modifiers == ModifierEnum.None) {
{ Modifiers = ModifierEnum.Private;
this.returnType = type;
this.FullyQualifiedName = declaringType.FullyQualifiedName + "." + name;
this.region = region;
modifiers = (ModifierEnum)m;
if (modifiers == ModifierEnum.None) {
modifiers = ModifierEnum.Private;
} }
} }
public void SetModifiers(ModifierEnum m)
{
modifiers = m;
}
} }
} }

15
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Indexer.cs

@ -8,20 +8,15 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Indexer : AbstractIndexer public class Indexer : AbstractIndexer
{ {
public void AddModifier(ModifierEnum m)
{
modifiers = modifiers | m;
}
public Indexer(ReturnType type, List<IParameter> parameters, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType) public Indexer(ReturnType type, List<IParameter> parameters, Modifier m, IRegion region, IRegion bodyRegion, IClass declaringType) : base(declaringType)
{ {
returnType = type; this.ReturnType = type;
this.Parameters = parameters; this.Parameters = parameters;
this.region = region; this.Region = region;
this.bodyRegion = bodyRegion; this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m; Modifiers = (ModifierEnum)m;
if (modifiers == ModifierEnum.None) { if (Modifiers == ModifierEnum.None) {
modifiers = ModifierEnum.Private; Modifiers = ModifierEnum.Private;
} }
} }
} }

18
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Method.cs

@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Method : AbstractMethod 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; this.ReturnType = type;
} this.Region = region;
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.bodyRegion = bodyRegion; this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m; Modifiers = (ModifierEnum)m;
if (modifiers == ModifierEnum.None) { if (Modifiers == ModifierEnum.None) {
modifiers = ModifierEnum.Private; Modifiers = ModifierEnum.Private;
} }
} }
} }

73
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryASTConvertVisitor.cs

@ -13,15 +13,11 @@ using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Using : AbstractUsing
{
}
public class NRefactoryASTConvertVisitor : RefParser.AbstractASTVisitor public class NRefactoryASTConvertVisitor : RefParser.AbstractASTVisitor
{ {
ICompilationUnit cu; ICompilationUnit cu;
Stack currentNamespace = new Stack(); Stack currentNamespace = new Stack();
Stack<Class> currentClass = new Stack<Class>(); Stack<DefaultClass> currentClass = new Stack<DefaultClass>();
public ICompilationUnit Cu { public ICompilationUnit Cu {
get { get {
@ -31,34 +27,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public NRefactoryASTConvertVisitor(IProjectContent projectContent) public NRefactoryASTConvertVisitor(IProjectContent projectContent)
{ {
cu = new CompilationUnit(projectContent); cu = new DefaultCompilationUnit(projectContent);
} }
Class GetCurrentClass() DefaultClass GetCurrentClass()
{ {
return currentClass.Count == 0 ? null : currentClass.Peek(); 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<IComment> MiscComments {
get {
return null;
}
}
public override List<IComment> DokuComments {
get {
return null;
}
}
}
public override object Visit(AST.CompilationUnit compilationUnit, object data) public override object Visit(AST.CompilationUnit compilationUnit, object data)
{ {
//TODO: usings, Comments //TODO: usings, Comments
@ -71,7 +47,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.UsingDeclaration usingDeclaration, object data) 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) { foreach (AST.Using u in usingDeclaration.Usings) {
u.AcceptVisitor(this, us); u.AcceptVisitor(this, us);
} }
@ -81,8 +57,8 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.Using u, object data) public override object Visit(AST.Using u, object data)
{ {
Debug.Assert(data is Using); Debug.Assert(data is DefaultUsing);
Using us = (Using)data; DefaultUsing us = (DefaultUsing)data;
if (u.IsAlias) { if (u.IsAlias) {
us.Aliases[u.Alias] = u.Name; us.Aliases[u.Alias] = u.Name;
} else { } else {
@ -98,7 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
foreach (AST.AttributeSection section in attributes) { foreach (AST.AttributeSection section in attributes) {
List<IAttribute> resultAttributes = new List<IAttribute>(); List<IAttribute> resultAttributes = new List<IAttribute>();
foreach (AST.Attribute attribute in section.Attributes) { 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) { foreach (AST.NamedArgumentExpression n in attribute.NamedArguments) {
a.NamedArguments[n.Name] = n.Expression; 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); result.Add(s);
} }
return result; return result;
@ -188,11 +164,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.TypeDeclaration typeDeclaration, object data) public override object Visit(AST.TypeDeclaration typeDeclaration, object data)
{ {
DefaultRegion region = GetRegion(typeDeclaration.StartLocation, typeDeclaration.EndLocation); 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)); c.Attributes.AddRange(VisitAttributes(typeDeclaration.Attributes));
if (currentClass.Count > 0) { if (currentClass.Count > 0) {
Class cur = GetCurrentClass(); DefaultClass cur = GetCurrentClass();
cur.InnerClasses.Add(c); cur.InnerClasses.Add(c);
c.FullyQualifiedName = cur.FullyQualifiedName + '.' + typeDeclaration.Name; c.FullyQualifiedName = cur.FullyQualifiedName + '.' + typeDeclaration.Name;
} else { } else {
@ -211,18 +187,17 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
currentClass.Push(c); currentClass.Push(c);
object ret = typeDeclaration.AcceptChildren(this, data); object ret = typeDeclaration.AcceptChildren(this, data);
currentClass.Pop(); currentClass.Pop();
c.UpdateModifier();
return ret; return ret;
} }
public override object Visit(AST.DelegateDeclaration delegateDeclaration, object data) public override object Visit(AST.DelegateDeclaration delegateDeclaration, object data)
{ {
DefaultRegion region = GetRegion(delegateDeclaration.StartLocation, delegateDeclaration.EndLocation); 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.Attributes.AddRange(VisitAttributes(delegateDeclaration.Attributes));
c.BaseTypes.Add("System.Delegate"); c.BaseTypes.Add("System.Delegate");
if (currentClass.Count > 0) { if (currentClass.Count > 0) {
Class cur = GetCurrentClass(); DefaultClass cur = GetCurrentClass();
cur.InnerClasses.Add(c); cur.InnerClasses.Add(c);
c.FullyQualifiedName = cur.FullyQualifiedName + '.' + delegateDeclaration.Name; c.FullyQualifiedName = cur.FullyQualifiedName + '.' + delegateDeclaration.Name;
} else { } else {
@ -243,7 +218,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation); DefaultRegion region = GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : new Point(-1, -1)); DefaultRegion bodyRegion = GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ? methodDeclaration.Body.EndLocation : new Point(-1, -1));
ReturnType type = new ReturnType(methodDeclaration.TypeReference); 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 method = new Method(methodDeclaration.Name, type, methodDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
method.Attributes.AddRange(VisitAttributes(methodDeclaration.Attributes)); method.Attributes.AddRange(VisitAttributes(methodDeclaration.Attributes));
@ -264,7 +239,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
DefaultRegion region = GetRegion(constructorDeclaration.StartLocation, constructorDeclaration.EndLocation); DefaultRegion region = GetRegion(constructorDeclaration.StartLocation, constructorDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body != null ? constructorDeclaration.Body.EndLocation : new Point(-1, -1)); 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 constructor = new Constructor(constructorDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
constructor.Attributes.AddRange(VisitAttributes(constructorDeclaration.Attributes)); constructor.Attributes.AddRange(VisitAttributes(constructorDeclaration.Attributes));
@ -286,9 +261,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(destructorDeclaration.StartLocation, destructorDeclaration.EndLocation); DefaultRegion region = GetRegion(destructorDeclaration.StartLocation, destructorDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(destructorDeclaration.EndLocation, destructorDeclaration.Body != null ? destructorDeclaration.Body.EndLocation : new Point(-1, -1)); 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)); destructor.Attributes.AddRange(VisitAttributes(destructorDeclaration.Attributes));
c.Methods.Add(destructor); c.Methods.Add(destructor);
return null; return null;
@ -298,7 +273,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
public override object Visit(AST.FieldDeclaration fieldDeclaration, object data) public override object Visit(AST.FieldDeclaration fieldDeclaration, object data)
{ {
DefaultRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation); DefaultRegion region = GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation);
Class c = GetCurrentClass(); DefaultClass c = GetCurrentClass();
if (currentClass.Count > 0) { if (currentClass.Count > 0) {
for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) { for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) {
AST.VariableDeclaration field = (AST.VariableDeclaration)fieldDeclaration.Fields[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); Field f = new Field(retType, field.Name, fieldDeclaration.Modifier, region, c);
f.Attributes.AddRange(VisitAttributes(fieldDeclaration.Attributes)); f.Attributes.AddRange(VisitAttributes(fieldDeclaration.Attributes));
if (c.ClassType == ClassType.Enum) { if (c.ClassType == ClassType.Enum) {
f.SetModifiers(ModifierEnum.Const | ModifierEnum.SpecialName); f.Modifiers = ModifierEnum.Const | ModifierEnum.Public;
} }
c.Fields.Add(f); c.Fields.Add(f);
@ -326,7 +301,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion bodyRegion = GetRegion(propertyDeclaration.BodyStart, propertyDeclaration.BodyEnd); DefaultRegion bodyRegion = GetRegion(propertyDeclaration.BodyStart, propertyDeclaration.BodyEnd);
ReturnType type = new ReturnType(propertyDeclaration.TypeReference); 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 property = new Property(propertyDeclaration.Name, type, propertyDeclaration.Modifier, region, bodyRegion, GetCurrentClass());
property.Attributes.AddRange(VisitAttributes(propertyDeclaration.Attributes)); property.Attributes.AddRange(VisitAttributes(propertyDeclaration.Attributes));
@ -339,17 +314,17 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
DefaultRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation); DefaultRegion region = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation);
DefaultRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd); DefaultRegion bodyRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd);
ReturnType type = new ReturnType(eventDeclaration.TypeReference); ReturnType type = new ReturnType(eventDeclaration.TypeReference);
Class c = GetCurrentClass(); DefaultClass c = GetCurrentClass();
Event e = null; DefaultEvent e = null;
if (eventDeclaration.VariableDeclarators != null) { if (eventDeclaration.VariableDeclarators != null) {
foreach (ICSharpCode.NRefactory.Parser.AST.VariableDeclaration varDecl in eventDeclaration.VariableDeclarators) { 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)); e.Attributes.AddRange(VisitAttributes(eventDeclaration.Attributes));
c.Events.Add(e); c.Events.Add(e);
} }
} else { } 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)); e.Attributes.AddRange(VisitAttributes(eventDeclaration.Attributes));
c.Events.Add(e); c.Events.Add(e);
} }
@ -370,7 +345,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
parameters.Add(p); parameters.Add(p);
} }
} }
Class c = GetCurrentClass(); DefaultClass c = GetCurrentClass();
c.Indexer.Add(i); c.Indexer.Add(i);
return null; return null;
} }

35
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs

@ -255,12 +255,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
private class LocalVariableField : AbstractField 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.ReturnType = type;
this.FullyQualifiedName = name; this.Region = region;
this.region = region; this.Modifiers = ModifierEnum.Private;
this.modifiers = ModifierEnum.Private;
} }
} }
#endregion #endregion
@ -402,11 +401,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
/// </remarks> /// </remarks>
public IClass SearchType(string name, IClass curType) public IClass SearchType(string name, IClass curType)
{ {
IClass c = SearchLocalType(name); return projectContent.SearchType(name, curType, caretLine, caretColumn);
if (c != null)
return c;
else
return projectContent.SearchType(name, curType, caretLine, caretColumn);
} }
/// <remarks> /// <remarks>
@ -414,25 +409,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
/// </remarks> /// </remarks>
public IClass SearchType(string name, IClass curType, ICompilationUnit unit) public IClass SearchType(string name, IClass curType, ICompilationUnit unit)
{ {
IClass c = SearchLocalType(name); return projectContent.SearchType(name, curType, unit, caretLine, caretColumn);
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;
} }
#region Helper for TypeVisitor #region Helper for TypeVisitor

18
src/Main/Base/Project/Src/Dom/NRefactoryResolver/Property.cs

@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
{ {
public class Property : AbstractProperty 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; this.ReturnType = type;
} this.Region = region;
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.bodyRegion = bodyRegion; this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m; Modifiers = (ModifierEnum)m;
if (modifiers == ModifierEnum.None) { if (Modifiers == ModifierEnum.None) {
modifiers = ModifierEnum.Private; Modifiers = ModifierEnum.Private;
} }
} }
} }

17
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionClass.cs

@ -14,7 +14,7 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public class ReflectionClass : AbstractClass public class ReflectionClass : DefaultClass
{ {
Type type; Type type;
@ -137,25 +137,25 @@ namespace ICSharpCode.SharpDevelop.Dom
public ReflectionClass(ICompilationUnit compilationUnit, Type type, IClass declaringType) : base(compilationUnit, declaringType) public ReflectionClass(ICompilationUnit compilationUnit, Type type, IClass declaringType) : base(compilationUnit, declaringType)
{ {
this.type = type; this.type = type;
FullyQualifiedName = type.FullName.Replace("+", "."); FullyQualifiedName = type.FullName.Replace('+', '.');
// set classtype // set classtype
if (IsDelegate(type)) { if (IsDelegate(type)) {
classType = ClassType.Delegate; this.ClassType = ClassType.Delegate;
MethodInfo invoke = type.GetMethod("Invoke"); MethodInfo invoke = type.GetMethod("Invoke");
ReflectionMethod newMethod = new ReflectionMethod(invoke, this); ReflectionMethod newMethod = new ReflectionMethod(invoke, this);
Methods.Add(newMethod); Methods.Add(newMethod);
} else if (type.IsInterface) { } else if (type.IsInterface) {
classType = ClassType.Interface; this.ClassType = ClassType.Interface;
} else if (type.IsEnum) { } else if (type.IsEnum) {
classType = ClassType.Enum; this.ClassType = ClassType.Enum;
} else if (type.IsValueType) { } else if (type.IsValueType) {
classType = ClassType.Struct; this.ClassType = ClassType.Struct;
} else { } else {
classType = ClassType.Class; this.ClassType = ClassType.Class;
} }
modifiers = ModifierEnum.None; ModifierEnum modifiers = ModifierEnum.None;
if (type.IsNestedAssembly) { if (type.IsNestedAssembly) {
modifiers |= ModifierEnum.Internal; modifiers |= ModifierEnum.Internal;
@ -181,6 +181,7 @@ namespace ICSharpCode.SharpDevelop.Dom
modifiers |= ModifierEnum.Protected; modifiers |= ModifierEnum.Protected;
modifiers |= ModifierEnum.Internal; modifiers |= ModifierEnum.Internal;
} }
this.Modifiers = modifiers;
// set base classes // set base classes
if (type.BaseType != null) { // it's null for System.Object ONLY !!! if (type.BaseType != null) { // it's null for System.Object ONLY !!!

8
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionEvent.cs

@ -12,7 +12,7 @@ using System.Xml;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public class ReflectionEvent : AbstractEvent public class ReflectionEvent : DefaultEvent
{ {
EventInfo eventInfo; 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; this.eventInfo = eventInfo;
FullyQualifiedName = String.Concat(eventInfo.DeclaringType.FullName, ".", eventInfo.Name);
// get modifiers // get modifiers
MethodInfo methodBase = null; MethodInfo methodBase = null;
@ -41,6 +40,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {} } catch (Exception) {}
} }
ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) { if (methodBase != null) {
if (methodBase.IsStatic) { if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static; modifiers |= ModifierEnum.Static;
@ -67,7 +67,7 @@ namespace ICSharpCode.SharpDevelop.Dom
// assume public property, if no methodBase could be get. // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public; modifiers = ModifierEnum.Public;
} }
this.Modifiers = modifiers;
} }
} }

6
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; this.fieldInfo = fieldInfo;
System.Diagnostics.Debug.Assert(fieldInfo != null);
FullyQualifiedName = String.Concat(fieldInfo.DeclaringType.FullName, ".", fieldInfo.Name);
ModifierEnum modifiers = ModifierEnum.None;
if (fieldInfo.IsInitOnly) { if (fieldInfo.IsInitOnly) {
modifiers |= ModifierEnum.Readonly; modifiers |= ModifierEnum.Readonly;
} }
@ -58,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (fieldInfo.IsLiteral) { if (fieldInfo.IsLiteral) {
modifiers |= ModifierEnum.Const; modifiers |= ModifierEnum.Const;
} }
this.Modifiers = modifiers;
} }
} }
} }

5
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) public ReflectionIndexer(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType)
{ {
this.propertyInfo = propertyInfo; 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 // show the abstract layer that we have getter & setters
if (propertyInfo.CanRead) { if (propertyInfo.CanRead) {
@ -82,6 +80,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {} } catch (Exception) {}
} }
ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) { if (methodBase != null) {
if (methodBase.IsStatic) { if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static; modifiers |= ModifierEnum.Static;
@ -106,7 +105,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get. } else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public; modifiers = ModifierEnum.Public;
} }
this.Modifiers = modifiers;
} }
} }
} }

12
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; this.methodBase = methodBase;
string name = methodBase.Name;
if (methodBase is ConstructorInfo) { ModifierEnum modifiers = ModifierEnum.None;
name = "#ctor";
}
FullyQualifiedName = methodBase.DeclaringType.FullName + "." + name;
modifiers = ModifierEnum.None;
if (methodBase.IsStatic) { if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static; modifiers |= ModifierEnum.Static;
} }
@ -107,6 +102,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (methodBase.IsAbstract) { if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract; modifiers |= ModifierEnum.Abstract;
} }
this.Modifiers = modifiers;
} }
} }
} }

6
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionProperty.cs

@ -23,10 +23,9 @@ namespace ICSharpCode.SharpDevelop.Dom
set { set {
} }
} }
public ReflectionProperty(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType) public ReflectionProperty(PropertyInfo propertyInfo, IClass declaringType) : base(declaringType, propertyInfo.Name)
{ {
this.propertyInfo = propertyInfo; this.propertyInfo = propertyInfo;
FullyQualifiedName = String.Concat(propertyInfo.DeclaringType.FullName, ".", propertyInfo.Name);
// show the abstract layer that we have getter & setters // show the abstract layer that we have getter & setters
if (propertyInfo.CanRead) { if (propertyInfo.CanRead) {
@ -52,6 +51,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} catch (Exception) {} } catch (Exception) {}
} }
ModifierEnum modifiers = ModifierEnum.None;
if (methodBase != null) { if (methodBase != null) {
if (methodBase.IsStatic) { if (methodBase.IsStatic) {
modifiers |= ModifierEnum.Static; modifiers |= ModifierEnum.Static;
@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get. } else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public; modifiers = ModifierEnum.Public;
} }
this.Modifiers = modifiers;
} }
} }
} }

26
src/Main/Base/Project/Src/Dom/Tag.cs

@ -9,7 +9,7 @@ using System;
namespace ICSharpCode.SharpDevelop.Dom namespace ICSharpCode.SharpDevelop.Dom
{ {
[Serializable] [Serializable]
public class Tag : Comment public class Tag : MarshalByRefObject //Comment
{ {
string key; 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.key = key;
this.region = region;
} }
} }
} }

2
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -168,6 +168,7 @@ namespace ICSharpCode.SharpDevelop.Gui
void ClearText() void ClearText()
{ {
textEditorControl.Text = ""; textEditorControl.Text = "";
textEditorControl.Refresh();
} }
void CategoryTextSet(object sender, TextEventArgs e) void CategoryTextSet(object sender, TextEventArgs e)
@ -205,6 +206,7 @@ namespace ICSharpCode.SharpDevelop.Gui
text = String.Empty; text = String.Empty;
} }
textEditorControl.Text = text; textEditorControl.Text = text;
textEditorControl.Refresh();
// textEditorControl.Select(text.Length , 0); // textEditorControl.Select(text.Length , 0);
// textEditorControl.Select(); // textEditorControl.Select();
// textEditorControl.ScrollToCaret(); // textEditorControl.ScrollToCaret();

2
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

@ -165,7 +165,7 @@ namespace ICSharpCode.SharpDevelop.Gui
LoadDefaultLayoutConfiguration(); LoadDefaultLayoutConfiguration();
} }
} catch { } catch {
LoadDefaultLayoutConfiguration(); // ignore errors loading configuration
} }
ActivateVisiblePads(); ActivateVisiblePads();
} }

2
src/Main/Base/Project/Src/Project/Items/ReferenceProjectItem.cs

@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.Project
if (info.Length < 4) { if (info.Length < 4) {
try { try {
Assembly refAssembly = Assembly.Load(referenceName); Assembly refAssembly = ProjectContentRegistry.LoadGACAssembly(referenceName, true);
// if it failed, then return just the short name // if it failed, then return just the short name
if (refAssembly == null) { if (refAssembly == null) {

10
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.SharpDevelop.Project
configurations[""] = new PropertyGroup(); configurations[""] = new PropertyGroup();
IdGuid = "{" + Guid.NewGuid().ToString().ToUpper() + "}"; IdGuid = "{" + Guid.NewGuid().ToString().ToUpper() + "}";
BaseConfiguration["OutputType"] = "Exe"; BaseConfiguration["OutputType"] = "Exe";
BaseConfiguration["RootNamespace"] = "RootNameSpace"; BaseConfiguration["RootNamespace"] = information.ProjectName;
BaseConfiguration["AssemblyName"] = information.ProjectName; BaseConfiguration["AssemblyName"] = information.ProjectName;
BaseConfiguration["Configuration"] = "Debug"; BaseConfiguration["Configuration"] = "Debug";
BaseConfiguration.SetIsGuarded("Configuration", true); BaseConfiguration.SetIsGuarded("Configuration", true);
@ -35,11 +35,13 @@ namespace ICSharpCode.SharpDevelop.Project
configurations["Debug|AnyCPU"] = new PropertyGroup(); configurations["Debug|AnyCPU"] = new PropertyGroup();
configurations["Debug|AnyCPU"]["OutputPath"] = @"bin\Debug\"; 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"] = new PropertyGroup();
configurations["Release|AnyCPU"]["OutputPath"] = @"bin\Release\"; configurations["Release|AnyCPU"]["OutputPath"] = @"bin\Release\";
configurations["Release|AnyCPU"]["Optimize"] = @"true"; configurations["Release|AnyCPU"]["Optimize"] = "true";
configurations["Release|AnyCPU"]["DefineConstants"] = "TRACE";
fileName = information.OutputProjectFileName; fileName = information.OutputProjectFileName;
} }
@ -63,7 +65,7 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
this.fileName = projectFileName; this.fileName = projectFileName;
using (XmlTextReader reader = new XmlTextReader(projectFileName)) { using (XmlTextReader reader = new XmlTextReader(projectFileName)) {
while (reader.Read()){ while (reader.Read()) {
if (reader.IsStartElement()) { if (reader.IsStartElement()) {
switch (reader.LocalName) { switch (reader.LocalName) {
case "PropertyGroup": case "PropertyGroup":

45
src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs

@ -72,7 +72,7 @@ namespace ICSharpCode.Core
{ {
CaseSensitiveProjectContent newProjectContent = new CaseSensitiveProjectContent(); 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()) { foreach (Type type in assembly.GetTypes()) {
if (!type.FullName.StartsWith("<") && type.IsPublic) { 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) public IClass SearchType(string name, IClass curType, ICompilationUnit unit, int caretLine, int caretColumn)
{ {
// Console.WriteLine("SearchType({0})", name); // Console.WriteLine("SearchType({0})", name);
if (name == null || name == String.Empty) { if (name == null || name.Length == 0) {
return null; return null;
} }
IClass c = GetClass(name); // Try if name is already the full type name
IClass c = GetClass(name);
if (c != null) { if (c != null) {
return c; return c;
} }
if (unit != null) { if (unit != null) {
// Combine name with usings
foreach (IUsing u in unit.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); c = u.SearchType(name);
if (c != null) { if (c != null) {
return c; return c;
@ -359,45 +361,22 @@ namespace ICSharpCode.Core
if (curType == null) { if (curType == null) {
return null; return null;
} }
// Try parent namespaces of the current class
string fullname = curType.FullyQualifiedName; string fullname = curType.FullyQualifiedName;
string[] namespaces = fullname.Split('.'); string[] namespaces = fullname.Split('.');
StringBuilder curnamespace = new StringBuilder(); StringBuilder curnamespace = new StringBuilder();
for (int i = 0; i < namespaces.Length; ++i) { for (int i = 0; i < namespaces.Length; ++i) {
curnamespace.Append(namespaces[i]); curnamespace.Append(namespaces[i]);
curnamespace.Append('.'); curnamespace.Append('.');
StringBuilder nms=new StringBuilder(curnamespace.ToString());
nms.Append(name); curnamespace.Append(name);
c = GetClass(nms.ToString()); c = GetClass(curnamespace.ToString());
if (c != null) { if (c != null) {
return c; 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; return null;
} }

9
src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs

@ -57,7 +57,7 @@ namespace ICSharpCode.Core
} }
} catch (Exception) { } catch (Exception) {
try { try {
assembly = Assembly.ReflectionOnlyLoad(item.Include); assembly = LoadGACAssembly(item.Include, true);
if (assembly != null) { if (assembly != null) {
contents[item.Include] = CaseSensitiveProjectContent.Create(assembly); contents[item.Include] = CaseSensitiveProjectContent.Create(assembly);
return contents[item.Include]; return contents[item.Include];
@ -69,5 +69,12 @@ namespace ICSharpCode.Core
return null; return null;
} }
public static Assembly LoadGACAssembly(string partialName, bool reflectionOnly)
{
#pragma warning disable 618
return Assembly.LoadWithPartialName(partialName);
#pragma warning restore 618
}
} }
} }

32
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs

@ -128,37 +128,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
caretColumn, caretColumn,
fileName, fileName,
document.TextContent); document.TextContent);
// if expression references object in another namespace (using), no results are delivered AddResolveResults(results);
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);
} }
return (ICompletionData[])completionData.ToArray(typeof(ICompletionData)); return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));

3
src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs

@ -88,12 +88,11 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
if (cu.DokuComments != null) { 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, foldMarkers.Add(new FoldMarker(document, c.Region.BeginLine - 1, c.Region.BeginColumn - 1,
c.Region.EndLine - 1, c.Region.EndColumn - 1)); c.Region.EndLine - 1, c.Region.EndColumn - 1));
} }
} }
return foldMarkers; return foldMarkers;
} }
} }

8
src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs

@ -423,8 +423,12 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
void ParseInformationUpdatedInternal(ParseInformation parseInfo) void ParseInformationUpdatedInternal(ParseInformation parseInfo)
{ {
textAreaControl.Document.FoldingManager.UpdateFoldings(TitleName, parseInfo); try {
textAreaControl.ActiveTextAreaControl.TextArea.Refresh(textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin); textAreaControl.Document.FoldingManager.UpdateFoldings(TitleName, parseInfo);
textAreaControl.ActiveTextAreaControl.TextArea.Refresh(textAreaControl.ActiveTextAreaControl.TextArea.FoldMargin);
} catch (Exception ex) {
MessageService.ShowError(ex);
}
} }

Loading…
Cancel
Save