从 eclipse 插件调用调用层次结构
我想编写一个 Eclipse 插件,它可以获取类名列表,并向我返回一个在给定项目中引用它们的类表。 我在想是否可以使用 eclipse cal 层次结构。但不知道如何调用这个命令。有人可以帮我吗,提前致谢
I want to write an eclipse plugin which can take a list of class names and return me a table of classes where they are being referenced in a given project.
I was thinking if i can use eclipse cal hierarchy. But not sure how to invoke this command. could someone help me with this, Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您想要类似引用 - >工作区(Control + Shift + G)而不是调用层次结构?
您以前使用过此选项吗?它使用 FindReferencesAction,看一下这个类,您可以看到它基于当前选择的 IJavaElement 构建了一个搜索查询。
您可以使用它作为对多个 IJavaElement 进行搜索查询的基础吗?或者您想要自己的具体观点?
It sounds like you want something like References->Workspace (Control+Shift+G) rather than the call hierarchy?
Have you used this option before? It uses FindReferencesAction, take a look at this class and you can see it building up a search query based on the currently selected IJavaElement.
Could you use this as a basic for a search query on multiple IJavaElements? Or do you want your own specific view?
查看 OpenCallHierarchyAction org.eclipse.jdt.ui.internal.callhierarchy 包的类。这是内部 Eclipse 源代码,但您应该会对 run(ITextSelection Selection) 方法中的代码感兴趣。
Have a look at the OpenCallHierarchyAction class of the org.eclipse.jdt.ui.internal.callhierarchy Package. This is internal Eclipse source code, but the code in the run(ITextSelection selection) method should be interesting to you.
在你写这样的东西之前,一定要看看 JDepend4Eclipse,它可以做很多事情你需要。我过去曾使用它进行包级重构以及理解(和删除)循环依赖。
如果它不能满足您的需要,您可能需要查看他们的源代码。
Before you write anything like this, make sure you take a look at JDepend4Eclipse, it may do much of what you need. I have used it in the past to do package-level refactoring as well as understanding (and removing) circular dependencies.
If it doesn't do what you need, you may want to peek at their source code.