NetBeans Quick Tip #6 - Abbreviations in Editor
NetBeans editor supports so called abbreviations. They can make you really productive, it's enough to type in psfs, press space and the IDE generates for you "public static final String". The full abbreviation list is in Help | Keyboard Shortcuts.
The nice thing is that you can add your own abbreviations. So whenever you find out you're writing something often, you can create an abbreviation and use it instead of typing (all programmers are lazy, aren't they?). An even nicer thing is that there are people willing to share their abbreviations - Michel Graciano from Brazil has sent me a list of his abbreviations. They're more advanced than the IDE offers by default, for instance, you can type in trc and the IDE generates:
try {
|
} catch (Exception e) {
}
The | mark denotes placement of cursor. I have added into the list one of my popular abbreviations - psvm, it generates:
public static void main(String[] args) {
|
}
You can download the XML file
here. Just copy it to your userdir in ~/.netbeans/4.1/config/Editors/text/x-java/abbreviations.xml. In case this file is already there it means you have already created some abbreviations and then you can just paste the tags from the xml file to add new abbreviations.
These are the contents of the abbreviations XML file:
| Abbreviation | Action |
|---|
| tr | try statement |
| elif | else if |
| for | for cycle |
| wh | while |
| sw | switch |
| trc | try catch |
| ed | editor fold |
| rn | return null |
| fy | finally |
| ca | catch |
| el | else |
| fore | foreach |
| t | this |
| nu | null |
| Do | double |
| forj | for cycle with j |
| to | todo |
| if | if clause |
| forit | for with iterator |
| psvm | main method |
Next time I will write about macros (Michel has also a great list of macros).
Posted by 195.13.11.226 on červen 10, 2005 at 12:44 odp. CEST #
Posted by Roman Strobl on červen 10, 2005 at 12:53 odp. CEST #
Posted by Bharath on červen 10, 2005 at 01:07 odp. CEST #
Posted by vbrabant on červen 10, 2005 at 08:19 odp. CEST #
Posted by Roman Strobl on červen 10, 2005 at 08:25 odp. CEST #
Posted by 81.242.210.145 on červen 10, 2005 at 08:55 odp. CEST #
Posted by Roman Strobl on červen 10, 2005 at 09:05 odp. CEST #
Posted by jake on červen 10, 2005 at 10:28 odp. CEST #
Posted by Jake on červen 10, 2005 at 10:30 odp. CEST #
Posted by Roman Strobl on červen 10, 2005 at 10:36 odp. CEST #
Posted by Henrik on červen 10, 2005 at 11:09 odp. CEST #
Posted by Roman Strobl on červen 10, 2005 at 11:19 odp. CEST #
The Wiki page is: http://wiki.java.net/bin/view/Netbeans/TipsAndTricks
It's linked from the main Wiki of NetBeans. I'll try to add into the table tricks & tips I'll find on the web and I encourage others to do the same.
Posted by Roman Strobl on červen 10, 2005 at 11:44 odp. CEST #
Posted by Henrik on červen 11, 2005 at 12:20 dop. CEST #
Posted by Roman Strobl on červen 11, 2005 at 10:07 dop. CEST #
Posted by jake on červen 12, 2005 at 03:36 dop. CEST #
Posted by Roman Strobl on červen 12, 2005 at 07:57 dop. CEST #
Posted by jake on červen 12, 2005 at 02:22 odp. CEST #
Posted by Roman Strobl on červen 12, 2005 at 03:29 odp. CEST #
Posted by M'enfin! - David Delabassee's blog on červen 13, 2005 at 10:16 odp. CEST #