开发者

How to count number of non-derived files in an Eclipse project

So, how to count number of files in an Eclipse project, wi开发者_运维知识库th the specific requirement that derived resources should not be counted. (otherwise one could easily use unix command line tools to calculate that) Linked and virtual resources need not be considered, although, bonus points if you do.


Ah, found a proper way to do it: Open the File Search dialog, delete all text in the "Containing text:" field, select the "File name pattern" you want (for all files that would be ""), and then selected the scope you want (workspace, selected resources, etc.). Execute the search and then look at the match count in the Search view. The key here is the "Containing text:" field. If it is "", it will matches lines instead of just files. I tried originally to use a regexp that would match only once per file, such as "\A(.|\R)?", which works to a certain extent (matches all non-empty, non-binary files). But only the empty text field solution will indeed find all files in the Eclipse resource model (including linked and virtual folders, but not derived or team-private resources).


A plugin like metrics could at least gives you the number of classes, which is a good approximation for the number of files (if you omit nested classes).
Note: I haven't tested that plugin with recent Eclipse (3.5 or 3.6) releases.

It would consider the scope of the project (meaning included other projects included in the build path)

How to count number of non-derived files in an Eclipse project

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜