Lines 25-30
Link Here
|
25 |
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; |
25 |
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; |
26 |
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; |
26 |
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; |
27 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
27 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; |
|
|
28 |
import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt; |
28 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
29 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
29 |
import org.eclipse.jdt.internal.core.*; |
30 |
import org.eclipse.jdt.internal.core.*; |
30 |
import org.eclipse.jdt.internal.core.search.IndexQueryRequestor; |
31 |
import org.eclipse.jdt.internal.core.search.IndexQueryRequestor; |
Lines 137-149
Link Here
|
137 |
} |
138 |
} |
138 |
} |
139 |
} |
139 |
private void buildForProject(JavaProject project, ArrayList potentialSubtypes, org.eclipse.jdt.core.ICompilationUnit[] workingCopies, HashSet localTypes, IProgressMonitor monitor) throws JavaModelException { |
140 |
private void buildForProject(JavaProject project, ArrayList potentialSubtypes, org.eclipse.jdt.core.ICompilationUnit[] workingCopies, HashSet localTypes, IProgressMonitor monitor) throws JavaModelException { |
140 |
// copy vectors into arrays |
|
|
141 |
int openablesLength = potentialSubtypes.size(); |
142 |
Openable[] openables = new Openable[openablesLength]; |
143 |
potentialSubtypes.toArray(openables); |
144 |
|
145 |
// resolve |
141 |
// resolve |
|
|
142 |
int openablesLength = potentialSubtypes.size(); |
146 |
if (openablesLength > 0) { |
143 |
if (openablesLength > 0) { |
|
|
144 |
// copy vectors into arrays |
145 |
Openable[] openables = new Openable[openablesLength]; |
146 |
potentialSubtypes.toArray(openables); |
147 |
|
148 |
// sort in the order of roots and in reverse alphabetical order for .class file |
149 |
// since requesting top level types in the process of caching an enclosing type is |
150 |
// not supported by the lookup environment |
151 |
IPackageFragmentRoot[] roots = project.getPackageFragmentRoots(); |
152 |
int rootsLength = roots.length; |
153 |
final HashtableOfObjectToInt indexes = new HashtableOfObjectToInt(openablesLength); |
154 |
for (int i = 0; i < openablesLength; i++) { |
155 |
IJavaElement root = openables[i].getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); |
156 |
int index; |
157 |
for (index = 0; index < rootsLength; index++) { |
158 |
if (roots[index].equals(root)) |
159 |
break; |
160 |
} |
161 |
indexes.put(openables[i], index); |
162 |
} |
163 |
Util.sort(openables, new Util.Comparer() { |
164 |
public int compare(Object a, Object b) { |
165 |
int aIndex = indexes.get(a); |
166 |
int bIndex = indexes.get(b); |
167 |
if (aIndex < bIndex) |
168 |
return -1; |
169 |
else if (aIndex > bIndex) |
170 |
return 1; |
171 |
return ((Openable) b).getElementName().compareTo(((Openable) a).getElementName()); |
172 |
} |
173 |
}); |
174 |
|
147 |
IType focusType = this.getType(); |
175 |
IType focusType = this.getType(); |
148 |
boolean inProjectOfFocusType = focusType != null && focusType.getJavaProject().equals(project); |
176 |
boolean inProjectOfFocusType = focusType != null && focusType.getJavaProject().equals(project); |
149 |
org.eclipse.jdt.core.ICompilationUnit[] unitsToLookInside = null; |
177 |
org.eclipse.jdt.core.ICompilationUnit[] unitsToLookInside = null; |
Lines 240-256
Link Here
|
240 |
length++; |
268 |
length++; |
241 |
} |
269 |
} |
242 |
|
270 |
|
243 |
// sort by projects |
|
|
244 |
/* |
245 |
* NOTE: To workaround pb with hierarchy resolver that requests top |
246 |
* level types in the process of caching an enclosing type, this needs to |
247 |
* be sorted in reverse alphabetical order so that top level types are cached |
248 |
* before their inner types. |
249 |
*/ |
250 |
org.eclipse.jdt.internal.core.util.Util.sortReverseOrder(allPotentialSubTypes); |
251 |
|
252 |
ArrayList potentialSubtypes = new ArrayList(); |
271 |
ArrayList potentialSubtypes = new ArrayList(); |
253 |
|
|
|
254 |
try { |
272 |
try { |
255 |
// create element infos for subtypes |
273 |
// create element infos for subtypes |
256 |
HandleFactory factory = new HandleFactory(); |
274 |
HandleFactory factory = new HandleFactory(); |