IntelliJ Community . TimestampPlugin

 
TimestampPlugin 

HOME INDEX SEARCH CHANGES GO  

Timestamp V2.0

This plugin inserts a comment containing user defined text plus a timestamp into the active editor window.

I usually add a short comment that includes a timestamp near code areas that have been edited -- something like:


   oldUneditedValue = theOldValue;
   newEditedValue = theNewValue; /* Edited: 26-Aug-2002 01:38:58 PM EDT */

This allows me to flag areas of source that have been changed. IDEA currently doesn't have any way to automatically generate the timestamp, so I created this plugin.

This plugin provides the following features:

  • A Timestamp action is added to the Editor Popup Menu. It is initially associated with the Ctrl-T keystroke, but this may be changed by the user.
  • A panel is added to Project Properties allowing the user to customize the action behavior.
  • The user can select either block or line style comments.
  • The user can select the comment location from:
    • At the current caret location (block comment style only)
    • Before text on the current line (block comment style only)
    • After text on the current line (at end of line)
    • On a separate line above the current line
  • The user can select the format of the timestamp string.
  • The user can include 'user-defined' text including java system property values.

The Timestamp action does the following:

  • If an existing comment of the chosen type (block or line) is found at the desired location, it is deleted.
  • A new comment of the chosen type containing the 'User-Text' and 'Timestamp' is inserted at the desired location.

'User-Text' may contain tokens of the form ${...} refering to any valid java system property name. The 'Timestamp' may be formatted using any of the SimpleDateFormat pattern strings.

-- BobSlomcenski - 12 Sep 2002

Future Plans

As time permits, I plan on adding the following:

  • Add appropriate comment delimiters for xml or jsp files. Comment delimiters will be selected based on file type so that <!-- --> comments would be inserted into xml or jsp files.
  • Instead of replacing the whole existing comment, just update or add-on the timestamp part (see: BerndSchiffer's comments below). This will require some thought though, since the end result comment appearance can take on several alternative appearances based on which parts are replaced and which are added-on.

-- BobSlomcenski - 27 Sep 2002

Change History

  • 8/26/2002 - Version 1.0 - Initial release.
  • 8/27/2002 - Version 1.01 - Added an icon for the menu entry. (Version 1.01 uses the PathManager class which was introduced in build 641. Therefore it will not work with earlier builds).
  • 9/9/2002 - Version 1.1 - The user can now choose between block or line style comments. Line style (//), of course, is only available at the end of the line or on the line above. Block style (/* */) is available at any of the four locations (see description above). Also, the Timestamp action is now associated with the Ctrl-T keystroke.
  • 9/12/2002 - Version 2.0 - Added parsing of user-text for included java system property names (Version 2.0 works with build 641-644 only).
  • 9/13/2002 - Version 2.01 - plugin.xml changed to use keyboard-shortcut instead of shortcut to support changes in API for build 647. (Version 2.01 works with build 647-648 only).
  • 9/27/2002 - Version 2.02 - Updated for changes in OpenAPI for build #650. No added features. (Version 2.02 works for build 650+).

Comments

Hi Bob. This is a very usefull plugin, simple and effective. Thanks for that! But to make it perfect for me, could you add an option to place a line comment (like //...) at the caret position when there's already a line comment? E.g. you have a line like this:

  System.out.println("bla"); // some comment <caret>
and you want to add a timestamp at the caret position it should be like this
  System.out.println("bla"); // some comment <timestamp>
but now it is like that
  System.out.println("bla"); // <timestamp>
Is it possible to make an option not to replace the existing line comment but to complete it? -- BerndSchiffer

Hi Bob. Thanks for a very useful plugin. I was wondering whether you migh be able to provide a means by which to insert the output of timestamp via live templates. I was thinking along the lines of predefined functions used to resolve template variables? -- GabrioVerratti

How about an ability to insert just the comment text without delimiters (when you want to add something to an existing comment)? This could be another choice in addition to block and line comment. -- JonasKvarnstrom - 26 Nov 2002

IntelliJPluginWebForm
IntelliJPluginName:
IntelliJPluginVersion:
IntelliJPluginVendor:
IntelliJPluginBinary:
IntelliJPluginSource:
IntelliJPluginClassification:
TopicClassification: IntelliJPluginArchive
TopicShortDescription: This plugin inserts a comment containing user defined text plus a timestamp into the active editor window
TestedOnOS:
ShouldRunOnOS:

Attachment: sort Action: Size: Date: Who: Comment:
Timestamp.jar action 20886 12 Sep 2002 - 19:35 BobSlomcenski Version 2.0
Timestamp201.jar action 20931 13 Sep 2002 - 19:15 BobSlomcenski Version 2.01 (build 647+)
Timestamp202.jar action 21954 27 Sep 2002 - 15:33 BobSlomcenski Version 2.02 (build 650)

e d i t a t t a c h r e f - b y d i f f s m o r e
Have ideas, requests, problems regarding this site? Send feedback.
Copyright © 2000-2003 by the contributing authors. All materials at intellij.org are the property of the contributing authors.