Eclipse插件如何访问项目目录? [英] How can an Eclipse plugin access the project directory?

查看:152
本文介绍了Eclipse插件如何访问项目目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Eclipse中获取项目的目录?我们正在编写一个允许用户选择文件的插件,然后在这些文件上运行一些进程。我最好能够获得所有具有一定扩展名的文件,但这并不是必需的。

解决方案

  ResourcesPlugin.getWorkspace()。getRoot()。getProjects()
pre>

将为您提供工作区中所有项目的列表。你可以轻松地迭代找到你想要的。此时,您可以通过扩展名等查找某些文件。


Is there a way to get the directory of a project in Eclipse? We are writing a plugin that will allow the user to select files, and then run some processes on those files. I would ideally like to be able to get all the files with a certain extension, but that is not necessary.

解决方案

sure:

ResourcesPlugin.getWorkspace().getRoot().getProjects()

will get you a list of all the projects in the workspace. you can easily iterate to find the one you want. At that point, you can look for certain files by extensions, etc.

这篇关于Eclipse插件如何访问项目目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆