Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 199779 - New API class to specify a limited scope for WhereUsedQuery
New API class to specify a limited scope for WhereUsedQuery
Product: editor
Classification: Unclassified
Component: Refactoring
PC All
: P3 (vote)
: 7.1
Assigned To: Ralph Ruijs
Depends on:
Blocks: 200437 197194 200439
  Show dependency treegraph
Reported: 2011-06-30 11:55 UTC by Ralph Ruijs
Modified: 2011-07-27 15:12 UTC (History)
3 users (show)

See Also:

Proposed patch (6.82 KB, patch)
2011-06-30 12:00 UTC, Ralph Ruijs
Details | Diff
Updated patch (6.87 KB, patch)
2011-07-07 12:09 UTC, Ralph Ruijs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Ruijs 2011-06-30 11:55:00 UTC
To specify a limited scope for the WhereUsedQuery refactoring an api change is needed so all implementation can adhere to a specified scope.
Comment 1 Ralph Ruijs 2011-06-30 12:00:42 UTC
Created attachment 109164 [details]
Proposed patch
Comment 2 Jan Becicka 2011-06-30 13:39:26 UTC
Patch is OK for me. CCing Jesse and Petr. This Scope will be used in Find Usages to limit scope (current file, current package, selected folders etc..) and AFAIK apisupport.refactoring and j2ee.refactoring has some find usages plugins which should be updated to respect Scopes.
Comment 3 Tomas Zezula 2011-06-30 14:00:15 UTC
TZ01: I would prefer to have a addFolder (addFile) methods. Returning a Set into which client adds the files may be dangerous. A  client may remove an already added file or hold a reference to the set and do a mutation of it in other thread causing ConcurrentModificationException.
Comment 4 Petr Pisl 2011-06-30 14:26:39 UTC
I have to agree with Tomas TZ01. The javadoc for the method getFiles() and it's name somehow sounds strange to me. Also using set looks suspicious.
Comment 5 Ralph Ruijs 2011-07-07 12:09:49 UTC
Created attachment 109288 [details]
Updated patch

TZ01: I changed the scope to be unmodifiable. Added a create method to build the scope.
Comment 6 Jesse Glick 2011-07-11 15:30:36 UTC
[JG01] Perhaps it is off topic, but for bug #191334 I need the ability to introduce a new scope (Maven repository). This API change does not look like it would help at all.
Comment 7 Tomas Zezula 2011-07-11 17:36:28 UTC
Seems good to me.
Comment 8 Jan Becicka 2011-07-12 08:14:35 UTC
Re [JG01]
Yes, it is off topic. This API change is about local scopes. It will not help with maven issue, on other hand it also does not make things worse.
Comment 9 Ralph Ruijs 2011-07-12 09:18:11 UTC
I will integrate it tomorrow.
Comment 10 Ralph Ruijs 2011-07-13 08:47:01 UTC
Changeset: 297c45376765
Author:    Ralph Benjamin Ruijs <>
Date:      2011-07-13 10:22
Issue #199779 - New API class to specify a limited scope for WhereUsedQuery
Comment 11 Jesse Glick 2011-07-13 13:00:12 UTC
When there is a working UI that defines Scope's, please file a dependent issue for apisupport.refactoring to pay attention to it. (I do not promise to work on it promptly since this module is not a high priority, especially with newer APIs using annotations that require no special IDE support.)

I could also modify the new maven.refactoring to suppress local repo search when there is a Scope clearly indicating an explicit user restriction to the scope. Just from the API alone I cannot judge how this would be possible; will the Scope object be entirely missing from the context when Find Usages is invoked with no special gesture? If it is present and prepopulated with source roots from all open projects (or whatever), then maven.refactoring cannot easily tell whether the user meant to specifically limit the scope or not. Obviously it would be best to have a separate checkbox "Check Maven Repository" in the Find Usages dialog, but no API supports this that I know of.
Comment 12 Quality Engineering 2011-07-14 14:26:00 UTC
Integrated into 'main-golden'
User: Ralph Benjamin Ruijs <>
Log: Issue #199779 - New API class to specify a limited scope for WhereUsedQuery
Comment 13 Quality Engineering 2011-07-25 14:08:16 UTC
Integrated into 'main-golden'
User: Ralph Benjamin Ruijs <>
Log: After fix of bug #200230, some find usages implementations broke. ClasspathInfo needs to be in context until #199779 is used in all modules.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo