title: Eclipse template to Insert javadoc to an existing method
body: <p>Having an existing Java method like:</p>
  
  <pre><code>public int someMethod(String arg1, int arg2) {
      //do something
  
      return 0;
  }
  </code></pre>
  
  <p>I want to create a template (named myDoc), in eclipse. When I type it above a method and hit enter it should give me:</p>
  
  <pre><code>/**
   * 
   * @param arg1
   * @param arg2
   * @customAt
   * @return
   */
  public int someMethod(String arg1, int arg2) {
      //do something
  
      return 0;
  }
  </code></pre>
  
  <p>I know it happens when you type /** and hit enter, but I want to put custom @s and placeholders: above the first @param, after @param names to put descriptions and after the return to describe what is returned.</p>
  
  <p>And at the end of typing over placeholders I would have this:</p>
  
  <pre><code>/**
   * My method that does something
   * @param arg1 must be a valid string
   * @param arg2 must be greater than 0
   * @customAt my description
   * @return the code of...
   */
  public int someMethod(String arg1, int arg2) {
      //do something
  
      return 0;
  }
  </code></pre>
  
  <p>I'm aware of bad comments and I know that in some cases it could be useful like in an API, the method above is just an example.</p>
  
  <p>I just want to know how to do this. I've been playing with plugin development, I writen the plugin sample in <a href="http://web.archive.org/web/20100414054049/http://dev.eclipse.org/blogs/jdtui/2007/12/04/text-templates-2/" rel="nofollow">here</a>. In the sample you write a template variable that I think could be the way, but I'm stucked in the resolve method of <strong>org.eclipse.jface.text.templates.TemplateVariableResolver</strong>. I thought I could access the position of the cursor and that I could detect a method nearby to insert the javadoc.</p>
  
  <p>Is this the path?</p>