问题描述
在 Eclipse 插件中,我想在编辑器中打开一个文件.我知道完整的包和类名,如何从中确定java文件的路径?
Inside an eclipse plugin, I'd like to open a file in editor. I know the full package and class name, how can I determine the path of the java file from this?
推荐答案
看看IJavaProject.findType(name)方法.一旦有了 IType,就可以使用 getPath() 或 getResource() 方法来定位文件.此方法搜索整个项目以及该项目中可见的所有内容.要搜索整个工作区,请遍历工作区中的所有 Java 项目,依次调用每个项目的 findType() 方法.
Take a look at IJavaProject.findType( name ) method. Once you have an IType, you can use getPath() or getResource() methods to locate the file. This method searches across a project and everything visible from that project. To search the whole workspace, iterate through all the Java projects in the workspace, calling the findType() method on each in turn.
这篇关于如何以编程方式从完整的类名中找到 eclipse 中的 java 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)