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 196450 - Custom templates are gratuitously reformatted
Summary: Custom templates are gratuitously reformatted
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Templates (show other bugs)
Version: 7.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 201704 (view as bug list)
Depends on: 162526
Blocks:
  Show dependency tree
 
Reported: 2011-03-08 19:46 UTC by Jesse Glick
Modified: 2011-11-05 02:58 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-03-08 19:46:35 UTC
I have a custom template for an NbTestCase subclass which I keep in the JUnit category. In recent builds (?) when I create a new class based on this template, it is reformatted as by Alt-Shift-F, which loses the particular pattern of whitespace and indendation I crafted for this file. While I can understand the desire to reformat stock templates according to the user's configured indentation settings, it it undesirable to do so for custom templates.

Filing here provisionally since I am not positive where this logic is implemented; I am guessing java.source/src/org/netbeans/modules/java/IndentFileEntry.java but this is old (uses org.openide.text.IndentEngine!) and may have been superseded by something else. Anyway setting <attr name="org-netbeans-modules-java-preformattedSource" boolvalue="true"/> on the template has no apparent effect.

Probably the right logic is to disable automatic indentation when templateFileObject.getAttribute("removeWritables") != null (see bug #162526 for nicer API).
Comment 1 Martin Entlicher 2011-09-18 15:45:55 UTC
*** Bug 201704 has been marked as a duplicate of this bug. ***
Comment 2 Martin Entlicher 2011-11-03 16:35:04 UTC
I've found the reformat at org.netbeans.modules.editor.EditorModule.
Comment 3 Martin Entlicher 2011-11-04 12:50:23 UTC
Fixed by changeset:   206322:a25981d2343a
http://hg.netbeans.org/main/rev/a25981d2343a
Comment 4 Quality Engineering 2011-11-05 02:58:58 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a25981d2343a
User: mentlicher@netbeans.org
Log: #196450: Reformat only files created from the original template.