Filter Eclipse's “Open Call Hierarchy” to just

2019-04-21 23:34发布

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

8条回答
Lonely孤独者°
2楼-- · 2019-04-22 00:19

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.

查看更多
三岁会撩人
3楼-- · 2019-04-22 00:20

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.

查看更多
该账号已被封号
4楼-- · 2019-04-22 00:21

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.

查看更多
爷的心禁止访问
5楼-- · 2019-04-22 00:22

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.

查看更多
Deceive 欺骗
6楼-- · 2019-04-22 00:23

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

查看更多
Deceive 欺骗
7楼-- · 2019-04-22 00:27

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

查看更多
登录 后发表回答