I have element-level comments in my code & I need to say when was the last time I modified a piece of code. Since it might be difficult to do this automatically when I save the document in question, I was looking for some semi-automatic solution where I press a shortcut & poof the date/time appears at my cursor.
E.g.
/**
* modified by @author Chantz last on <ENTER CURRENT DATE TIME HERE>
*/
public class EclipsePrintDateTimePlease {
...
UPDATE Eclipse versions I use are Helios & Galileo (I have different workstations).
In the Window > Preferences menu, you can search for spell checking (located in General > Editors > Text Editors > Spelling) and there you can edit your spell checking options.
getTime(); DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); String formattedDate=dateFormat. format(date); System. out. println("Current time of the day using Calendar - 24 hour format: "+ formattedDate); } . . .
Code To Get Today's date in any specific FormatgetTime(); String todaysdate = dateFormat. format(date); System. out. println("Today's date : " + todaysdate);
Finding comments is easy: search for "/*" or "//". And since comments have no formal relation to code, when is a comment "about" the code nearby, and when is it just a comment ("a sonnet to ...")?
You didn't specify which version of Eclipse you're using but, unless you are on a very old version, this should work:
Write a template for a keyword, for example date, that uses Eclipse date and time variables. After doing this, you will be able to expand the keyword into a date with Ctrl-Space.
For details, have a look at http://www.ibm.com/developerworks/opensource/library/os-eclipse-galcode/index.html
However, what you probably want instead is putting your code into some sort of versioning system (Subversion, git, Hg, ...) and use their capabilities to keep track on your versions and when you checked them in.
///BR, Jens Carlberg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With