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 137875 - Reformatting always adds an extra blank line after an annonymous innerclass' header
Summary: Reformatting always adds an extra blank line after an annonymous innerclass' ...
Status: RESOLVED DUPLICATE of bug 121127
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-21 10:30 UTC by carentrica
Modified: 2008-06-24 10:47 UTC (History)
0 users

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 carentrica 2008-06-21 10:30:57 UTC
I have the following as a Code Template...

try {
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            ${selection}
        }
    });
} catch (Exception ex)   {
    //TO DO: add exception handler
}

However, when the code is inserted there is an extra line break added...

try {
    java.awt.EventQueue.invokeLater(new Runnable() {
                                                     <<<< extra line break
        public void run() {
        ...
}

Try as I might, I cannot prevent it.
Comment 1 Peter Pis 2008-06-22 23:00:43 UTC
Reassigning to "editor".
Comment 2 Jiri Prox 2008-06-23 09:30:46 UTC
This is caused by automatic reformat when code template is applied.

I think we should have an option for this since some users prefers it and some not.
Comment 3 Vitezslav Stejskal 2008-06-23 14:32:53 UTC
Please change your formatting settings in Tools-Options -> Java Code -> Formatting -> Blank Lines -> Before method. The
options has been requested in issue #131227.

*** This issue has been marked as a duplicate of 131227 ***
Comment 4 carentrica 2008-06-23 15:14:07 UTC
That has made no difference. 
I had tried that previously before submitting this issue.
Comment 5 carentrica 2008-06-23 15:18:25 UTC
Further to that last comment of mine, why should any of those settings be considered in the case of Code Templates?

If I want blank lines in my templates, I'll put them in when I create it. If I don't then I won't put them in.
It seems to me to be adding complexity for no good reason.
Comment 6 Vitezslav Stejskal 2008-06-23 16:02:51 UTC
> That has made no difference. 

You are right, sorry.


> Further to that last comment of mine, why should any of those settings be considered in the case of Code Templates?

Code templates are formatted when expanded, which is what most people want. In some cases templates should only be
indented or perhaps even expanded 'as-is', please see issue #136074 for the discussion about this.
Comment 7 Dusan Balek 2008-06-24 10:47:14 UTC
The setting that needs to changed is Tools-Options -> Java Code -> Formatting -> Blank Lines -> After Class Header.
There is a request to split this option into two - one for standalone classes, second for anonymous inner classes. See
issue #121127.

*** This issue has been marked as a duplicate of 121127 ***