Author: lluis
Date: 2005-12-13 09:38:50 -0500 (Tue, 13 Dec 2005)
New Revision: 54286
Added:
trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
Modified:
trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.addin.xml
trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.mdp
trunk/monodevelop/Extras/CSharpBinding/CSharpLanguageBinding.cs
trunk/monodevelop/Extras/CSharpBinding/ChangeLog
trunk/monodevelop/Extras/CSharpBinding/Makefile.am
trunk/monodevelop/Extras/CSharpBinding/Parser/CSharpVisitor.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/Resolver.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/AttributeSection.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Class.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Constructor.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Destructor.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Event.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Field.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Indexer.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Method.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Parameter.cs
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Property.cs
trunk/monodevelop/Extras/CSharpBinding/templates/AppConfigFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyCSharpFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyHTMLFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyResourceFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyTextFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyXMLFile.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharp2Project.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharpProject.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharp2Project.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProgram.xft.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProject.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharp2Project.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpProject.xpt.xml
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpWindow.xft.xml
Log:
2005-12-13 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* Parser/Parser.cs: Track api changes.
* CSharpLanguageBinding.cs: Implemented the new methods in
IDotNetLanguageBinding.
* CSharpBinding.addin.xml: Removed some templates that don't really
belong here.
* CSharpBinding/CSharpBinding.mdp: Updated.
* Parser/SharpDevelopTree/AttributeSection.cs:
* Parser/CSharpVisitor.cs: Properly collect region and attribute
information. This is a patch by Alex Gomes.
Also: properly set the declaring type to class members.
* Parser/Resolver.cs: Added two new methods: ResolveExpressionType
returns the type of an arbitrary expression. ResolveIdentifier returns
information about an identifier.
* Parser/SharpDevelopTree/Indexer.cs:
* Parser/SharpDevelopTree/Method.cs:
* Parser/SharpDevelopTree/Parameter.cs:
* Parser/SharpDevelopTree/Event.cs:
* Parser/SharpDevelopTree/Field.cs:
* Parser/SharpDevelopTree/Property.cs:
* Parser/SharpDevelopTree/Class.cs:
* Parser/SharpDevelopTree/Constructor.cs:
* Parser/SharpDevelopTree/Destructor.cs: Set the declaring type to
class members.
* templates/*: Set the correct category, language and project type.
* Parser/CodeGenerator.cs: Initial implementation of IRefactorer.
Modified: trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.addin.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.addin.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.addin.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -23,8 +23,6 @@
</Extension>
<Extension path = "/MonoDevelop/FileTemplates">
- <FileTemplate id = "SessionState" resource =
"CSharpSessionStateWebService.xft.xml"/>
- <FileTemplate id = "WebService" resource =
"CSharpWebService.xft.xml"/>
<FileTemplate id = "Empty" resource =
"EmptyCSharpFile.xft.xml"/>
<FileTemplate id = "GnomeSharpProgram" resource =
"GnomeSharpProgram.xft.xml"/>
<FileTemplate id = "GtkSharpWindow" resource =
"GtkSharpWindow.xft.xml"/>
Modified: trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.mdp
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.mdp 2005-12-13
14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/CSharpBinding.mdp 2005-12-13
14:38:50 UTC (rev 54286)
@@ -41,6 +41,7 @@
<File name="./Parser/SharpDevelopTree/Property.cs" subtype="Code"
buildaction="Compile" />
<File name="./Parser/SharpDevelopTree/ReturnType.cs" subtype="Code"
buildaction="Compile" />
<File name="./Project/CSharpCompilerParameters.cs" subtype="Code"
buildaction="Compile" />
+ <File name="./Parser/CodeGenerator.cs" subtype="Code"
buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="False" refto="System.Drawing,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Modified: trunk/monodevelop/Extras/CSharpBinding/CSharpLanguageBinding.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/CSharpLanguageBinding.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/CSharpLanguageBinding.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -14,17 +14,23 @@
using System.Xml;
using System.CodeDom.Compiler;
using System.Threading;
+using Microsoft.CSharp;
using MonoDevelop.Projects;
+using MonoDevelop.Projects.Parser;
+using MonoDevelop.Projects.CodeGeneration;
using MonoDevelop.Core;
+using CSharpBinding.Parser;
+
namespace CSharpBinding
{
- public class CSharpLanguageBinding : ILanguageBinding
+ public class CSharpLanguageBinding : IDotNetLanguageBinding
{
public const string LanguageName = "C#";
CSharpBindingCompilerManager compilerManager = new
CSharpBindingCompilerManager();
+ CSharpCodeProvider provider;
public string Language {
get {
@@ -32,7 +38,7 @@
}
}
- public bool CanCompile(string fileName)
+ public bool IsSourceCodeFile (string fileName)
{
Debug.Assert(compilerManager != null);
return compilerManager.CanCompile(fileName);
@@ -58,5 +64,28 @@
{
get { return "//"; }
}
+
+ public CodeDomProvider GetCodeDomProvider ()
+ {
+ if (provider == null)
+ provider = new CSharpCodeProvider ();
+ return provider;
+ }
+
+ public string GetFileName (string baseName)
+ {
+ return baseName + ".cs";
+ }
+
+ TParser parser = new TParser ();
+ CSharpRefactorer refactorer = new CSharpRefactorer ();
+
+ public IParser Parser {
+ get { return parser; }
+ }
+
+ public IRefactorer Refactorer {
+ get { return refactorer; }
+ }
}
}
Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2005-12-13 14:38:32 UTC
(rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog 2005-12-13 14:38:50 UTC
(rev 54286)
@@ -1,3 +1,35 @@
+2005-12-13 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * Parser/Parser.cs: Track api changes.
+ * CSharpLanguageBinding.cs: Implemented the new methods in
+ IDotNetLanguageBinding.
+ * CSharpBinding.addin.xml: Removed some templates that don't really
+ belong here.
+ * CSharpBinding/CSharpBinding.mdp: Updated.
+
+ * Parser/SharpDevelopTree/AttributeSection.cs:
+ * Parser/CSharpVisitor.cs: Properly collect region and attribute
+ information. This is a patch by Alex Gomes.
+ Also: properly set the declaring type to class members.
+
+ * Parser/Resolver.cs: Added two new methods: ResolveExpressionType
+ returns the type of an arbitrary expression. ResolveIdentifier returns
+ information about an identifier.
+
+ * Parser/SharpDevelopTree/Indexer.cs:
+ * Parser/SharpDevelopTree/Method.cs:
+ * Parser/SharpDevelopTree/Parameter.cs:
+ * Parser/SharpDevelopTree/Event.cs:
+ * Parser/SharpDevelopTree/Field.cs:
+ * Parser/SharpDevelopTree/Property.cs:
+ * Parser/SharpDevelopTree/Class.cs:
+ * Parser/SharpDevelopTree/Constructor.cs:
+ * Parser/SharpDevelopTree/Destructor.cs: Set the declaring type to
+ class members.
+
+ * templates/*: Set the correct category, language and project type.
+ * Parser/CodeGenerator.cs: Initial implementation of IRefactorer.
+
2005-11-17 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* templates/GtkSharpProject.xpt.xml:
Modified: trunk/monodevelop/Extras/CSharpBinding/Makefile.am
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Makefile.am 2005-12-13 14:38:32 UTC
(rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Makefile.am 2005-12-13 14:38:50 UTC
(rev 54286)
@@ -33,6 +33,7 @@
Parser/CSharpVisitor.cs \
Parser/Resolver.cs \
Parser/Parser.cs \
+Parser/CodeGenerator.cs \
Parser/ExpressionFinder.cs \
CSharpAmbience.cs \
Project/CSharpCompilerParameters.cs \
@@ -45,8 +46,6 @@
templates/AppConfigFile.xft.xml \
templates/BlankCombine.xpt.xml \
templates/ConsoleProject.xpt.xml \
-templates/CSharpSessionStateWebService.xft.xml \
-templates/CSharpWebService.xft.xml \
templates/EmptyCSharpFile.xft.xml \
templates/EmptyHTMLFile.xft.xml \
templates/EmptyProject.xpt.xml \
Modified: trunk/monodevelop/Extras/CSharpBinding/Parser/CSharpVisitor.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/CSharpVisitor.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/CSharpVisitor.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -50,21 +50,50 @@
return data;
}
- AttributeSectionCollection VisitAttributes(ArrayList attributes)
+ public AttributeTarget GetAttributeTarget (string attb)
{
+ switch (attb)
+ {
+ // check the 'assembly', I didn't saw it being
used in c# parser....
+ case "assembly":
+ return AttributeTarget.Assembly;
+ case "event":
+ return AttributeTarget.Event;
+ case "return":
+ return AttributeTarget.Return;
+ case "field":
+ return AttributeTarget.Field;
+ case "method":
+ return AttributeTarget.Method;
+ case "module":
+ return AttributeTarget.Module;
+ case "param":
+ return AttributeTarget.Param;
+ case "property":
+ return AttributeTarget.Property;
+ case "type":
+ return AttributeTarget.Type;
+ default:
+ return AttributeTarget.None;
+ }
+ }
+
+ void FillAttributes (IDecoration decoration, ArrayList
attributes)
+ {
// TODO Expressions???
- //AttributeSectionCollection result = new
AttributeSectionCollection();
foreach (AST.AttributeSection section in attributes) {
- //AttributeCollection resultAttributes = new
AttributeCollection();
+ AttributeSection resultSection = new
AttributeSection (GetAttributeTarget (section.AttributeTarget), GetRegion
(section.StartLocation, section.EndLocation));
+
foreach (AST.Attribute attribute in
section.Attributes) {
- IAttribute a = new
ASTAttribute(attribute.Name, new ArrayList(attribute.PositionalArguments), new
SortedList());
+
CSharpBinding.Parser.SharpDevelopTree.Attribute resultAttribute = new
CSharpBinding.Parser.SharpDevelopTree.Attribute (attribute.Name, new
ArrayList(attribute.PositionalArguments), new SortedList(), GetRegion
(attribute.StartLocation, attribute.EndLocation));
foreach (AST.NamedArgument n in
attribute.NamedArguments) {
- a.NamedArguments[n.Name] =
n.Expr;
+
resultAttribute.NamedArguments[n.Name] = n.Expr;
}
+ resultSection.Attributes.Add
(resultAttribute);
}
- //IAttributeSection s = new
AttributeSection((AttributeTarget)Enum.Parse(typeof (AttributeTarget),
section.AttributeTarget), resultAttributes);
+ decoration.Attributes.Add (resultSection);
}
- return null;
+
}
// ModifierEnum
VisitModifier(ICSharpCode.SharpRefactory.Parser.Modifier m)
@@ -103,9 +132,12 @@
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);
+ DefaultRegion bodyRegion =
GetRegion(typeDeclaration.StartLocation, typeDeclaration.EndLocation);
+ DefaultRegion declarationRegion = GetRegion
(typeDeclaration.DeclarationStartLocation,
typeDeclaration.DeclarationEndLocation);
+ Class c = new Class(cu,
TranslateClassType(typeDeclaration.Type), typeDeclaration.Modifiers.Code,
declarationRegion, bodyRegion);
+ FillAttributes (c, typeDeclaration.Attributes);
+
if (currentClass.Count > 0) {
Class cur = ((Class)currentClass.Peek());
cur.InnerClasses.Add(c);
@@ -139,20 +171,23 @@
{
DefaultRegion region =
GetRegion(methodDeclaration.StartLocation, methodDeclaration.EndLocation);
DefaultRegion bodyRegion =
GetRegion(methodDeclaration.EndLocation, methodDeclaration.Body != null ?
methodDeclaration.Body.EndLocation : new Point(-1, -1));
- // Console.WriteLine(region + "
--- " + bodyRegion);
+
ReturnType type = new
ReturnType(methodDeclaration.TypeReference);
Class c = (Class)currentClass.Peek();
- Method method = new
Method(String.Concat(methodDeclaration.Name), type, methodDeclaration.Modifier,
region, bodyRegion);
+ Method method = new Method (c,
String.Concat(methodDeclaration.Name), type, methodDeclaration.Modifiers.Code,
region, bodyRegion);
ParameterCollection parameters = new
ParameterCollection();
if (methodDeclaration.Parameters != null) {
foreach (AST.ParameterDeclarationExpression par
in methodDeclaration.Parameters) {
ReturnType parType = new
ReturnType(par.TypeReference);
- Parameter p = new
Parameter(par.ParameterName, parType);
+ Parameter p = new Parameter (method,
par.ParameterName, parType);
parameters.Add(p);
}
}
method.Parameters = parameters;
+
+ FillAttributes (method, methodDeclaration.Attributes);
+
c.Methods.Add(method);
return null;
}
@@ -163,16 +198,19 @@
DefaultRegion bodyRegion =
GetRegion(constructorDeclaration.EndLocation, constructorDeclaration.Body !=
null ? constructorDeclaration.Body.EndLocation : new Point(-1, -1));
Class c = (Class)currentClass.Peek();
- Constructor constructor = new
Constructor(constructorDeclaration.Modifier, region, bodyRegion);
+ Constructor constructor = new Constructor (c,
constructorDeclaration.Modifiers.Code, region, bodyRegion);
ParameterCollection parameters = new
ParameterCollection();
if (constructorDeclaration.Parameters != null) {
foreach (AST.ParameterDeclarationExpression par
in constructorDeclaration.Parameters) {
ReturnType parType = new
ReturnType(par.TypeReference);
- Parameter p = new
Parameter(par.ParameterName, parType);
+ Parameter p = new Parameter
(constructor, par.ParameterName, parType);
parameters.Add(p);
}
}
constructor.Parameters = parameters;
+
+ FillAttributes (constructor,
constructorDeclaration.Attributes);
+
c.Methods.Add(constructor);
return null;
}
@@ -184,12 +222,15 @@
Class c = (Class)currentClass.Peek();
- Destructor destructor = new Destructor(c.Name,
destructorDeclaration.Modifier, region, bodyRegion);
+ Destructor destructor = new Destructor (c, c.Name,
destructorDeclaration.Modifiers.Code, region, bodyRegion);
+
+ FillAttributes (destructor,
destructorDeclaration.Attributes);
+
c.Methods.Add(destructor);
return null;
}
-
+ // No attributes?
public override object Visit(AST.FieldDeclaration
fieldDeclaration, object data)
{
DefaultRegion region =
GetRegion(fieldDeclaration.StartLocation, fieldDeclaration.EndLocation);
@@ -202,11 +243,12 @@
}
if (currentClass.Count > 0) {
foreach (AST.VariableDeclaration field in
fieldDeclaration.Fields) {
- Field f = new Field(type, field.Name,
fieldDeclaration.Modifier, region);
-
+ Field f = new Field (c, type,
field.Name, fieldDeclaration.Modifiers.Code, region);
c.Fields.Add(f);
+ FillAttributes (f,
fieldDeclaration.Attributes);
}
}
+
return null;
}
@@ -218,7 +260,15 @@
ReturnType type = new
ReturnType(propertyDeclaration.TypeReference);
Class c = (Class)currentClass.Peek();
- Property property = new
Property(propertyDeclaration.Name, type, propertyDeclaration.Modifier, region,
bodyRegion);
+ Property property = new Property (c,
propertyDeclaration.Name, type, propertyDeclaration.Modifiers.Code, region,
bodyRegion);
+
+ FillAttributes (property,
propertyDeclaration.Attributes);
+
+ if (propertyDeclaration.HasGetRegion)
+ property.GetterRegion = GetRegion
(propertyDeclaration.GetRegion.StartLocation,
propertyDeclaration.GetRegion.EndLocation);
+ if (propertyDeclaration.HasSetRegion)
+ property.SetterRegion = GetRegion
(propertyDeclaration.SetRegion.StartLocation,
propertyDeclaration.SetRegion.EndLocation);
+
c.Properties.Add(property);
return null;
}
@@ -233,11 +283,13 @@
if (eventDeclaration.VariableDeclarators != null) {
foreach
(ICSharpCode.SharpRefactory.Parser.AST.VariableDeclaration varDecl in
eventDeclaration.VariableDeclarators) {
- e = new Event(varDecl.Name, type,
eventDeclaration.Modifier, region, bodyRegion);
+ e = new Event (c, varDecl.Name, type,
eventDeclaration.Modifiers.Code, region, bodyRegion);
+ FillAttributes (e,
eventDeclaration.Attributes);
c.Events.Add(e);
}
} else {
- e = new Event(eventDeclaration.Name, type,
eventDeclaration.Modifier, region, bodyRegion);
+ e = new Event (c, eventDeclaration.Name, type,
eventDeclaration.Modifiers.Code, region, bodyRegion);
+ FillAttributes (e, eventDeclaration.Attributes);
c.Events.Add(e);
}
return null;
@@ -248,15 +300,16 @@
DefaultRegion region =
GetRegion(indexerDeclaration.StartLocation, indexerDeclaration.EndLocation);
DefaultRegion bodyRegion =
GetRegion(indexerDeclaration.BodyStart, indexerDeclaration.BodyEnd);
ParameterCollection parameters = new
ParameterCollection();
- Indexer i = new Indexer(new
ReturnType(indexerDeclaration.TypeReference), parameters,
indexerDeclaration.Modifier, region, bodyRegion);
+ Class c = (Class)currentClass.Peek();
+ Indexer i = new Indexer (c, new
ReturnType(indexerDeclaration.TypeReference), parameters,
indexerDeclaration.Modifiers.Code, region, bodyRegion);
if (indexerDeclaration.Parameters != null) {
foreach (AST.ParameterDeclarationExpression par
in indexerDeclaration.Parameters) {
ReturnType parType = new
ReturnType(par.TypeReference);
- Parameter p = new
Parameter(par.ParameterName, parType);
+ Parameter p = new Parameter (i,
par.ParameterName, parType);
parameters.Add(p);
}
}
- Class c = (Class)currentClass.Peek();
+ FillAttributes (i, indexerDeclaration.Attributes);
c.Indexer.Add(i);
return null;
}
Added: trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/CodeGenerator.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -0,0 +1,161 @@
+//
+// CodeGenerator.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using Microsoft.CSharp;
+using System.IO;
+using MonoDevelop.Projects.Parser;
+using MonoDevelop.Projects.Text;
+using MonoDevelop.Projects.CodeGeneration;
+using ICSharpCode.SharpRefactory.Parser;
+using ICSharpCode.SharpRefactory.Parser.AST;
+using System.Drawing;
+
+namespace CSharpBinding.Parser
+{
+ class CSharpRefactorer: BaseRefactorer
+ {
+ CSharpCodeProvider csharpProvider = new CSharpCodeProvider ();
+
+ public override RefactorOperations SupportedOperations {
+ get { return RefactorOperations.All; }
+ }
+
+ protected override ICodeGenerator GetGenerator ()
+ {
+ return csharpProvider.CreateGenerator ();
+ }
+
+ public override void RenameField (IRefactorerContext ctx,
IClass cls, IField field, string newName)
+ {
+ IEditableTextFile file = ctx.GetFile
(cls.Region.FileName);
+ if (file == null)
+ return;
+
+ int pos1 = file.GetPositionFromLineColumn
(field.Region.BeginLine, field.Region.BeginColumn);
+ int pos2 = file.GetPositionFromLineColumn
(field.Region.EndLine, field.Region.EndColumn);
+ string txt = file.GetText (pos1, pos2);
+ Console.WriteLine ("TXT:[" + txt + "]");
+ int i = txt.IndexOf ('=');
+ if (i == -1) i = txt.Length;
+ int p = txt.LastIndexOf (field.Name, i);
+ if (p == -1)
+ return;
+
+ string newTxt = txt.Substring (0, p) + newName +
txt.Substring (p + field.Name.Length);
+ file.DeleteText (pos1, txt.Length);
+ file.InsertText (pos1, newTxt);
+ }
+
+ public override void RenameFieldReferences (IRefactorerContext
ctx, string fileName, IClass cls, IField field, string newName)
+ {
+ Resolver resolver = new Resolver (ctx.ParserContext);
+ MemberRefactoryVisitor visitor = new
MemberRefactoryVisitor (resolver, cls.FullyQualifiedName, field.Name, newName);
+ Console.WriteLine ("Checking " + fileName);
+
+ IEditableTextFile file = ctx.GetFile (fileName);
+ visitor.Visit (ctx.ParserContext, file);
+ }
+ }
+
+ class MemberRefactoryVisitor: AbstractASTVisitor
+ {
+ string className;
+ string memberName;
+ string newName;
+ Resolver resolver;
+ IEditableTextFile file;
+ string fileContent;
+ CompilationUnit fileCompilationUnit;
+
+ public MemberRefactoryVisitor (Resolver resolver, string
className, string memberName, string newName)
+ {
+ this.resolver = resolver;
+ this.className = className;
+ this.newName = newName;
+ this.memberName = memberName;
+ }
+
+ public void Visit (IParserContext pctx, IEditableTextFile file)
+ {
+ this.file = file;
+ this.fileContent = file.Text;
+
+ IParseInformation pi = pctx.ParseFile (file);
+
+ fileCompilationUnit = pi.MostRecentCompilationUnit.Tag
as CompilationUnit;
+ if (fileCompilationUnit != null)
+ Visit (fileCompilationUnit, null);
+ else
+ Console.WriteLine ("No parse info");
+ }
+
+ public override object Visit (FieldReferenceExpression
fieldExp, object data)
+ {
+ if (fieldExp.FieldName == memberName)
+ {
+ IClass cls = resolver.ResolveExpressionType
(fileCompilationUnit, fieldExp.TargetObject, fieldExp.StartLocation.Y,
fieldExp.StartLocation.X);
+ if (cls != null && cls.FullyQualifiedName ==
className) {
+ Console.WriteLine ("Found field in " +
file.Name + " " + fieldExp.StartLocation + " - " + fieldExp.EndLocation);
+ int pos =
file.GetPositionFromLineColumn (fieldExp.StartLocation.Y,
fieldExp.StartLocation.X);
+ string txt = file.GetText (pos, pos +
memberName.Length);
+ if (txt == memberName) {
+ file.DeleteText (pos,
memberName.Length);
+ file.InsertText (pos, newName);
+ }
+ }
+
+ }
+ return base.Visit (fieldExp, data);
+ }
+
+ public override object Visit (IdentifierExpression idExp,
object data)
+ {
+ if (idExp.Identifier == memberName)
+ {
+ ILanguageItem item = resolver.ResolveIdentifier
(fileCompilationUnit, idExp.Identifier, idExp.StartLocation.Y,
idExp.StartLocation.X);
+ if (item is IField) {
+ IField f = (IField) item;
+ if (f.DeclaringType.FullyQualifiedName
== className) {
+ Console.WriteLine ("DC:" +
f.DeclaringType);
+ Console.WriteLine ("Found field
in " + f.Name + " " + idExp.StartLocation + " - " + idExp.EndLocation);
+ int pos =
file.GetPositionFromLineColumn (idExp.StartLocation.Y, idExp.StartLocation.X);
+ string txt = file.GetText (pos,
pos + memberName.Length);
+ if (txt == memberName) {
+ file.DeleteText (pos,
memberName.Length);
+ file.InsertText (pos,
newName);
+ }
+ }
+ }
+ }
+ return base.Visit (idExp, data);
+ }
+ }
+}
Modified: trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs 2005-12-13
14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs 2005-12-13
14:38:50 UTC (rev 54286)
@@ -36,10 +36,6 @@
{
return System.IO.Path.GetExtension(fileName).ToUpper()
== ".CS";
}
- public bool CanParse(Project project)
- {
- return project.ProjectType == "C#";
- }
void RetrieveRegions(CompilationUnit cu, SpecialTracker tracker)
{
Modified: trunk/monodevelop/Extras/CSharpBinding/Parser/Resolver.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/Resolver.cs 2005-12-13
14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/Resolver.cs 2005-12-13
14:38:50 UTC (rev 54286)
@@ -156,7 +156,40 @@
Console.WriteLine("Here: Type is " +
type.FullyQualifiedName);
return type;
}
+
+ public IClass ResolveExpressionType
(ICSharpCode.SharpRefactory.Parser.AST.CompilationUnit fileCompilationUnit,
Expression expr, int line, int col)
+ {
+ CSharpVisitor cSharpVisitor = new CSharpVisitor();
+ cu =
(ICompilationUnit)cSharpVisitor.Visit(fileCompilationUnit, null);
+
+ this.caretLine = line;
+ this.caretColumn = col;
+
+ callingClass = GetInnermostClass();
+
+ lookupTableVisitor = new LookupTableVisitor();
+ lookupTableVisitor.Visit (fileCompilationUnit, null);
+ TypeVisitor typeVisitor = new TypeVisitor (this);
+ IReturnType type = expr.AcceptVisitor (typeVisitor,
null) as IReturnType;
+ return SearchType (type.FullyQualifiedName, cu);
+ }
+ public ILanguageItem ResolveIdentifier
(ICSharpCode.SharpRefactory.Parser.AST.CompilationUnit fileCompilationUnit,
string id, int line, int col)
+ {
+ CSharpVisitor cSharpVisitor = new CSharpVisitor();
+ cu =
(ICompilationUnit)cSharpVisitor.Visit(fileCompilationUnit, null);
+
+ this.caretLine = line;
+ this.caretColumn = col;
+
+ callingClass = GetInnermostClass();
+
+ lookupTableVisitor = new LookupTableVisitor();
+ lookupTableVisitor.Visit (fileCompilationUnit, null);
+
+ return IdentifierLookup (id);
+ }
+
public string MonodocResolver (string expression, int
caretLineNumber, int caretColumn, string fileName, string fileContent)
{
if (expression == null) {
@@ -280,6 +313,7 @@
// Console.WriteLine("Member added");
}
}
+
foreach (IEvent e in curType.Events) {
if (MustBeShowen(curType, e)) {
members.Add(e);
@@ -429,74 +463,105 @@
}
// no methods or indexer
- public IReturnType SearchMember(IReturnType type, string
memberName)
+ public IReturnType SearchMember (IReturnType type, string
memberName)
{
- if (type == null || memberName == null || memberName ==
"") {
+ IClass curType;
+ IDecoration member;
+
+ if (!SearchClassMember (type, memberName, false, out
curType, out member))
return null;
+
+ if (member is IField) {
+ if (curType.ClassType == ClassType.Enum)
+ return type; // enum members have the
type of the enum
+ else
+ return ((IField)member).ReturnType;
}
-// Console.WriteLine("searching member {0} in {1}",
memberName, type.Name);
- IClass curType = SearchType(type.FullyQualifiedName,
cu);
- if (curType == null) {
-// Console.WriteLine("Type not found in
SearchMember");
- return null;
+ else if (member is IClass) {
+ return new ReturnType
(((IClass)member).FullyQualifiedName);
}
- if (type.PointerNestingLevel != 0) {
- return null;
+ else if (member is IProperty) {
+ return ((IProperty)member).ReturnType;
}
- if (type.ArrayDimensions != null &&
type.ArrayDimensions.Length > 0) {
+ else if (member is IEvent) {
+ return ((IEvent)member).ReturnType;
+ }
+
+ throw new InvalidOperationException ("Unknown member
type:" + member);
+ }
+
+ // no methods or indexer
+ bool SearchClassMember (IReturnType type, string memberName,
bool includeMethods, out IClass curType, out IDecoration member)
+ {
+ curType = null;
+ member = null;
+
+ if (type == null || memberName == null || memberName ==
"")
+ return false;
+
+ curType = SearchType (type.FullyQualifiedName, cu);
+ if (curType == null)
+ return false;
+
+ if (type.PointerNestingLevel != 0)
+ return false;
+
+ if (type.ArrayDimensions != null &&
type.ArrayDimensions.Length > 0)
curType = SearchType("System.Array", null);
- }
+
if (curType.ClassType == ClassType.Enum) {
foreach (IField f in curType.Fields) {
if (f.Name == memberName &&
MustBeShowen(curType, f)) {
showStatic = false;
- return type; // enum members
have the type of the enum
+ member = f; // enum members
have the type of the enum
+ return true;
}
}
}
if (showStatic) {
-// Console.WriteLine("showStatic == true");
foreach (IClass c in curType.InnerClasses) {
if (c.Name == memberName &&
IsAccessible(curType, c)) {
- return new
ReturnType(c.FullyQualifiedName);
+ member = c;
+ return true;
}
}
}
-// Console.WriteLine("#Properties " +
curType.Properties.Count);
foreach (IProperty p in curType.Properties) {
-// Console.WriteLine("checke Property " + p.Name);
-// Console.WriteLine("member name " + memberName);
if (p.Name == memberName &&
MustBeShowen(curType, p)) {
-// Console.WriteLine("Property found " +
p.Name);
showStatic = false;
- return p.ReturnType;
+ member = p;
+ return true;
}
}
foreach (IField f in curType.Fields) {
-// Console.WriteLine("checke Feld " + f.Name);
-// Console.WriteLine("member name " + memberName);
if (f.Name == memberName &&
MustBeShowen(curType, f)) {
-// Console.WriteLine("Field found " +
f.Name);
showStatic = false;
- return f.ReturnType;
+ member = f;
+ return true;
}
}
foreach (IEvent e in curType.Events) {
if (e.Name == memberName &&
MustBeShowen(curType, e)) {
showStatic = false;
- return e.ReturnType;
+ member = e;
+ return true;
}
}
- foreach (string baseType in curType.BaseTypes) {
- IClass c = parserContext.GetClass (baseType,
true, true);
- if (c != null) {
- IReturnType erg = SearchMember(new
ReturnType(c.FullyQualifiedName), memberName);
- if (erg != null) {
- return erg;
+ if (includeMethods) {
+ foreach (IMethod m in curType.Methods) {
+ if (m.Name == memberName &&
MustBeShowen(curType, m)) {
+ showStatic = false;
+ member = m;
+ return true;
}
}
}
- return null;
+ foreach (string baseType in curType.BaseTypes) {
+ IClass c = parserContext.GetClass (baseType,
true, true);
+ if (c != null)
+ return SearchClassMember (new
ReturnType(c.FullyQualifiedName), memberName, includeMethods, out curType, out
member);
+ }
+ return false;
}
bool IsInside(Point between, Point start, Point end)
@@ -529,10 +594,10 @@
//
// Console.WriteLine("LookUpTable has {0} entries",
lookupTableVisitor.variables.Count);
// Console.WriteLine("Listing Variables:");
- IDictionaryEnumerator enumerator =
lookupTableVisitor.variables.GetEnumerator();
- while (enumerator.MoveNext()) {
- Console.WriteLine(enumerator.Key);
- }
+// IDictionaryEnumerator enumerator =
lookupTableVisitor.variables.GetEnumerator();
+// while (enumerator.MoveNext()) {
+// Console.WriteLine(enumerator.Key);
+// }
// Console.WriteLine("end listing");
ArrayList variables =
(ArrayList)lookupTableVisitor.variables[name];
if (variables == null || variables.Count <= 0) {
@@ -557,6 +622,69 @@
}
/// <remarks>
+ /// does the dynamic lookup for the id
+ /// </remarks>
+ ILanguageItem IdentifierLookup (string id)
+ {
+ Console.WriteLine ("IdentifierLookup: " + id);
+ // try if it exists a variable named id
+ ReturnType variable = SearchVariable (id);
+ if (variable != null) {
+ return new LocalVariable (id, variable, "");
+ }
+
+ if (callingClass == null) {
+ Console.WriteLine ("callingClass null");
+ return null;
+ }
+
+ //// somehow search in callingClass fields is not
returning anything, so I am searching here once again
+ foreach (IField f in callingClass.Fields) {
+ if (f.Name == id) {
+ return f;
+ }
+ }
+
+ // try if typeName is a method parameter
+ IParameter p = SearchMethodParameter (id);
+ if (p != null) {
+ return p;
+ }
+
+ // check if typeName == value in set method of a
property
+ if (id == "value") {
+ IProperty pr = SearchProperty();
+ if (pr != null) {
+ return pr;
+ }
+ }
+
+ // try if there exists a nonstatic member named typeName
+ showStatic = false;
+ IClass cls;
+ IDecoration member;
+ if (SearchClassMember (callingClass == null ? null :
new ReturnType(callingClass.FullyQualifiedName), id, true, out cls, out
member)) {
+ return member;
+ }
+
+ // try if there exists a static member named typeName
+ showStatic = true;
+ if (SearchClassMember (callingClass == null ? null :
new ReturnType(callingClass.FullyQualifiedName), id, true, out cls, out
member)) {
+ showStatic = false;
+ return member;
+ }
+
+ // try if there exists a static member in outer classes
named typeName
+ foreach (IClass c in GetOuterClasses()) {
+ if (SearchClassMember (callingClass == null ?
null : new ReturnType(c.FullyQualifiedName), id, true, out cls, out member)) {
+ showStatic = false;
+ return member;
+ }
+ }
+ return null;
+ }
+
+ /// <remarks>
/// does the dynamic lookup for the typeName
/// </remarks>
public IReturnType DynamicLookup(string typeName)
@@ -585,20 +713,20 @@
//// end of mod for search in Fields
// try if typeName is a method parameter
- IReturnType p = SearchMethodParameter(typeName);
+ IParameter p = SearchMethodParameter(typeName);
if (p != null) {
// Console.WriteLine("MethodParameter Found");
showStatic = false;
- return p;
+ return p.ReturnType;
}
// Console.WriteLine("No Parameter found");
// check if typeName == value in set method of a
property
if (typeName == "value") {
- p = SearchProperty();
- if (p != null) {
+ IProperty pr = SearchProperty();
+ if (pr != null) {
showStatic = false;
- return p;
+ return pr.ReturnType;
}
}
// Console.WriteLine("No Property found");
@@ -653,29 +781,27 @@
return null;
}
- IReturnType SearchProperty()
+ IProperty SearchProperty ()
{
IProperty property = GetProperty();
if (property == null) {
return null;
}
if (property.SetterRegion != null &&
property.SetterRegion.IsInside(caretLine, caretColumn)) {
- return property.ReturnType;
+ return property;
}
return null;
}
- IReturnType SearchMethodParameter(string parameter)
+ IParameter SearchMethodParameter(string parameter)
{
IMethod method = GetMethod();
if (method == null) {
- Console.WriteLine("Method not found");
return null;
}
foreach (IParameter p in method.Parameters) {
if (p.Name == parameter) {
- Console.WriteLine("Parameter found");
- return p.ReturnType;
+ return p;
}
}
return null;
@@ -782,7 +908,7 @@
{
if (cu != null) {
foreach (IClass c in cu.Classes) {
- if (c != null && c.Region != null &&
c.Region.IsInside(caretLine, caretColumn)) {
+ if (c != null && c.Region != null &&
c.BodyRegion.IsInside(caretLine, caretColumn)) {
return GetInnermostClass(c);
}
}
@@ -799,7 +925,7 @@
return GetResolvedClass (curClass);
}
foreach (IClass c in curClass.InnerClasses) {
- if (c != null && c.Region != null &&
c.Region.IsInside(caretLine, caretColumn)) {
+ if (c != null && c.Region != null &&
c.BodyRegion.IsInside(caretLine, caretColumn)) {
return GetInnermostClass(c);
}
}
@@ -817,7 +943,7 @@
ClassCollection classes = new ClassCollection();
if (cu != null) {
foreach (IClass c in cu.Classes) {
- if (c != null && c.Region != null &&
c.Region.IsInside(caretLine, caretColumn)) {
+ if (c != null && c.Region != null &&
c.BodyRegion.IsInside(caretLine, caretColumn)) {
if (c != GetInnermostClass()) {
GetOuterClasses(classes, c);
classes.Add(GetResolvedClass (c));
@@ -834,7 +960,7 @@
{
if (curClass != null) {
foreach (IClass c in curClass.InnerClasses) {
- if (c != null && c.Region != null &&
c.Region.IsInside(caretLine, caretColumn)) {
+ if (c != null && c.Region != null &&
c.BodyRegion.IsInside(caretLine, caretColumn)) {
if (c != GetInnermostClass()) {
GetOuterClasses(classes, c);
classes.Add(GetResolvedClass (c));
@@ -930,7 +1056,7 @@
if (variables != null && variables.Count > 0) {
foreach (LocalLookupVariable v in
variables) {
if (IsInside(new
Point(caretColumn, caretLine), v.StartPos, v.EndPos)) {
- result.Add(new
Parameter (name, new ReturnType (v.TypeRef.SystemType)));
+ result.Add(new
Parameter (null, name, new ReturnType (v.TypeRef.SystemType)));
break;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/AttributeSection.cs
===================================================================
---
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/AttributeSection.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/AttributeSection.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -7,19 +7,20 @@
{
public class AttributeSection : AbstractAttributeSection
{
- public AttributeSection(AttributeTarget attributeTarget,
- AttributeCollection attributes) {
+ public AttributeSection(AttributeTarget attributeTarget,
IRegion region)
+ {
this.attributeTarget = attributeTarget;
- this.attributes = attributes;
+ this.region = region;
}
}
- public class ASTAttribute : AbstractAttribute
+ public class Attribute : AbstractAttribute
{
- public ASTAttribute(string name, ArrayList positionalArguments,
SortedList namedArguments)
+ public Attribute(string name, ArrayList positionalArguments,
SortedList namedArguments, IRegion region)
{
this.name = name;
this.positionalArguments = positionalArguments;
this.namedArguments = namedArguments;
+ this.region = region;
}
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Class.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Class.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Class.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,11 +12,12 @@
{
ICompilationUnit cu;
- public Class(CompilationUnit cu, ClassType t, Modifier m,
IRegion region)
+ public Class(CompilationUnit cu, ClassType t, ModifierFlags m,
IRegion region, IRegion bodyRegion)
{
this.cu = cu;
classType = t;
this.region = region;
+ this.bodyRegion = bodyRegion;
modifiers = (ModifierEnum)m;
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Constructor.cs
===================================================================
---
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Constructor.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Constructor.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,11 +12,12 @@
modifiers = modifiers | m;
}
- public Constructor(Modifier m, IRegion region, IRegion
bodyRegion)
+ public Constructor (IClass declaringType, ModifierFlags m,
IRegion region, IRegion bodyRegion)
{
FullyQualifiedName = "ctor";
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Destructor.cs
===================================================================
---
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Destructor.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Destructor.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -11,11 +11,12 @@
modifiers = modifiers | m;
}
- public Destructor(string className, Modifier m, IRegion region,
IRegion bodyRegion)
+ public Destructor (IClass declaringType, string className,
ModifierFlags m, IRegion region, IRegion bodyRegion)
{
FullyQualifiedName = "~" + className;
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Event.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Event.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Event.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,12 +12,13 @@
modifiers = modifiers | m;
}
- public Event(string name, ReturnType type, Modifier m, IRegion
region, IRegion bodyRegion)
+ public Event (IClass declaringType, string name, ReturnType
type, ModifierFlags m, IRegion region, IRegion bodyRegion)
{
FullyQualifiedName = name;
returnType = type;
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Field.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Field.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Field.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,11 +12,12 @@
modifiers = modifiers | m;
}
- public Field(ReturnType type, string fullyQualifiedName,
Modifier m, IRegion region)
+ public Field (IClass declaringType, ReturnType type, string
fullyQualifiedName, ModifierFlags m, IRegion region)
{
this.returnType = type;
this.FullyQualifiedName = fullyQualifiedName;
this.region = region;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Indexer.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Indexer.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Indexer.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,12 +12,13 @@
modifiers = modifiers | m;
}
- public Indexer(ReturnType type, ParameterCollection parameters,
Modifier m, IRegion region, IRegion bodyRegion)
+ public Indexer (IClass declaringType, ReturnType type,
ParameterCollection parameters, ModifierFlags m, IRegion region, IRegion
bodyRegion)
{
returnType = type;
this.parameters = parameters;
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Method.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Method.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Method.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,12 +12,13 @@
modifiers = modifiers | m;
}
- public Method(string name, ReturnType type, Modifier m, IRegion
region, IRegion bodyRegion)
+ public Method (IClass declaringType, string name, ReturnType
type, ModifierFlags m, IRegion region, IRegion bodyRegion)
{
FullyQualifiedName = name;
returnType = type;
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Parameter.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Parameter.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Parameter.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,10 +6,11 @@
{
public class Parameter : AbstractParameter
{
- public Parameter(string name, ReturnType type)
+ public Parameter (IMember declaringMember, string name,
ReturnType type)
{
this.name = name;
returnType = type;
+ this.declaringMember = declaringMember;
}
}
}
Modified:
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Property.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Property.cs
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/Property.cs
2005-12-13 14:38:50 UTC (rev 54286)
@@ -12,13 +12,24 @@
modifiers = modifiers | m;
}
- public Property(string fullyQualifiedName, ReturnType type,
Modifier m, IRegion region, IRegion bodyRegion)
+ public Property (IClass declaringType, string
fullyQualifiedName, ReturnType type, ModifierFlags m, IRegion region, IRegion
bodyRegion)
{
this.FullyQualifiedName = fullyQualifiedName;
returnType = type;
this.region = region;
this.bodyRegion = bodyRegion;
+ this.declaringType = declaringType;
modifiers = (ModifierEnum)m;
}
+
+ public new IRegion GetterRegion {
+ get { return getterRegion; }
+ set { getterRegion = value; }
+ }
+
+ public new IRegion SetterRegion {
+ get { return setterRegion; }
+ set { setterRegion = value; }
+ }
}
}
Modified: trunk/monodevelop/Extras/CSharpBinding/templates/AppConfigFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/AppConfigFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/AppConfigFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -5,7 +5,7 @@
<_Name>Application Configuration File</_Name>
<Icon>md-text-file-icon</Icon>
<Category>Misc</Category>
- <LanguageName>XML</LanguageName>
+ <ProjectType>DotNet</ProjectType>
<_Description>Creates a .NET application configuration
file.</_Description>
</TemplateConfiguration>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyCSharpFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/EmptyCSharpFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/EmptyCSharpFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -4,7 +4,7 @@
<TemplateConfiguration>
<_Name>Empty File</_Name>
<Icon>res:C#.File.EmptyFile</Icon>
- <Category>C#</Category>
+ <Category>General</Category>
<LanguageName>C#</LanguageName>
<_Description>Creates an empty C# file.</_Description>
</TemplateConfiguration>
Modified: trunk/monodevelop/Extras/CSharpBinding/templates/EmptyHTMLFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/EmptyHTMLFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/EmptyHTMLFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -4,8 +4,7 @@
<TemplateConfiguration>
<_Name>Empty HTML File</_Name>
<Icon>md-html-file-icon</Icon>
- <Category>Misc</Category>
- <LanguageName>HTML</LanguageName>
+ <Category>Web</Category>
<_Description>Creates an empty HTML file.</_Description>
</TemplateConfiguration>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/EmptyResourceFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/EmptyResourceFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/EmptyResourceFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -5,7 +5,7 @@
<_Name>Empty Resource File</_Name>
<Icon>md-resource-file-icon</Icon>
<Category>Misc</Category>
- <LanguageName>ResourceFiles</LanguageName>
+ <ProjectType>DotNet</ProjectType>
<_Description>Creates an empty resource file.</_Description>
</TemplateConfiguration>
Modified: trunk/monodevelop/Extras/CSharpBinding/templates/EmptyTextFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/EmptyTextFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/EmptyTextFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -5,7 +5,6 @@
<_Name>Empty Text File</_Name>
<Icon>md-text-file-icon</Icon>
<Category>Misc</Category>
- <LanguageName>Default</LanguageName>
<_Description>Creates an empty text file.</_Description>
</TemplateConfiguration>
Modified: trunk/monodevelop/Extras/CSharpBinding/templates/EmptyXMLFile.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/EmptyXMLFile.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/EmptyXMLFile.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -4,8 +4,7 @@
<TemplateConfiguration>
<_Name>Empty XML File</_Name>
<Icon>md-xml-file-icon</Icon>
- <Category>Misc</Category>
- <LanguageName>XML</LanguageName>
+ <Category>XML</Category>
<_Description>Creates an empty XML file.</_Description>
</TemplateConfiguration>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharp2Project.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharp2Project.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharp2Project.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Glade# 2.0 Project</_Name>
- <Category>C#</Category>
+ <Category>Glade</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>a Glade# 2.0 project with one window and
button</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharpProject.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharpProject.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GladeSharpProject.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Glade# Project</_Name>
- <Category>C#</Category>
+ <Category>Glade</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>a Glade# project with one window and
button</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharp2Project.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharp2Project.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharp2Project.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Gnome# 2.0 Project</_Name>
- <Category>C#</Category>
+ <Category>Gnome</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>Creates a Gnome# 2.0 project</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProgram.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProgram.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProgram.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -5,7 +5,7 @@
<TemplateConfiguration>
<_Name>Gnome# Program</_Name>
<Icon>res:C#.File.Form</Icon>
- <Category>C#</Category>
+ <Category>Gnome</Category>
<LanguageName>C#</LanguageName>
<_Description>Creates a Gnome# program.</_Description>
</TemplateConfiguration>
@@ -16,9 +16,9 @@
using System;
using Gnome;
-namespace MyProgram
+namespace ${Namespace}
{
- public class CreatedProgram : Program
+ public class ${Name} : Program
{
public CreatedProgram (string[] args) : base ("ChangeMe",
"0.1", Gnome.Modules.Info, args)
{
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProject.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProject.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GnomeSharpProject.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Gnome# Project</_Name>
- <Category>C#</Category>
+ <Category>Gnome</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>Creates a Gnome# project</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharp2Project.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharp2Project.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharp2Project.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Gtk# 2.0 Project</_Name>
- <Category>C#</Category>
+ <Category>Gtk</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>Creates a Gtk# 2.0 project.</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpProject.xpt.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpProject.xpt.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpProject.xpt.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -6,7 +6,7 @@
<!-- Template Header -->
<TemplateConfiguration>
<_Name>Gtk# Project</_Name>
- <Category>C#</Category>
+ <Category>Gtk</Category>
<Icon>res:C#.Project.Form</Icon>
<LanguageName>C#</LanguageName>
<_Description>Creates a Gtk# project.</_Description>
Modified:
trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpWindow.xft.xml
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpWindow.xft.xml
2005-12-13 14:38:32 UTC (rev 54285)
+++ trunk/monodevelop/Extras/CSharpBinding/templates/GtkSharpWindow.xft.xml
2005-12-13 14:38:50 UTC (rev 54286)
@@ -5,7 +5,7 @@
<TemplateConfiguration>
<_Name>Gtk# Window</_Name>
<Icon>res:C#.File.Form</Icon>
- <Category>C#</Category>
+ <Category>Gtk</Category>
<LanguageName>C#</LanguageName>
<_Description>Creates a top-level Gtk# window.</_Description>
</TemplateConfiguration>
@@ -17,11 +17,11 @@
using Gtk;
using GtkSharp;
-namespace MyWindow
+namespace ${Namespace}
{
- public class CreatedWindow : Window
+ public class ${Name} : Window
{
- public CreatedWindow () : base ("MyWindow")
+ public ${Name} () : base ("MyWindow")
{
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches