New NetBeans Icon - Borgs Are Coming
NetBeans has a new desktop icon:
I can't help myself but I like the older one more. Maybe it's a matter of getting used to it. Concerning icons and stuff, everyone's suddenly a UI expert... It really looks like the Star Trek
Borg cube.
First Q-Build of NetBeans.next
... was surprisingly
not promoted. This was a long day today, I've submitted 10 bugs. And in meanwhile, I'm preparing the demos for the NetBeans day. I've just counted it and in the first demo we'll show 15 less known but useful features of NetBeans 4.1 editor, well, maybe known by the NB enthusiasts but hidden for the average Joe developers. Maybe we'll surprise the enthusiasts, too.
Quick Tip #7 - Macros in Editor
As promised, today's tip is about macros. What are they? These are actions which are recorded according to what you do in the editor. Depending how good you are, you can create even such action such as surround with try-catch, comment a piece of code, etc.
You can record the macros by pressing the red button in editor toolbar, perform the actions and then end recording by pressing the grey square next to the button. Then you name the macro and assign a shorcut to it. To execute the macro, you just need to press the shortcut you've assigned.
Michel Graciano from Brazil has prepared some great macros and you can download them
here. Similarly to
abbreviations the content of the zip should be placed into the directory ~/.netbeans/4.1/config/Editors/text/x-java. Make sure to backup all XML files this may replace. The abbreviations in abbreviations.xml are necessary to execute the macros (they contain few more than last time), the keybindings.xml file sets the shortcuts. Macros.xml file contains macros recorded by Michel.
Here are the available macros:
| Shortcut | Action |
| Ctrl-J I | Surround with if() |
| Ctrl-J T | Surround with try-catch |
| Ctrl-J L | Add debug code |
| Ctrl-N P | Create property |
| Ctrl-J { | Add a block |
| Ctrl-J H | Comment code |
| Ctrl-N F | Define identifier by previous class |
| Ctrl-N S | Delete two words |
| Ctrl-J C | Trim |
| Alt-U Q | Toggle case of identifier |
| Ctrl-J [ | Format code |
| Ctrl-J D | Debug variable |
| Ctrl-J F | Add editor fold |
Most of these macros require to have selected a piece of code in the clipboard. You may not use all of these, but they're a good source of inspiration for creating your own macros. Actually this way you can add simple features to your IDE. How cool is that? :-)