Re: [mdr-users] Newbie: correct way to find usages of one class by another
Martin Matula <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
[Cross posting to refactoring mailing list since it's more appropriate for this kind of questions...] Richard Kennard wrote: >Dear All, > >What is the correct way to find all usages of, say, a class 'Foo'? > >If I construct a WhereUsedQuery and pass it a JavaClass of Foo, I only get >back usages of its constructor (and static enums and the like). > > That's weird, WhereUsedQuery should work (otherwise the Find Usages feature would not work). Anyway, if you want to find usages programmatically, it is better to call JavaClass.getReferences() (WhereUsedQuery is kind of heavy-weight, since it wraps the results by RefactoringElements). Regards, Martin