]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | package no.uio.ifi.refaktor.change.executors; |
2 | ||
3 | import no.uio.ifi.refaktor.change.performers.SimpleRefactoringPerformer; | |
4 | import no.uio.ifi.refaktor.contributions.SaferRefactoringContribution; | |
5 | ||
6 | import org.eclipse.core.runtime.CoreException; | |
7 | import org.eclipse.core.runtime.IProgressMonitor; | |
8 | import org.eclipse.jdt.core.IMethod; | |
9 | import org.eclipse.ltk.core.refactoring.Refactoring; | |
10 | import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; | |
11 | import org.eclipse.ltk.core.refactoring.RefactoringStatus; | |
12 | ||
13 | public class SaferRefactoringExecutor implements Executor { | |
14 | ||
15 | private final IMethod method; | |
16 | ||
17 | public SaferRefactoringExecutor(IMethod method) { | |
18 | this.method = method; | |
19 | } | |
20 | ||
21 | @Override | |
22 | public void execute(IProgressMonitor monitor) throws CoreException { | |
23 | new SimpleRefactoringPerformer(monitor).performRefactoring(createRefactoring()); | |
24 | } | |
25 | ||
26 | private Refactoring createRefactoring() throws CoreException { | |
27 | return createDescriptor().createRefactoring(new RefactoringStatus()); | |
28 | } | |
29 | ||
30 | private RefactoringDescriptor createDescriptor() { | |
31 | return new SaferRefactoringContribution().createDescriptor(method); | |
32 | } | |
33 | } |