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. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs
  2. 2
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetLanguageBinding.cs
  3. 13
      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. 12
      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. 4
      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. 54
      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. 31
      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. 43
      src/Main/Base/Project/Src/Services/ParserService/CaseSensitiveProjectContent.cs
  44. 9
      src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
  45. 30
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
  46. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/ParserFoldingStrategy.cs
  47. 4
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs

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

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

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

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

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

@ -118,8 +118,14 @@ namespace ICSharpCode.FormDesigner @@ -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 @@ -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 @@ -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 @@ -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 @@ -233,7 +241,6 @@ namespace ICSharpCode.FormDesigner
SharpDevelopSideBar.SideBar.Refresh();
propertyContainer.Host = Host;
UpdateSelectableObjects();
Reload();
}
public override void Deselected()

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

@ -84,18 +84,18 @@ @@ -84,18 +84,18 @@
<Compile Include="Src\Dom\IMethod.cs" />
<Compile Include="Src\Dom\ClassType.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\AbstractField.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\IParameter.cs" />
<Compile Include="Src\Dom\Implementations\AbstractParameter.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\AbstractCompilationUnit.cs" />
<Compile Include="Src\Dom\Implementations\DefaultCompilationUnit.cs" />
<Compile Include="Src\Services\ParserService\ParserService.cs" />
<Compile Include="Src\Services\DisplayBinding\DisplayBindingErbauer.cs" />
<Compile Include="Src\Internal\Auswerter\CombineOpenAuswerter.cs" />
@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
<Compile Include="Src\Dom\ParameterModifier.cs" />
<Compile Include="Src\Dom\Implementations\AbstractDecoration.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\ReflectionLayer\ReflectionClass.cs" />
<Compile Include="Src\Dom\ReflectionLayer\ReflectionField.cs" />
@ -121,7 +121,6 @@ @@ -121,7 +121,6 @@
<Compile Include="Src\Dom\ReflectionLayer\ReflectionReturnType.cs" />
<Compile Include="Src\Dom\ReflectionLayer\ReflectionIndexer.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\NetAmbience.cs" />
<Compile Include="Src\Services\AmbienceService\AmbienceReflectionDecorator.cs" />
@ -361,9 +360,6 @@ @@ -361,9 +360,6 @@
<Compile Include="Src\Dom\NRefactoryResolver\TypeVisitor.cs" />
<Compile Include="Src\Dom\NRefactoryResolver\NRefactoryASTConvertVisitor.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\Destructor.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 @@ -46,10 +46,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get;
}
IRegion BodyRegion {
get;
}
List<string> BaseTypes {
get;
}
@ -82,10 +78,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -82,10 +78,6 @@ namespace ICSharpCode.SharpDevelop.Dom
get;
}
object DeclaredIn {
get;
}
IClass BaseClass {
get;
}

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

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

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

@ -1,44 +0,0 @@ @@ -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;
}
}
}
}

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

@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -14,8 +14,8 @@ namespace ICSharpCode.SharpDevelop.Dom
[Serializable]
public abstract class AbstractDecoration : MarshalByRefObject, IDecoration
{
protected ModifierEnum modifiers = ModifierEnum.None;
protected List<IAttributeSection> attributes = null;
ModifierEnum modifiers = ModifierEnum.None;
List<IAttributeSection> attributes = null;
IClass declaringType;
object userData = null;
@ -26,7 +26,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -26,7 +26,6 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public object UserData {
get {
return userData;
@ -36,13 +35,16 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -36,13 +35,16 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public virtual ModifierEnum Modifiers {
public ModifierEnum Modifiers {
get {
return modifiers;
}
set {
modifiers = value;
}
}
public virtual List<IAttributeSection> Attributes {
public List<IAttributeSection> Attributes {
get {
if (attributes == null) {
attributes = new List<IAttributeSection>();

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

@ -10,7 +10,7 @@ using System.Reflection; @@ -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;
@ -30,17 +30,27 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -30,17 +30,27 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public virtual EventAttributes EventAttributes {
get {
return eventAttributes;
}
}
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;

2
src/Main/Base/Project/Src/Dom/Implementations/AbstractField.cs

@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -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 @@ -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 @@ -30,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public AbstractMember(IClass declaringType) : base(declaringType)
public AbstractMember(IClass declaringType, string name) : base(declaringType, name)
{
}
}

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

@ -43,11 +43,11 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -43,11 +43,11 @@ namespace ICSharpCode.SharpDevelop.Dom
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)
{
}

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

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -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;
}
}
}

2
src/Main/Base/Project/Src/Dom/Implementations/AbstractProperty.cs

@ -83,7 +83,7 @@ namespace ICSharpCode.SharpDevelop.Dom { @@ -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 @@ @@ -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();
}
}
}

54
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; @@ -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<IAttribute> attributes = null;
public virtual AttributeTarget AttributeTarget {
public DefaultAttributeSection(AttributeTarget attributeTarget, List<IAttribute> attributes)
{
this.attributeTarget = attributeTarget;
this.attributes = attributes;
}
public AttributeTarget AttributeTarget {
get {
return attributeTarget;
}
@ -25,16 +31,10 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -25,16 +31,10 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public virtual List<IAttribute> Attributes {
public List<IAttribute> Attributes {
get {
if (attributes == null) {
attributes = new List<IAttribute>();
}
return attributes;
}
set {
attributes = value;
}
}
public virtual int CompareTo(IAttributeSection value) {
@ -51,13 +51,27 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -51,13 +51,27 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public abstract class AbstractAttribute : IAttribute
public class DefaultAttribute : IAttribute
{
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)
{
protected string name;
protected ArrayList positionalArguments = new ArrayList();
protected SortedList namedArguments = new SortedList();
this.name = name;
this.positionalArguments = positionalArguments;
this.namedArguments = namedArguments;
}
public virtual string Name {
public string Name {
get {
return name;
}
@ -65,21 +79,15 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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) {

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; @@ -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 @@ -34,18 +32,24 @@ namespace ICSharpCode.SharpDevelop.Dom
List<IEvent> events = null;
List<IIndexer> 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 @@ -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<string> BaseTypes {
public List<string> BaseTypes {
get {
if (baseTypes == null) {
baseTypes = new List<string>();

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

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

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

@ -0,0 +1,113 @@ @@ -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 @@ @@ -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 @@ @@ -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 @@ -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;
}
}
}

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

@ -7,17 +7,10 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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;
}
}
}

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

@ -7,24 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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;
this.ReturnType = type;
this.Region = region;
Modifiers = (ModifierEnum)m;
if (Modifiers == ModifierEnum.None) {
Modifiers = ModifierEnum.Private;
}
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;
}
}
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 @@ -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<IParameter> 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;
}
}
}

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

@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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;
}
}
}

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

@ -13,15 +13,11 @@ using ICSharpCode.Core; @@ -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<Class> currentClass = new Stack<Class>();
Stack<DefaultClass> currentClass = new Stack<DefaultClass>();
public ICompilationUnit Cu {
get {
@ -31,34 +27,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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<IComment> MiscComments {
get {
return null;
}
}
public override List<IComment> 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 @@ -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 @@ -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 @@ -98,7 +74,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
foreach (AST.AttributeSection section in attributes) {
List<IAttribute> resultAttributes = new List<IAttribute>();
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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -370,7 +345,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
parameters.Add(p);
}
}
Class c = GetCurrentClass();
DefaultClass c = GetCurrentClass();
c.Indexer.Add(i);
return null;
}

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

@ -255,12 +255,11 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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,10 +401,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -402,10 +401,6 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
/// </remarks>
public IClass SearchType(string name, IClass curType)
{
IClass c = SearchLocalType(name);
if (c != null)
return c;
else
return projectContent.SearchType(name, curType, caretLine, caretColumn);
}
@ -414,27 +409,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -414,27 +409,9 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
/// </remarks>
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;
}
#region Helper for TypeVisitor
#region SearchMethod
/// <summary>

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

@ -7,20 +7,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -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;
}
}
}

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

@ -14,7 +14,7 @@ using System.Collections.Generic; @@ -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 @@ -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 @@ -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 !!!

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

@ -12,7 +12,7 @@ using System.Xml; @@ -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 @@ -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 @@ -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 @@ -67,7 +67,7 @@ namespace ICSharpCode.SharpDevelop.Dom
// assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
this.Modifiers = modifiers;
}
}

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

@ -24,12 +24,11 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -58,6 +57,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (fieldInfo.IsLiteral) {
modifiers |= ModifierEnum.Const;
}
this.Modifiers = modifiers;
}
}
}

5
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionIndexer.cs

@ -55,8 +55,6 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -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 @@ -106,7 +105,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
this.Modifiers = modifiers;
}
}
}

12
src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionMethod.cs

@ -71,17 +71,12 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -107,6 +102,7 @@ namespace ICSharpCode.SharpDevelop.Dom
if (methodBase.IsAbstract) {
modifiers |= ModifierEnum.Abstract;
}
this.Modifiers = modifiers;
}
}
}

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

@ -23,10 +23,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -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 @@ -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 @@ -84,7 +84,7 @@ namespace ICSharpCode.SharpDevelop.Dom
} else { // assume public property, if no methodBase could be get.
modifiers = ModifierEnum.Public;
}
this.Modifiers = modifiers;
}
}
}

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

@ -9,7 +9,7 @@ using System; @@ -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 @@ -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;
}
}
}

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

@ -168,6 +168,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -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 @@ -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();

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

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

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

@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -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) {

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

@ -26,7 +26,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -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 @@ -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 @@ -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":

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

@ -72,7 +72,7 @@ namespace ICSharpCode.Core @@ -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 @@ -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;
}
// 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 @@ -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;
}

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

@ -57,7 +57,7 @@ namespace ICSharpCode.Core @@ -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 @@ -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
}
}
}

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

@ -128,37 +128,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -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);
}
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 @@ -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;
}
}

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

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

Loading…
Cancel
Save