从 String 标识的内部类中检索外部类作为 IFile
如何从 IFile 对象的内部类(由类名标识)检索外部类?
对于“普通”.java 类,我得到如下内容:
IFile file = project.getFile("src" + System.getProperty("file.separator")
+ packageName
+ System.getProperty("file.separator") + simpleClassName
+ ".java");
这显然仅适用于 .java 类,不适用于内部类。
示例:
public class House {
LinkedList<Room> rooms;
public House() {
rooms.add(new Room());
}
class Room {
}
}
现在我想搜索“Room”并检索 House.java。
有什么想法吗?
How can I retrieve the outer class from an inner class (identified by class name) for an IFile Object?
For "normal" .java classes i got something like this:
IFile file = project.getFile("src" + System.getProperty("file.separator")
+ packageName
+ System.getProperty("file.separator") + simpleClassName
+ ".java");
This works obviously only for .java classes, not for inner classes.
Example:
public class House {
LinkedList<Room> rooms;
public House() {
rooms.add(new Room());
}
class Room {
}
}
Now i want to search for "Room" and retrieve House.java.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用 Eclipse Java 开发工具。 使用 Java 搜索引擎 Eclipse 帮助中的页面似乎是一个不错的起点。使用 JDT 意味着您的类位于 Java 项目中。
You should use Eclipse Java Development Tools. Using the Java search engine page in Eclipse help seems to be good place to start. Using JDT implies that you have your classes in a Java project.