Defining a variable type in comment II
By Petr on Jan 08, 2009
In the previous post I wrote about the new feature, which is requested by many people. In this entry I will write little more about this feature.
I wrote that the comment has to have a defined form. NetBeans can help you with writing it. There is registered new code template, which has the default abreviation vdoc. So when you write vdoc and press TAB key the letters vdoc are replaced with the comment template. The variable name is selected and you can change it. Then you can press TAB again and the type is selected.
As you can see the code completion works for both - variables and types.
This code template is smart:). If there is used a variable after the place, where you writing the template, then is the name of the variable suggested by default. If there is not any variable used after the place, where you are using the template, then the name of variable above is suggested as default. If NetBeans are not able locate any variable near to the line, where you are using the template, then as the default name is suggested variable.
If NetBeans are able to find out the type of predefined variable then the type is also automatically entered.
I already mentioned that the mark occurrences works as well inside these comments. The last thinks, which I want to mentioned today is that the hyperlink functionality works for the types. So when you place mouse cursor over the type and press CTRL, then the type is changed to a link, which will navigate to the type declaration. You can use CTRL+B shortcut, when the caret is inside the type name or Navigate -> Go to Declaration from context menu.