From a33b8d111f92f9eedcbab47bf2e50e7a9d29c922 Mon Sep 17 00:00:00 2001 From: Emanuel Graf Date: Wed, 12 Nov 2008 12:46:30 +0000 Subject: [PATCH] remove side effect of findInsertLocation() --- .../implementmethod/ImplementMethodRefactoring.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java index 9d9b59baeb7..a3bf0ae6789 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java @@ -94,7 +94,7 @@ public class ImplementMethodRefactoring extends CRefactoring { parameterHandler.initArgumentNames(); sm.worked(1); sm.done(); - findInsertLocation(); + insertLocation = findInsertLocation(); sm.worked(1); sm.done(); return initStatus; @@ -136,13 +136,15 @@ public class ImplementMethodRefactoring extends CRefactoring { } } - private void findInsertLocation() throws CoreException { - insertLocation = MethodDefinitionInsertLocationFinder.find(methodDeclaration.getFileLocation(), methodDeclaration.getParent(), file); + private InsertLocation findInsertLocation() throws CoreException { + InsertLocation insertLocation = MethodDefinitionInsertLocationFinder.find(methodDeclaration.getFileLocation(), methodDeclaration.getParent(), file); if (!insertLocation.hasFile() || NodeHelper.isContainedInTemplateDeclaration(methodDeclaration)) { insertLocation.setInsertFile(file); insertLocation.setNodeToInsertAfter(NodeHelper.findTopLevelParent(methodDeclaration)); } + + return insertLocation; } private void createFunctionDefinition(IASTTranslationUnit unit) throws CoreException {