Lines 18-23
Link Here
|
18 |
|
18 |
|
19 |
import org.eclipse.core.resources.*; |
19 |
import org.eclipse.core.resources.*; |
20 |
import org.eclipse.core.runtime.IPath; |
20 |
import org.eclipse.core.runtime.IPath; |
|
|
21 |
import org.eclipse.core.runtime.IProgressMonitor; |
21 |
import org.eclipse.jdt.core.*; |
22 |
import org.eclipse.jdt.core.*; |
22 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
23 |
import org.eclipse.jdt.internal.compiler.util.SuffixConstants; |
23 |
import org.eclipse.jdt.internal.core.*; |
24 |
import org.eclipse.jdt.internal.core.*; |
Lines 259-271
Link Here
|
259 |
* @see IJavaSearchScope#encloses(String) |
260 |
* @see IJavaSearchScope#encloses(String) |
260 |
*/ |
261 |
*/ |
261 |
public boolean encloses(String resourcePath) { |
262 |
public boolean encloses(String resourcePath) { |
|
|
263 |
return encloses(resourcePath, null); |
264 |
} |
265 |
public boolean encloses(String resourcePath, IProgressMonitor progressMonitor) { |
262 |
if (this.hierarchy == null) { |
266 |
if (this.hierarchy == null) { |
263 |
if (resourcePath.equals(this.focusPath)) { |
267 |
if (resourcePath.equals(this.focusPath)) { |
264 |
return true; |
268 |
return true; |
265 |
} else { |
269 |
} else { |
266 |
if (this.needsRefresh) { |
270 |
if (this.needsRefresh) { |
267 |
try { |
271 |
try { |
268 |
initialize(); |
272 |
initialize(progressMonitor); |
269 |
} catch (JavaModelException e) { |
273 |
} catch (JavaModelException e) { |
270 |
return false; |
274 |
return false; |
271 |
} |
275 |
} |
Lines 278-284
Link Here
|
278 |
} |
282 |
} |
279 |
if (this.needsRefresh) { |
283 |
if (this.needsRefresh) { |
280 |
try { |
284 |
try { |
281 |
refresh(); |
285 |
refresh(progressMonitor); |
282 |
} catch(JavaModelException e) { |
286 |
} catch(JavaModelException e) { |
283 |
return false; |
287 |
return false; |
284 |
} |
288 |
} |
Lines 305-323
Link Here
|
305 |
public boolean enclosesFineGrained(IJavaElement element) { |
309 |
public boolean enclosesFineGrained(IJavaElement element) { |
306 |
if ((this.subTypes == null) && this.allowMemberAndEnclosingTypes) |
310 |
if ((this.subTypes == null) && this.allowMemberAndEnclosingTypes) |
307 |
return true; // no fine grained checking requested |
311 |
return true; // no fine grained checking requested |
308 |
return encloses(element); |
312 |
return encloses(element, null); |
309 |
} |
313 |
} |
310 |
/* (non-Javadoc) |
314 |
/* (non-Javadoc) |
311 |
* @see IJavaSearchScope#encloses(IJavaElement) |
315 |
* @see IJavaSearchScope#encloses(IJavaElement) |
312 |
*/ |
316 |
*/ |
313 |
public boolean encloses(IJavaElement element) { |
317 |
public boolean encloses(IJavaElement element) { |
|
|
318 |
return encloses(element, null); |
319 |
} |
320 |
public boolean encloses(IJavaElement element, IProgressMonitor progressMonitor) { |
314 |
if (this.hierarchy == null) { |
321 |
if (this.hierarchy == null) { |
315 |
if (this.includeFocusType && this.focusType.equals(element.getAncestor(IJavaElement.TYPE))) { |
322 |
if (this.includeFocusType && this.focusType.equals(element.getAncestor(IJavaElement.TYPE))) { |
316 |
return true; |
323 |
return true; |
317 |
} else { |
324 |
} else { |
318 |
if (this.needsRefresh) { |
325 |
if (this.needsRefresh) { |
319 |
try { |
326 |
try { |
320 |
initialize(); |
327 |
initialize(progressMonitor); |
321 |
} catch (JavaModelException e) { |
328 |
} catch (JavaModelException e) { |
322 |
return false; |
329 |
return false; |
323 |
} |
330 |
} |
Lines 330-336
Link Here
|
330 |
} |
337 |
} |
331 |
if (this.needsRefresh) { |
338 |
if (this.needsRefresh) { |
332 |
try { |
339 |
try { |
333 |
refresh(); |
340 |
refresh(progressMonitor); |
334 |
} catch(JavaModelException e) { |
341 |
} catch(JavaModelException e) { |
335 |
return false; |
342 |
return false; |
336 |
} |
343 |
} |
Lines 409-415
Link Here
|
409 |
public IPath[] enclosingProjectsAndJars() { |
416 |
public IPath[] enclosingProjectsAndJars() { |
410 |
if (this.needsRefresh) { |
417 |
if (this.needsRefresh) { |
411 |
try { |
418 |
try { |
412 |
refresh(); |
419 |
refresh(null); |
413 |
} catch(JavaModelException e) { |
420 |
} catch(JavaModelException e) { |
414 |
return new IPath[0]; |
421 |
return new IPath[0]; |
415 |
} |
422 |
} |
Lines 417-434
Link Here
|
417 |
return this.enclosingProjectsAndJars; |
424 |
return this.enclosingProjectsAndJars; |
418 |
} |
425 |
} |
419 |
protected void initialize() throws JavaModelException { |
426 |
protected void initialize() throws JavaModelException { |
|
|
427 |
initialize(null); |
428 |
} |
429 |
protected void initialize(IProgressMonitor progressMonitor) throws JavaModelException { |
420 |
this.resourcePaths = new HashSet(); |
430 |
this.resourcePaths = new HashSet(); |
421 |
this.elements = new IResource[5]; |
431 |
this.elements = new IResource[5]; |
422 |
this.elementCount = 0; |
432 |
this.elementCount = 0; |
423 |
this.needsRefresh = false; |
433 |
this.needsRefresh = false; |
424 |
if (this.hierarchy == null) { |
434 |
if (this.hierarchy == null) { |
425 |
if (this.javaProject != null) { |
435 |
if (this.javaProject != null) { |
426 |
this.hierarchy = this.focusType.newTypeHierarchy(this.javaProject, this.owner, null); |
436 |
this.hierarchy = this.focusType.newTypeHierarchy(this.javaProject, this.owner, progressMonitor); |
427 |
} else { |
437 |
} else { |
428 |
this.hierarchy = this.focusType.newTypeHierarchy(this.owner, null); |
438 |
this.hierarchy = this.focusType.newTypeHierarchy(this.owner, progressMonitor); |
429 |
} |
439 |
} |
430 |
} else { |
440 |
} else { |
431 |
this.hierarchy.refresh(null); |
441 |
this.hierarchy.refresh(progressMonitor); |
432 |
} |
442 |
} |
433 |
buildResourceVector(); |
443 |
buildResourceVector(); |
434 |
} |
444 |
} |
Lines 440-447
Link Here
|
440 |
this.needsRefresh = this.hierarchy == null ? false : ((TypeHierarchy)this.hierarchy).isAffected(delta, eventType); |
450 |
this.needsRefresh = this.hierarchy == null ? false : ((TypeHierarchy)this.hierarchy).isAffected(delta, eventType); |
441 |
} |
451 |
} |
442 |
protected void refresh() throws JavaModelException { |
452 |
protected void refresh() throws JavaModelException { |
|
|
453 |
refresh(null); |
454 |
} |
455 |
protected void refresh(IProgressMonitor progressMonitor) throws JavaModelException { |
443 |
if (this.hierarchy != null) { |
456 |
if (this.hierarchy != null) { |
444 |
initialize(); |
457 |
initialize(progressMonitor); |
445 |
} |
458 |
} |
446 |
} |
459 |
} |
447 |
public String toString() { |
460 |
public String toString() { |