Find Usages question

I have a base class "Foo" which implements method "foo()".

I have two derived classes "Bar : Foo" and "Baz : Foo", each of which
implement additional methods.

Then I have this code somewhere:

...
Bar bar = new Bar;
bar.foo();
...

If I put the cursor on the "foo" in the above line, and do a "Find Usages",
it finds all the usages of "foo()" on Foo and all classes derived from Foo
(in this case, Bar and Baz). Is there a way for me to find ONLY those
usages of foo() that are made from an instance of the Bar class? In other
words, even though "foo()" is ONLY defined in the base class, I only want to
find the usages of this method that are made on a specific derived class.

It turns out I really would find this ability quite useful. If this isn't
possible in 1.5 or current 2.0 alpha, can I strongly request it be added to
2.0 ASAP? I have some tasks that are going to be extremely tedious without
this functionalty...

Thanks!

- Paul



2 comments
Comment actions Permalink

It looks like it's impossible to perform this search in the current ReSharper.
I can suggest a workaround: temporarily ovverride 'foo()' in class 'Bar'
and perform the search.

Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I have a base class "Foo" which implements method "foo()".

I have two derived classes "Bar : Foo" and "Baz : Foo", each of which
implement additional methods.

Then I have this code somewhere:

...
Bar bar = new Bar;
bar.foo();
...
If I put the cursor on the "foo" in the above line, and do a "Find
Usages", it finds all the usages of "foo()" on Foo and all classes
derived from Foo (in this case, Bar and Baz). Is there a way for me
to find ONLY those usages of foo() that are made from an instance of
the Bar class? In other words, even though "foo()" is ONLY defined in
the base class, I only want to find the usages of this method that are
made on a specific derived class.

It turns out I really would find this ability quite useful. If this
isn't possible in 1.5 or current 2.0 alpha, can I strongly request it
be added to 2.0 ASAP? I have some tasks that are going to be
extremely tedious without this functionalty...

Thanks!

- Paul



0
Comment actions Permalink

Thanks for the work-around idea.

I do think this might make a nice enhancement to the "Advanced" version of
"Find Usages" though... if it's possible to do at all.


"Valentin Kipiatkov (JetBrains)" <valentin@jetbrains.com> wrote in message
news:3fdb29a6855f28c75cf27048d442@news.intellij.net...

It looks like it's impossible to perform this search in the current
ReSharper. I can suggest a workaround: temporarily ovverride 'foo()' in
class 'Bar' and perform the search.

>

Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

>
>> I have a base class "Foo" which implements method "foo()".
>>
>> I have two derived classes "Bar : Foo" and "Baz : Foo", each of which
>> implement additional methods.
>>
>> Then I have this code somewhere:
>>
>> ...
>> Bar bar = new Bar;
>> bar.foo();
>> ...
>> If I put the cursor on the "foo" in the above line, and do a "Find
>> Usages", it finds all the usages of "foo()" on Foo and all classes
>> derived from Foo (in this case, Bar and Baz). Is there a way for me
>> to find ONLY those usages of foo() that are made from an instance of
>> the Bar class? In other words, even though "foo()" is ONLY defined in
>> the base class, I only want to find the usages of this method that are
>> made on a specific derived class.
>>
>> It turns out I really would find this ability quite useful. If this
>> isn't possible in 1.5 or current 2.0 alpha, can I strongly request it
>> be added to 2.0 ASAP? I have some tasks that are going to be
>> extremely tedious without this functionalty...
>>
>> Thanks!
>>
>> - Paul
>>
>



0

Please sign in to leave a comment.