This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142630 - Editable templates for generated code
Summary: Editable templates for generated code
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 5 votes (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 7861 155481 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-01 19:21 UTC by malfunction84
Modified: 2013-01-12 13:31 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description malfunction84 2008-08-01 19:21:54 UTC
NetBeans should allow users to edit the templates which provide generated code.

For instance, if I'm attempting to invoke a method which doesn't exist, NetBeans provides me with a hint to create the
nonexistent method.  I would like for this code to have something like...

//TODO: implement this method

...in it so it shows up in my Task List as well.  Currently there is no way for me to automate this addition.  Some
people might want to throw a org.apache.commons.lang.NotImplementedException instead of a
java.lang.UnsupportedOperationException in this generated method.  Allowing users to customize the method as a code
template would allow this flexibility.

This feature would also resolve Issue #111441.
Comment 1 Max Sauer 2008-08-07 16:27:58 UTC
Yes, that would be certainly nice to have.
Comment 2 Petr Dvorak 2008-12-15 17:47:39 UTC
*** Issue 7861 has been marked as a duplicate of this issue. ***
Comment 3 Petr Dvorak 2008-12-15 17:53:27 UTC
*** Issue 155481 has been marked as a duplicate of this issue. ***
Comment 4 _ wadechandler 2008-12-15 19:12:30 UTC
Definitely a needed feature. Other things can then take advantage of it. There are multiple places this would be useful.
Comment 5 greggwon 2008-12-15 20:39:39 UTC
I'd like to be able to change the logger invocation on generated catch() statements.

If there is concern about what "abbreviation" names to use etc, it might make sense
to keep these separated from the existing code templates which the
user types abbreviations to activate.  But, they should be editable somewhere.
Comment 6 malfunction84 2008-12-15 21:30:03 UTC
The existing code templates in NetBeans (for both macros and new files) use FreeMarker, right?  Will this mean that all
existing hints will need to be rewritten using FreeMarker instead of the JavaC API?
Comment 7 markiewb 2013-01-12 13:31:51 UTC
Fixed in 7.3 - the generated method bodies can be customized.

See http://wiki.netbeans.org/NetBeans_73_NewAndNoteworthy#Customizable_Method_Bodies