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 88962 - Provide an option for formatting a file newly created from template
Summary: Provide an option for formatting a file newly created from template
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on: 97622
Blocks: 55509
  Show dependency tree
 
Reported: 2006-11-08 18:33 UTC by Tomasz Slota
Modified: 2011-09-19 22:09 UTC (History)
4 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 Tomasz Slota 2006-11-08 18:33:54 UTC
When creating a new source file of any kind it is desirable to format it using user's formatting settings (see 
issue 55509). For now it is necessary to invoke formatting manually from instantiating iterator. This 
should be simplified especially that there are many simple templates that could be done without 
implementing a special instantiating iterator.
Comment 1 Jaroslav Tulach 2007-02-07 13:46:02 UTC
After integration of issue 13250 the process shall be more or less automatic. 
The description is at 
http://openide.netbeans.org/tutorial/reviews/opinions_13250.html
and says that your template shall be annotated with a templating engine to 
use:

<attr name="javax.script.ScriptEngine" stringvalue="freemarker"/>

and then the IndentEngine.find(mimeTypeOfYourFile) will be used to format your 
own file. Of course only if there is some useful IndentEngine registered for 
your mime type.
Comment 2 Jaroslav Tulach 2007-02-07 13:47:02 UTC
I am reassigning to editor as that is imho the place that shall provide good 
enough IndentEngines for generic mime types.
Comment 3 Vitezslav Stejskal 2007-02-08 03:55:36 UTC
Well, I generally agree that editor should provide a fallback IndentEngine,
which could be used when there is no better one provided by other modules. I
believe that 'Simple Indentation Engine' is such an implementation. If there are
any problems or suggestions for how SimpleIndentEngine works, please, file
defects. Also if there are any problems with modules provided IndentEngines,
please, file defects for an appropriate module. Otherwise, from editor's point
of view this issue is done and can be closed. Please, reopen it, if I am missing
something.
Comment 4 Tomasz Slota 2007-06-28 15:25:32 UTC
Procedure described by Jarda is not working (JSP file is parsed by the freemarker engine, but not formatted). It is because IndentEngine.find("text/x-jsp") 
returns SimpleFormattingEngine instead of JspFormattingEngine, which is available, but further in the list. IndentEngine.find() should prefer other 
implentations to SimpleFormattingEngine.
Comment 5 Vitezslav Stejskal 2007-06-29 10:30:21 UTC
See also issue #97622
Comment 6 Tomasz Slota 2007-06-29 10:43:16 UTC
So maybe our freemarker bridge should be using the workaround described by mmetelka in issue 97622?
Comment 7 Antonin Nebuzelsky 2008-04-17 15:15:28 UTC
Reassigning to new module owner mslama.