diff --git a/src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs b/src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs
index 1eeba16840..29bbfa361c 100644
--- a/src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs
@@ -125,7 +125,6 @@ namespace SharpRefactoring
otherReturnValues.Add(new VariableDeclaration(variable.Name, variable.Initializer, variable.TypeRef));
}
-
FindReferenceVisitor frv = new FindReferenceVisitor(true, variable.Name, start, end);
parentNode.AcceptVisitor(frv, null);
diff --git a/src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs b/src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs
index e640723683..e1fe90c703 100644
--- a/src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs
@@ -5,7 +5,6 @@
// $Revision$
//
-using ICSharpCode.TextEditor;
using System;
using System.Collections.Generic;
using System.IO;
@@ -20,6 +19,7 @@ using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Refactoring;
+using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using SharpRefactoring.Forms;
using SharpRefactoring.Transformers;
@@ -54,11 +54,11 @@ namespace SharpRefactoring
MethodExtractorBase GetCurrentExtractor(TextEditorControl editor)
{
- switch (ProjectService.CurrentProject.Language) {
+ switch (LanguageBindingService.GetCodonPerCodeFileName(editor.FileName).Language) {
case "C#":
return new CSharpMethodExtractor(editor, editor.ActiveTextAreaControl.SelectionManager.SelectionCollection[0]);
default:
- MessageService.ShowError(string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.ExtractMethodNotSupported}"), ProjectService.CurrentProject.Language));
+ MessageService.ShowError(string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.ExtractMethodNotSupported}"), LanguageBindingService.GetCodonPerCodeFileName(editor.FileName).Language));
return null;
}
}
diff --git a/src/AddIns/Misc/SharpRefactoring/Src/Forms/ExtractMethodForm.cs b/src/AddIns/Misc/SharpRefactoring/Src/Forms/ExtractMethodForm.cs
index f89013bcbf..ae54c52e69 100644
--- a/src/AddIns/Misc/SharpRefactoring/Src/Forms/ExtractMethodForm.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Src/Forms/ExtractMethodForm.cs
@@ -8,8 +8,11 @@
*/
using System;
+using System.Collections.Generic;
using System.Drawing;
+using System.Linq;
using System.Windows.Forms;
+
using ICSharpCode.Core;
namespace SharpRefactoring.Forms
@@ -54,9 +57,11 @@ namespace SharpRefactoring.Forms
string afterName = text.Substring(text.IndexOf('('));
- string type = text.Split(' ')[0];
+ List list = text.Split(' ').ToList();
+
+ list.RemoveAt(list.Count - 1);
- this.txtPreview.Text = type + " " + this.txtName.Text + afterName;
+ this.txtPreview.Text = string.Join(" ", list.ToArray()) + " " + this.txtName.Text + afterName;
}
}
}
diff --git a/src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs b/src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs
index 910961b0f8..79dcbd6ed9 100644
--- a/src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs
+++ b/src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs
@@ -64,7 +64,7 @@ namespace SharpRefactoring
Statement caller;
InvocationExpression expr = new InvocationExpression(new IdentifierExpression(method.Name), CreateArgumentExpressions(method.Parameters));
- if (method.TypeReference.Type != "void") {
+ if (method.TypeReference.Type != "System.Void") {
if (parent is MethodDeclaration) {
if (method.TypeReference == (parent as MethodDeclaration).TypeReference)
caller = new ReturnStatement(expr);
@@ -100,7 +100,7 @@ namespace SharpRefactoring
newMethod.Body.Children.Add(new ReturnStatement(new IdentifierExpression(possibleReturnValues[possibleReturnValues.Count - 1].Name)));
this.returnedVariable = possibleReturnValues[possibleReturnValues.Count - 1];
} else {
- newMethod.TypeReference = new TypeReference("void");
+ newMethod.TypeReference = new TypeReference("System.Void", true);
this.returnedVariable = null;
}
}