Tempate or HotKeys? Can Inserting Commit be made easy with IntelliJ

I have a question about IntelliJ and I dont know if the following can be done with Temapaltes or Hotkeys or something.  As I am coding I like to put in comments in the following format:

/*
    / Date: 02.25.12
    / Author: xxx xxx
    / Email: jxxx
    / Commit:
    /    Added the new fields based on request XXX.
    /
    */

Can I somehow setup a easy way with IntelliJ to press a key or something to insert this into my code

6 comments

Hello,

That's called live templates at our domain. Please check the corresponding reference section.

Denis

0

thanks. I created alive template but I dont see how I can make it insert the date and time from the system?

0

I found it..

6 down vote accepted

You can create your own:

  1. In Settings, go to Live Templates
  2. Add a new template with the abbreviation "date"
  3. For "template text", specify
    $date$
    .  Now the "Edit Variables" button should be enabled.
  4. Edit the variables, and set
    $date$
    to use the expression
    date()
    .
  5. Enable "Java comment" under the template's context and click OK.

Now when you type "date" and use the default completion gesture (Tab) it will replace "date" with the current date.

0

Oh, sorry, I mixed Live Templates and File Templates - the later has {DATE} binding.

I think you can create a simple plugin which has a single action which provides that template text with necessary arguments. Alternatively you can try this scripting plugin - intellij-eval for achieving that.

Denis

0

Oh, there is an existing date() binding at live templates, cool ;)

Denis

0

Please sign in to leave a comment.