1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Code streamlining.

This commit is contained in:
Sergey Prigogin 2011-05-27 22:52:56 +00:00
parent 0ece103fb9
commit 46695ac68b
2 changed files with 8 additions and 16 deletions

View file

@ -18,6 +18,7 @@ import java.util.Properties;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory;
@ -25,8 +26,6 @@ import org.eclipse.ltk.internal.core.refactoring.history.RefactoringHistoryServi
import org.eclipse.cdt.ui.tests.refactoring.extractfunction.ExtractFunctionRefactoringTest;
import org.eclipse.cdt.internal.ui.refactoring.CRefactoring;
/**
* @author Emanuel Graf IFS
*/
@ -41,7 +40,6 @@ public class RefactoringHistoryTest extends ExtractFunctionRefactoringTest {
protected void configureRefactoring(Properties refactoringProperties) {
scriptFile = fileMap.get(refactoringProperties.getProperty(
"scriptFile", "refScript.xml"));
}
@Override
@ -49,27 +47,21 @@ public class RefactoringHistoryTest extends ExtractFunctionRefactoringTest {
String xmlSource = scriptFile.getSource();
URI uri= URIUtil.toURI(project.getLocation());
xmlSource = xmlSource.replaceAll("\\$\\$projectPath\\$\\$", uri.getPath());
RefactoringHistory refHist = RefactoringHistoryService.getInstance()
.readRefactoringHistory(
new ByteArrayInputStream(xmlSource
.getBytes()), 0);
RefactoringHistory refHist = RefactoringHistoryService.getInstance().readRefactoringHistory(
new ByteArrayInputStream(xmlSource.getBytes()), 0);
for (RefactoringDescriptorProxy proxy : refHist.getDescriptors()) {
RefactoringStatus status = new RefactoringStatus();
CRefactoring ref = (CRefactoring) proxy
.requestDescriptor(new NullProgressMonitor())
.createRefactoring(status);
Refactoring ref = proxy.requestDescriptor(new NullProgressMonitor()).createRefactoring(status);
assertTrue(status.isOK());
RefactoringStatus checkInitialConditions = ref.checkInitialConditions(NULL_PROGRESS_MONITOR);
if(fatalError){
if (fatalError) {
assertConditionsFatalError(checkInitialConditions);
return;
}
else{
} else {
assertConditionsOk(checkInitialConditions);
executeRefactoring(ref);
}
}
}
}

View file

@ -15,8 +15,8 @@ import java.util.Collection;
import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.cdt.ui.tests.refactoring.RefactoringTest;
@ -66,7 +66,7 @@ public class ExtractFunctionRefactoringTest extends RefactoringTest {
}
}
protected void executeRefactoring(CRefactoring refactoring) throws CoreException, Exception {
protected void executeRefactoring(Refactoring refactoring) throws Exception {
RefactoringStatus finalConditions = refactoring.checkFinalConditions(NULL_PROGRESS_MONITOR);
assertConditionsOk(finalConditions);
Change createChange = refactoring.createChange(NULL_PROGRESS_MONITOR);