过滤 Eclipse 的“开放调用层次结构”仅限我的公司/项目

发布于 2024-09-28 00:21:30 字数 429 浏览 6 评论 0原文

我最喜欢的 Eclipse 功能之一是能够打开调用者/被调用者层次结构。

默认情况下,该视图显示对我的代码库之外的类的调用...我通常不关心这些。

有一个选项可以过滤我不想要的特定包名称,但我需要做相反的事情...过滤所有包除了< /em> 我想要的一个。此处使用什么合适的正则表达式来“匹配除以 com.mycompany. 开头的字符串之外的所有字符串?”

替代文字

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

痕至 2024-10-05 00:21:30

我最近遇到了同样的问题,探索“呼叫层次结构”的选项使我找到了“搜索”选项。单击三角形

View Menu

即可激活它。过滤选项非常简单有效:
搜索选项

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

日裸衫吸 2024-10-05 00:21:30

看来“过滤器调用”使用 glob 语法作为过滤器模式,而不是正则表达式。您不能指定与全局模式不匹配的内容。对不起。

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.

口干舌燥 2024-10-05 00:21:30

这并不完全是您正在寻找的,但它是一种替代解决方案。查看 nWire for Java。它是一个代码探索插件。除其他事项外,它将呈现调用层次结构。但是,它只会显示源自您自己的代码的调用,因此它应该适合您的需求。

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.

等你爱我 2024-10-05 00:21:30

另一种方法是打开“类型层次结构”视图的“视图”菜单,选择“选择工作集”,然后选择仅包含您当前感兴趣的项目的现有或新工作集(如有必要,为此目的创建一个工作集,例如称为“TypeHierarchyFilterWorkingSet”)。

顺便说一句,我只是使用 Eclipse Indigo 完成了此操作,不确定其他版本是否有类似的东西。

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.

独﹏钓一江月 2024-10-05 00:21:30

在“Open Call Hierarchy”之后,右键单击结果的根目录,然后在“References”或“Declarations”下选择您感兴趣的项目:

在此处输入图像描述

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

爱你不解释 2024-10-05 00:21:30

一种解决方案(尽管有点暴力)是从 Eclipse 的访问范围中删除其他代码。要么将它们放入单独的工作区,要么,如果您有时确实需要将它们放在一个工作区中,请在您不想看到它们时关闭其他项目。

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.

森林迷了鹿 2024-10-05 00:21:30

您可以尝试向该方法添加一个参数,然后所有调用都将在重建时显示为错误。

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

霓裳挽歌倾城醉 2024-10-05 00:21:30

您可以过滤掉 org.、net.、java.* 等。这(就我而言)极大地减少了列表

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文