Usage hierarachy?

Eclipse has what it calls a "call hierarchy". It starts out like Show Usages, but each usage is itself a tree node.  When you expand that tree node, you see usages of that thing.  Expand a child of that, and you get usages of the child.  And so on.  So my usages tree for a function e() might look something like this:

-e
     -d
          +a
           -c
               +b
               +a
     +c


In this case, e is used by d and c.  I've expanded d to see that a and c use d.  I've then expanded that c node to see that b and a use c.

Is there a similar view in IntelliJ?  I know that when I'm in the Find window for a Show Usages, I can double-click to go to the source code for a usage, and then hit Show Usages again to open another tab in the Find window with the Show Usages for what I just double-clicked to, but it's not as convenient.

I'm most interested in this for Flex code, but I imagine if it's available for one language, it's available anywhere.

6 comments

There's a neat action in IntelliJ IDEA: Help | Find Action (Ctrl+Shit+A or Meta+Shift+A on Mac).Type 'call hierarchy' there and you'll find out that this action is in Navigate | Call Hierarchy and has shortcut Ctrl+Shift+H. It works for Flex, Java and some other languages pretty well.

0

Very nice!  That's almost what I'm looking for.  Actually, for functions/methods it's exactly what I'm looking for, and more - I like the Callee hierarchy!

However, one thing it doesn't seem to do is to work on constants.  Say I've got a class like this:

public class FooEvent extends Event
{
  public static const SOMETHING_HAPPENED : String = "somethingHappened";
  public static const SOMETHING_ELSE_HAPPENED : String = "somethingElseHappened";


  ...
}

Is there a way to get the caller hierarchy for the SOMETHING_HAPPENED constant?  I tried it, and it gave me the hierarchy for the entire class, not just that one constant.  I can get a Show Usages on the constant by hitting Alt-F7 with the cursor on it, but if I hit Ctrl-Alt-H (I had to remap it from Ctrl-Shift-H, since something on my system is eating Ctrl-Shift-H) while on a constant, nothing happens.  If I hit it while on a reference to the constant, I get the caller hierarchy for the entire FooEvent class.
0

You are right, it doesn't work for vars and contants, only for methods/constructors.

0

Thanks for the info, Alex.  I've just created IDEA-125022 requesting support for vars and constants.

0

Ok, thanks,
as you didn't specify the language Java will be considered by default. Each language support has its own implementation and responsible engineer, so if you want the feature for several languages you need to file a separate request for each. If ActionScript only then please set subsystem to Flash_Flex and mention language in the description.

0

Thanks, Alex - I didn't realize that.  I've just updated the issue as requested.

0

Please sign in to leave a comment.