Adding Javadoc Links in IntelliJ Idea with Live Templates
In Eclipse there is this wonderful little helper for adding Javadoc links while you’re typing a class name. It looks like this:

It suggests not just to put the classes name there but also use a @link tag so one can navigate the Javadoc sources later on. The finished comment:

Unfortunately this functionality is not available in JetBrains’ IntelliJ Idea. There is (of course) auto completion for classnames in Idea but it simply doesn’t put them in a @link tag. A simple trick saves the day: simply create a live template with context ‘Java comment’ like here:
EDIT: The screenshot is missing the word ‘link’. The complete template should be: ‘{@link $LINK$} ‘.
Don’t forget to click on ‘Edit variables’ and fill in ‘complete()’ as Expression. This activates the auto completion for classnames.
Now everytime a @link in the Javadocs is needed we invoke the Live Templates with Alt + J and enter a classname. The @link tag will be build around that name. It’s not as simple as with Eclipse, but works pretty well.



[...] worse, class lookup doesn’t work at all in II w/ot typing a @link first. I’ve found a workaround via a live template but I have to type its name and invoke it manually [...]
Comparison of Eclipse 3.6 and IntelliJ IDEA 10.5: Pros and Cons « The Holy Java
18 Oct 11 at 15:04
Nice tip. You can also make a live template if you want to @link to a method:
{@link #$METHOD$}
For the $METHOD$ variable, pick “methodName()”.
JO
26 Oct 11 at 21:05
Thanks for the comment! I haven’t thought about methods yet, but this sounds good!
michi
26 Oct 11 at 21:10