Browse Source

- fixed crash in ExtractedMethod, when extracting code with params parameters

- always close undo group, even if extraction causes exception

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@4005 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 16 years ago
parent
commit
e77cd497e9
  1. 2
      src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs
  2. 13
      src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs
  3. 2
      src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs

2
src/AddIns/Misc/SharpRefactoring/Src/CSharpMethodExtractor.cs

@ -88,6 +88,8 @@ namespace SharpRefactoring @@ -88,6 +88,8 @@ namespace SharpRefactoring
{
FindReferenceVisitor frv = new FindReferenceVisitor(CSharpNameComparer, pde.ParameterName, newMethod.Body.StartLocation, newMethod.Body.EndLocation);
pde.ParamModifier &= ~(ParameterModifiers.Params);
newMethod.AcceptVisitor(frv, null);
if (frv.Identifiers.Count > 0) {

13
src/AddIns/Misc/SharpRefactoring/Src/ExtractMethodCommand.cs

@ -40,11 +40,14 @@ namespace SharpRefactoring @@ -40,11 +40,14 @@ namespace SharpRefactoring
if (form.ShowDialog() == DialogResult.OK) {
extractor.ExtractedMethod.Name = form.Text;
textEditor.Document.UndoStack.StartUndoGroup();
extractor.InsertAfterCurrentMethod();
extractor.InsertCall();
textEditor.Document.FormattingStrategy.IndentLines(textEditor.ActiveTextAreaControl.TextArea, 0, textEditor.Document.TotalNumberOfLines - 1);
textEditor.Document.UndoStack.EndUndoGroup();
try {
textEditor.Document.UndoStack.StartUndoGroup();
extractor.InsertAfterCurrentMethod();
extractor.InsertCall();
textEditor.Document.FormattingStrategy.IndentLines(textEditor.ActiveTextAreaControl.TextArea, 0, textEditor.Document.TotalNumberOfLines - 1);
} finally {
textEditor.Document.UndoStack.EndUndoGroup();
}
textEditor.ActiveTextAreaControl.SelectionManager.ClearSelection();
}
}

2
src/AddIns/Misc/SharpRefactoring/Src/MethodExtractorBase.cs

@ -188,7 +188,7 @@ namespace SharpRefactoring @@ -188,7 +188,7 @@ namespace SharpRefactoring
foreach (ParameterDeclarationExpression pde in parameters)
{
expressions.Add(new DirectionExpression(
(FieldDirection)Enum.Parse(typeof(FieldDirection),pde.ParamModifier.ToString()),
(FieldDirection)Enum.Parse(typeof(FieldDirection), pde.ParamModifier.ToString()),
new IdentifierExpression(pde.ParameterName)));
}

Loading…
Cancel
Save