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.
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).
*** Bug 201704 has been marked as a duplicate of this bug. ***
I've found the reformat at org.netbeans.modules.editor.EditorModule.
Fixed by changeset: 206322:a25981d2343a http://hg.netbeans.org/main/rev/a25981d2343a
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.