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