|
Lines 25-30
Link Here
|
| 25 |
import org.eclipse.ltk.core.refactoring.RefactoringStatusContext; |
25 |
import org.eclipse.ltk.core.refactoring.RefactoringStatusContext; |
| 26 |
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; |
26 |
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; |
| 27 |
|
27 |
|
|
|
28 |
import org.eclipse.jdt.core.IJavaProject; |
| 28 |
import org.eclipse.jdt.core.IMethod; |
29 |
import org.eclipse.jdt.core.IMethod; |
| 29 |
import org.eclipse.jdt.core.IType; |
30 |
import org.eclipse.jdt.core.IType; |
| 30 |
import org.eclipse.jdt.core.ITypeHierarchy; |
31 |
import org.eclipse.jdt.core.ITypeHierarchy; |
|
Lines 93-102
Link Here
|
| 93 |
return fOriginalMethod; |
94 |
return fOriginalMethod; |
| 94 |
} |
95 |
} |
| 95 |
|
96 |
|
| 96 |
private ITypeHierarchy getCachedHierarchy(IType declaring, IProgressMonitor monitor) throws JavaModelException { |
97 |
private ITypeHierarchy getCachedHierarchy(IJavaProject javaProject, IType declaring, IProgressMonitor monitor) throws JavaModelException { |
| 97 |
if (fCachedHierarchy != null && declaring.equals(fCachedHierarchy.getType())) |
98 |
if (fCachedHierarchy != null && declaring.equals(fCachedHierarchy.getType())) |
| 98 |
return fCachedHierarchy; |
99 |
return fCachedHierarchy; |
| 99 |
fCachedHierarchy= declaring.newTypeHierarchy(new SubProgressMonitor(monitor, 1)); |
100 |
fCachedHierarchy= declaring.newTypeHierarchy(javaProject, (new SubProgressMonitor(monitor, 1))); |
| 100 |
return fCachedHierarchy; |
101 |
return fCachedHierarchy; |
| 101 |
} |
102 |
} |
| 102 |
|
103 |
|
|
Lines 119-126
Link Here
|
| 119 |
|
120 |
|
| 120 |
ITypeHierarchy hierarchy= null; |
121 |
ITypeHierarchy hierarchy= null; |
| 121 |
IType declaringType= method.getDeclaringType(); |
122 |
IType declaringType= method.getDeclaringType(); |
|
|
123 |
IJavaProject javaProject = declaringType.getJavaProject(); |
| 122 |
if (!declaringType.isInterface()) |
124 |
if (!declaringType.isInterface()) |
| 123 |
hierarchy= getCachedHierarchy(declaringType, new SubProgressMonitor(monitor, 1)); |
125 |
hierarchy= getCachedHierarchy(javaProject, declaringType, new SubProgressMonitor(monitor, 1)); |
| 124 |
|
126 |
|
| 125 |
IMethod topmost= getMethod(); |
127 |
IMethod topmost= getMethod(); |
| 126 |
if (MethodChecks.isVirtual(topmost)) |
128 |
if (MethodChecks.isVirtual(topmost)) |
|
Lines 146-152
Link Here
|
| 146 |
|
148 |
|
| 147 |
final IMethod method= getMethod(); |
149 |
final IMethod method= getMethod(); |
| 148 |
final IType declaring= method.getDeclaringType(); |
150 |
final IType declaring= method.getDeclaringType(); |
| 149 |
final ITypeHierarchy hierarchy= getCachedHierarchy(declaring, new SubProgressMonitor(pm, 1)); |
151 |
IJavaProject javaProject = declaring.getJavaProject(); |
|
|
152 |
final ITypeHierarchy hierarchy= getCachedHierarchy(javaProject, declaring, new SubProgressMonitor(pm, 1)); |
| 150 |
final String name= getNewElementName(); |
153 |
final String name= getNewElementName(); |
| 151 |
if (declaring.isInterface()) { |
154 |
if (declaring.isInterface()) { |
| 152 |
if (isSpecialCase()) |
155 |
if (isSpecialCase()) |