Question

One of my favorite features of Eclipse is the ability to open a caller/callee hierarchy of a method.

By default, the view shows calls to/from classes that are outside of my codebase... which I don't usually care about.

There is an option to filter out specific package names I don't want, but I need to do the opposite... to filter out all packages except the one I want. What is the appropriate regex to use here to "match all strings except those that start with com.mycompany.?"

alt text

Was it helpful?

Solution

It appears that "Filter Calls" uses glob syntax for filter patterns, not regular expressions. You can't specify something that should not match with glob patterns. Sorry.

OTHER TIPS

I had the same problem lately and exploring the options of the Call Hierarchy led me to the Search In option. It is activated by clicking on the triangle

View Menu

The filtering options are pretty simple and effective: Search In options

It is not exactly what you are looking for, but it is an alternate solution. Take a look at nWire for Java. It is a code exploration plugin. Among many other things, it will present the call hierarchy. However, it will only show calls which originate from your own code, so it should fit your needs.

Another approach is to open the 'Type Hierarchy' view's View menu, select 'Select Working Set' and select an existing or new working set that only includes the project you're currently interested in (create one just for this purpose if necessary, e.g. called 'TypeHierarchyFilterWorkingSet').

I just did this using Eclipse Indigo, by the way, not sure whether the other versions have something similar.

After "Open Call Hierarchy" right click on the root of the results and select under "References" or "Declarations" the project you interest in:

enter image description here

One solution (though somewhat brute force) is to remove the other code from Eclipse's reach. Either put them into separate workspaces, or, if you sometimes do need them in one workspace, close the other projects when you don't want to see them.

You could try to add a parameter to the method, than all calls will be shown as error on rebuild.

you could filter out org., net., java.* and so on. This (in my case) reduces the list enormously

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top