]> git.uio.no Git - ifi-stolz-refaktor.git/blob - software/no.uio.ifi.refaktor/src/no/uio/ifi/refaktor/change/SearchBasedExtractLocalVariableWithAssertsChanger.java
e75471e3ec11ad203d4174d778547cdda41ed1ca
[ifi-stolz-refaktor.git] / software / no.uio.ifi.refaktor / src / no / uio / ifi / refaktor / change / SearchBasedExtractLocalVariableWithAssertsChanger.java
1 package no.uio.ifi.refaktor.change;
2
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.core.runtime.IProgressMonitor;
5 import org.eclipse.jdt.core.IMethod;
6
7 import no.uio.ifi.refaktor.analyze.SearchBasedExtractLocalVariableAnalyzer;
8 import no.uio.ifi.refaktor.analyze.analyzers.SearchBasedExtractAndMoveMethodAnalyzer;
9 import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesCandidateComparator;
10 import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException;
11 import no.uio.ifi.refaktor.change.changers.RefaktorChanger;
12 import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor;
13 import no.uio.ifi.refaktor.change.executors.ExtractLocalVariableExecutor;
14
15 public class SearchBasedExtractLocalVariableWithAssertsChanger implements RefaktorChanger {
16         private SearchBasedExtractLocalVariableAnalyzer analyzer;
17         
18         public SearchBasedExtractLocalVariableWithAssertsChanger(IMethod method) {
19                 this.analyzer = new SearchBasedExtractLocalVariableAnalyzer(method, new FavorNoUnfixesCandidateComparator());
20         }
21
22         @Override
23         public void checkPreconditions() throws RefaktorAnalyzerException {
24                 analyzer.analyze();
25
26         }
27
28         @Override
29         public void execute(IProgressMonitor monitor) throws CoreException {
30                 ExtractLocalVariableExecutor executor = new ExtractLocalVariableExecutor(analyzer.getCandidate());
31                 executor.execute(monitor);
32         }
33
34 }