]>
Commit | Line | Data |
---|---|---|
2b4a9262 | 1 | package no.uio.ifi.refaktor.change.changers; |
49214add | 2 | |
33b364ef | 3 | import no.uio.ifi.refaktor.analyze.analyzers.SearchBasedExtractAndMoveMethodAnalyzer; |
7fa217a1 | 4 | import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesCandidateComparator; |
c847e15b | 5 | import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException; |
08f060c3 | 6 | import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor; |
37be5000 | 7 | |
49214add EK |
8 | import org.eclipse.core.runtime.CoreException; |
9 | import org.eclipse.core.runtime.IProgressMonitor; | |
37be5000 | 10 | import org.eclipse.core.runtime.NullProgressMonitor; |
0a865b44 | 11 | import org.eclipse.jdt.core.IMethod; |
49214add EK |
12 | |
13 | public class SearchBasedExtractAndMoveMethodChanger implements RefaktorChanger { | |
14 | ||
37be5000 | 15 | private SearchBasedExtractAndMoveMethodAnalyzer analyzer; |
0a865b44 EK |
16 | |
17 | public SearchBasedExtractAndMoveMethodChanger(IMethod method) { | |
7fa217a1 | 18 | this.analyzer = new SearchBasedExtractAndMoveMethodAnalyzer(method, new FavorNoUnfixesCandidateComparator()); |
0a865b44 EK |
19 | } |
20 | ||
49214add | 21 | @Override |
c847e15b | 22 | public void checkPreconditions() throws RefaktorAnalyzerException { |
37be5000 | 23 | analyzer.analyze(); |
49214add EK |
24 | } |
25 | ||
26 | @Override | |
a554b0ce | 27 | public void execute(IProgressMonitor monitor) throws CoreException { |
7fa217a1 | 28 | ExtractAndMoveMethodExecutor executor = new ExtractAndMoveMethodExecutor(analyzer.getCandidate()); |
96b66186 | 29 | executor.execute(new NullProgressMonitor()); |
49214add EK |
30 | } |
31 | ||
32 | } |