Search |
||
Simply insanely cool...Posted by timboudreau on November 21, 2005 at 6:05 PM PST
I'm still having way too much fun writing the extensible Gimp-like image viewer tutorial code (well, if I keep this up I'm just going to have to admit that it's taking on a life of its own...).
And I write a lot of random logging code that looks like:
doSomething (rect.x, rect.y, rect.width, rect.height); Try this in NetBeans 5.0: Open the options window, go to Editor | Code Templates. Click New to add a new abbreviation. Enter
${RECT}.x, ${RECT}.y, ${RECT}.width, ${RECT}.height
Assign it the abbreviation
Now, in the editor, simply type
And type a string like
It seems trivial, but I can't remember the last time I was this gaga about an editor feature - I keep having more uses for it. For example, standard NetBeans module boilerplate:
${Clazz} singleton = (${Clazz}) Lookup.getDefault().lookup(${Clazz}.class);
|
(the | character is where to put the caret after I press Enter)
will generate, e.g.,
MyService singleton = (MyService) Lookup.getDefault().lookup(MyService.class); or a classic, converting a checked exception to a runtime exception:
IllegalStateException ise = new IllegalStateException (${Exception}.getMessage());
ErrorManager.getDefault().annotate (ise, ${Exception});
throw ise;
and assign it to the abbreviation "ise". I type
IllegalStateException ise = new IllegalStateException(e.getMessage());
ErrorManager.getDefault().annotate(ioe, e);
throw ise;
with the name of the exception selected so I can correct it. Wow! »
Related Topics >>
Tools Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|