Still playing with Eclipse Monkey.
I wrote this simple script based on the org.eclipse.dash.doms resources DOM. It looks for Java files
to find the files which are missing copyright headers.
In my script it is looking for the Eclipse Foundation copyright (Copyright (c) 2005 Eclipse Foundation).
--- Came wiffling through the eclipsey wood ---
/*
* Menu: Find Missing Headers
* Kudos: Jeff Mesnil
* License: EPL 1.0
* DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.dash.doms
*/
function main() {
var files = resources.filesMatching(".*\\.java");
var match;
for each( file in files ) {
file.removeMyTasks( );
if (!file.lines[1].string.match(/\* Copyright \(c\) 2005 Eclipse Foundation/)) {
file.lines[1].addMyTask(file);
}
}
window.getActivePage().showView("org.eclipse.ui.views.TaskList");
}
--- And burbled as it ran! ---
If I run it on my workspace with the imported org.eclipse.eclipsemonkey plug-in, it shows that one
file is missing the copyright header:


March 20th, 2006 at 19:11
There is a plug-in at Eclipse.org that does similar things. It walks through the files and update headers automatically (adding missing headers, updating years). I think it can be easily customized to your comment header.
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.releng.tools/
March 20th, 2006 at 19:18
Thanks Gunnar, I did not know that the releng plug-in could do that.
But now I need to find another example of a Monkey Script which is not already offered by a plug-in