Thursday, April 21, 2016

Useful Stuff Points

Do you want to add the TODO when you generate the methods/classes? Then you could use code templates for that. Like // TODO Auto-generated method stub is added when you generate a method you could put any other comment on top of a method. Window -> Preferences -> Java -> Code Style -> Code Templates
Or do you want to add the TODO to all methods/classes which currently do exist? Thats a bit harder, you could write a plugin which does that for you: Eclipse JDT
If that TODO should always be created when you have modified a class or method you could also write an eclipse plugin which monitors the CompilationUnit in the editor. See recordModifications() here
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2Fdom%2FCompilationUnit.html&anchor=recordModifications%28%29

recordModifications

public void recordModifications()
Enables the recording of changes to this compilation unit and its descendants. The compilation unit must have been created by ASTParserand still be in its original state. Once recording is on, arbitrary changes to the subtree rooted at this compilation unit are recorded internally. Once the modification has been completed, call rewrite to get an object representing the corresponding edits to the original source code string.
Throws:
IllegalArgumentException - if this compilation unit is marked as unmodifiable, or if this compilation unit has already been tampered with, or recording has already been enabled
Since:
3.0

No comments: