Community
Participate
Working Groups
Build Identifier: Version: 3.6.2 Build id: M20110210-1200 Possibly related to the more general Bug 210780, which asks for scripting of the fix copyrights tool. I'd just like to be able to set up the Eclipse editor to automatically run the "Fix Copyrights" tool on any file every time I save it, just before writing to disk, so that I never need to worry about manually running the tool as long as I do my editing in Eclipse. I've set up something similar in UltraEdit, which allows you to run a generic macro on file save, and Vim, which gives the BufWritePre autocmd event. Reproducible: Always Steps to Reproduce: N/A: feature request
I was thinking the same. I'll see if I can do this.
Hey ya, I spent a couple of days looking into this. I got it working as far as having a 'Copyright fix' listed under Eclipse's save action. (see screenshots in zip). (based on tutorial: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_contributing_a_cleanup.htm) However, then I noticed that Eclipse's Save-Actions work with the source code AST (Abstract Syntax Tree) where as Copyright_tool works on files directly. I.e, the architectures aren't quite compatible with one another. This generates issues, e.g one loses git-integration because you no longer work with files. But even if the git issue is ignored, implementing this feature would require one to duplicate the copyright-tool logic and work separately on the AST instead of files. (i.e, one can't pass the file to the existing code easily). This is quite a big task and would require a big alteration in copyright tool. Unfortunately I won't have time to work on this anymore. But if someone wishes to pursue this, I"m attaching a test project with what I got so far. An alternative direction would be to intercept the save-command itself, and run the tool on the file after the save is complete. (and add a checkbox in the Copyright tool options. ) (as in: http://stackoverflow.com/questions/5899738/override-eclipse-file-save-action)
Created attachment 246439 [details] started save-action
Copyright tool is no longer developed.