Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 164601 - Code template expansion not possible without source reformatting
Code template expansion not possible without source reformatting
Status: RESOLVED WORKSFORME
Product: java
Classification: Unclassified
Component: Editor
6.x
PC Windows XP
: P3 with 1 vote (vote)
: 7.3
Assigned To: Dusan Balek
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-06 15:18 UTC by matthies
Modified: 2013-05-06 11:02 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2009-05-06 15:18:44 UTC
It seems that code template expansion automatically reformats the inserted code. This is undesirable if:

1) The automatic formatting is not adequate or not desired for the code that is being inserted. For example consider 
the code template

    if (${selection} == null) { throw new NullPointerException("${selection}"); }

intended to insert a single-line null test. The automatic formatting causes it to be reformatted into multiple lines 
upon insertion.

2) The code being inserted is incomplete partial code (to be completed manually after insertion) and because of this 
its syntax is wrongly interpreted when reformatting.

It would be good if one could specify for each code template whether reformatting should be applied or not.
Comment 1 Max Sauer 2009-05-11 16:22:26 UTC
Thanks for your ideas, this could be done in next release.
Comment 2 Jiri Prox 2013-05-06 11:02:06 UTC
This is already implemented,
use ${no-format} or ${no-indent} at the beginning of the template


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo