Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » increment version number on file/save(Trying to find a way to automatically increment a field when file is written to disk)
increment version number on file/save [message #723150] Wed, 07 September 2011 20:29 Go to next message
Edward G Prentice is currently offline Edward G PrenticeFriend
Messages: 1
Registered: June 2010
Junior Member
I'm trying to keep track of how many times a file is edited by adding code to the existing Java editor so that when the java source file is written, my field is incremented. For example, if I have the following in my program <<private static int editNumber=37; // *autoIncrement*>> when the file is written via Ctrl+S (File/Save) the number 37 would change to 38 just before the file is written. It would also be nice to be able to put a date/time stamp in the file, based on the time of the last file/save operation. <<private static String editTime = "2011.08.07 16:26:47" // *autoTimeStamp*>> Format of date is not important. Does anyone know of any existing plugins or write-hooks that would allow me to do this easily?

Re: increment version number on file/save [message #724957 is a reply to message #723150] Tue, 13 September 2011 14:48 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 07.09.2011 22:29, Edward G Prentice wrote:
> I'm trying to keep track of how many times a file is edited by adding
> code to the existing Java editor so that when the java source file is
> written, my field is incremented. For example, if I have the following
> in my program <<private static int editNumber=37; // *autoIncrement*>>
> when the file is written via Ctrl+S (File/Save) the number 37 would
> change to 38 just before the file is written. It would also be nice
> to be able to put a date/time stamp in the file, based on the time of
> the last file/save operation. <<private static String editTime =
> "2011.08.07 16:26:47" // *autoTimeStamp*>> Format of date is not
> important. Does anyone know of any existing plugins or write-hooks
> that would allow me to do this easily?
>
>
Take a look at the 'org.eclipse.jdt.ui.cleanUps' extension point.

Dani
Previous Topic:Persisting Selection of CheckBoxTreeViewer between sessions
Next Topic:Getting Line number and offset from a IProblemLocation
Goto Forum:
  


Current Time: Thu Mar 28 11:16:34 GMT 2024

Powered by FUDForum. Page generated in 0.04227 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top