1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-05-17 00:28:10 +00:00
parent 379dcc20dd
commit ea4ce17b7d
2 changed files with 8 additions and 15 deletions

View file

@ -53,20 +53,17 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest {
protected void runTest() throws Throwable { protected void runTest() throws Throwable {
IFile refFile = project.getFile(fileName); IFile refFile = project.getFile(fileName);
ExtractFunctionInformation info = new ExtractFunctionInformation(); ExtractFunctionInformation info = new ExtractFunctionInformation();
CRefactoring refactoring = new ExtractFunctionRefactoring( refFile, selection, info, cproject); CRefactoring refactoring = new ExtractFunctionRefactoring(refFile, selection, info, cproject);
RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR); RefactoringStatus checkInitialConditions = refactoring.checkInitialConditions(NULL_PROGRESS_MONITOR);
if(fatalError){ if (fatalError) {
assertConditionsFatalError(checkInitialConditions); assertConditionsFatalError(checkInitialConditions);
return; return;
} } else {
else{
assertConditionsOk(checkInitialConditions); assertConditionsOk(checkInitialConditions);
setValues(info); setValues(info);
executeRefactoring(refactoring); executeRefactoring(refactoring);
} }
} }
protected void executeRefactoring(CRefactoring refactoring) throws CoreException, Exception { protected void executeRefactoring(CRefactoring refactoring) throws CoreException, Exception {
@ -80,25 +77,24 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest {
private void setValues(ExtractFunctionInformation info) { private void setValues(ExtractFunctionInformation info) {
info.setMethodName(methodName); info.setMethodName(methodName);
info.setReplaceDuplicates(replaceDuplicates); info.setReplaceDuplicates(replaceDuplicates);
if(info.getInScopeDeclaredVariable() == null){ if (info.getInScopeDeclaredVariable() == null) {
if(returnValue) { if (returnValue) {
info.setReturnVariable(info.getAllAfterUsedNames().get(returnParameterIndex)); info.setReturnVariable(info.getAllAfterUsedNames().get(returnParameterIndex));
info.getAllAfterUsedNames().get(returnParameterIndex).setUserSetIsReference(false); info.getAllAfterUsedNames().get(returnParameterIndex).setUserSetIsReference(false);
} }
} else { } else {
info.setReturnVariable( info.getInScopeDeclaredVariable() ); info.setReturnVariable(info.getInScopeDeclaredVariable());
} }
info.setVisibility(visibility); info.setVisibility(visibility);
info.setVirtual(virtual); info.setVirtual(virtual);
for (NameInformation name : info.getAllAfterUsedNames()) { for (NameInformation name : info.getAllAfterUsedNames()) {
if(!name.isUserSetIsReturnValue()){ if (!name.isUserSetIsReturnValue()) {
name.setUserSetIsReference(name.isReference()); name.setUserSetIsReference(name.isReference());
} }
} }
} }
@Override @Override
protected void configureRefactoring(Properties refactoringProperties) { protected void configureRefactoring(Properties refactoringProperties) {
methodName = refactoringProperties.getProperty("methodname", "exp"); //$NON-NLS-1$ //$NON-NLS-2$ methodName = refactoringProperties.getProperty("methodname", "exp"); //$NON-NLS-1$ //$NON-NLS-2$
@ -109,5 +105,4 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest {
visibility = VisibilityEnum.getEnumForStringRepresentation(refactoringProperties.getProperty("visibility", VisibilityEnum.v_private.toString())); //$NON-NLS-1$ visibility = VisibilityEnum.getEnumForStringRepresentation(refactoringProperties.getProperty("visibility", VisibilityEnum.v_private.toString())); //$NON-NLS-1$
virtual = Boolean.valueOf(refactoringProperties.getProperty("virtual", "false")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$ virtual = Boolean.valueOf(refactoringProperties.getProperty("virtual", "false")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Institute for Software - initial API and implementation * Institute for Software - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.tests.refactoring.extractfunction; package org.eclipse.cdt.ui.tests.refactoring.extractfunction;
@ -18,7 +18,6 @@ import org.eclipse.cdt.ui.tests.refactoring.RefactoringTester;
/** /**
* @author Emanuel Graf * @author Emanuel Graf
*
*/ */
public class ExtractFunctionTestSuite extends TestSuite { public class ExtractFunctionTestSuite extends TestSuite {
@ -33,5 +32,4 @@ public class ExtractFunctionTestSuite extends TestSuite {
suite.addTest(RefactoringTester.suite("Extract Function Dublicates Test", "resources/refactoring/ExtractMethodDuplicates.rts")); suite.addTest(RefactoringTester.suite("Extract Function Dublicates Test", "resources/refactoring/ExtractMethodDuplicates.rts"));
return suite; return suite;
} }
} }