]>
Commit | Line | Data |
---|---|---|
2d553c1f AE |
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; | |
df7eb88a AE |
9 | import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesExtractAndMoveCandidateComparator; |
10 | import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesExtractLocalVariableCandidateComparator; | |
2d553c1f AE |
11 | import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException; |
12 | import no.uio.ifi.refaktor.change.changers.RefaktorChanger; | |
13 | import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor; | |
14 | import no.uio.ifi.refaktor.change.executors.ExtractLocalVariableExecutor; | |
15 | ||
16 | public class SearchBasedExtractLocalVariableWithAssertsChanger implements RefaktorChanger { | |
17 | private SearchBasedExtractLocalVariableAnalyzer analyzer; | |
18 | ||
19 | public SearchBasedExtractLocalVariableWithAssertsChanger(IMethod method) { | |
df7eb88a | 20 | this.analyzer = new SearchBasedExtractLocalVariableAnalyzer(method, new FavorNoUnfixesExtractLocalVariableCandidateComparator()); |
2d553c1f AE |
21 | } |
22 | ||
23 | @Override | |
24 | public void checkPreconditions() throws RefaktorAnalyzerException { | |
25 | analyzer.analyze(); | |
26 | ||
27 | } | |
28 | ||
29 | @Override | |
30 | public void execute(IProgressMonitor monitor) throws CoreException { | |
31 | ExtractLocalVariableExecutor executor = new ExtractLocalVariableExecutor(analyzer.getCandidate()); | |
32 | executor.execute(monitor); | |
33 | } | |
34 | ||
35 | } |