package no.uio.ifi.refaktor.change.changers; import no.uio.ifi.refaktor.analyze.analyzers.SearchBasedExtractAndMoveMethodAnalyzer; import no.uio.ifi.refaktor.analyze.comparators.FavorNoUnfixesCandidateComparator; import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException; import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IMethod; public class SearchBasedExtractAndMoveMethodChanger implements RefaktorChanger { private SearchBasedExtractAndMoveMethodAnalyzer analyzer; public SearchBasedExtractAndMoveMethodChanger(IMethod method) { this.analyzer = new SearchBasedExtractAndMoveMethodAnalyzer(method, new FavorNoUnfixesCandidateComparator()); } @Override public void checkPreconditions() throws RefaktorAnalyzerException { analyzer.analyze(); } @Override public void execute(IProgressMonitor monitor) throws CoreException { ExtractAndMoveMethodExecutor executor = new ExtractAndMoveMethodExecutor(analyzer.getCandidate()); executor.execute(new NullProgressMonitor()); } }