]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | package no.uio.ifi.refaktor.change.changers; |
2 | ||
3 | import no.uio.ifi.refaktor.analyze.ExtractAndMoveMethodCandidate; | |
4 | import no.uio.ifi.refaktor.analyze.analyzers.ProjectWideExtractAndMoveMethodAnalyzer; | |
5 | import no.uio.ifi.refaktor.analyze.exceptions.RefaktorAnalyzerException; | |
6 | import no.uio.ifi.refaktor.change.executors.ExtractAndMoveMethodExecutor; | |
7 | ||
8 | import org.eclipse.core.resources.IProject; | |
9 | import org.eclipse.core.runtime.CoreException; | |
10 | import org.eclipse.core.runtime.IProgressMonitor; | |
11 | import org.eclipse.jdt.core.IJavaProject; | |
12 | ||
13 | /** | |
14 | * A {@link RefaktorChanger} that is responsible for analyzing all of the methods | |
15 | * in a project and execute the {@link ExtractAndMoveMethodExecutor} on all of the | |
16 | * positive results from the analysis. See {@link ExtractAndMoveMethodCandidate}. | |
17 | * | |
18 | * This is done with the help of a {@link ProjectWideExtractAndMoveMethodAnalyzer} | |
19 | * and an {@link AggregationAnalyzerChanger}. | |
20 | */ | |
21 | public class ProjectWideExtractAndMoveMethodChanger implements RefaktorChanger { | |
22 | ||
23 | private AggregationAnalyzerChanger changer; | |
24 | ||
25 | public ProjectWideExtractAndMoveMethodChanger(IProject project) { | |
26 | changer = new AggregationAnalyzerChanger(new ProjectWideExtractAndMoveMethodAnalyzer(project)); | |
27 | } | |
28 | ||
29 | public ProjectWideExtractAndMoveMethodChanger(IJavaProject javaProject) { | |
30 | changer = new AggregationAnalyzerChanger(new ProjectWideExtractAndMoveMethodAnalyzer(javaProject)); | |
31 | } | |
32 | ||
33 | @Override | |
34 | public void checkPreconditions() throws RefaktorAnalyzerException { | |
35 | changer.checkPreconditions(); | |
36 | } | |
37 | ||
38 | @Override | |
39 | public void execute(IProgressMonitor monitor) throws CoreException { | |
40 | changer.execute(monitor); | |
41 | } | |
42 | ||
43 | } |