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 177095 - if condition statement is not properly formatted in function invocation
Summary: if condition statement is not properly formatted in function invocation
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 normal (vote)
Assignee: Anton Chechel
URL:
Keywords:
Depends on:
Blocks: 173487
  Show dependency tree
 
Reported: 2009-11-18 07:53 UTC by Alexandr Scherbatiy
Modified: 2010-01-26 02:48 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 Alexandr Scherbatiy 2009-11-18 07:53:29 UTC
Product Version         = NetBeans IDE Dev (Build 200911171401) (#d7b3ad6247f5)
  Operating System        = Windows XP version 5.1 running on x86
  Java; VM; Vendor        = 1.6.0_15; Java HotSpot(TM) Client VM 14.1-b02; Sun
Microsystems Inc.


Steps to reproduce:
- Format the code
-----------------------------------------
class A {

    var currentSlide: String;

    public function jump(cur: Integer): Void {
    }

    public function next() {

        jump(if (currentSlide == null) then 0 else Integer.parseInt(currentSlide));

    }
}

-----------------------------------------


The result is:
-----------------------------------------
    public function next() {

        jump(if (currentSlide == null) then
            0
        else
            Integer.parseInt(currentSlide));

    }
-----------------------------------------
Comment 1 Anton Chechel 2009-11-23 05:25:18 UTC
How it should be formatted?
Comment 2 Alexandr Scherbatiy 2009-11-23 06:43:56 UTC
The if statement is written on one line in this case:
-----------------------------------------------------------------------
public function next() {
  jump(if (currentSlide == null) then 0 else Integer.parseInt(currentSlide));
}
-----------------------------------------------------------------------

But the issue editor does not allow to put one long string in a line.
It usually breaks the end of the string to the next line.


Just format this code:
-----------------------------------------------------------------------
class A {

var currentSlide: String;

public function jump(cur: Integer): Void {
}

public function next() {
jump(if (currentSlide == null) then 0 else Integer.parseInt(currentSlide)); }
}
-----------------------------------------------------------------------

The point is to not break block that is written on one line.
Comment 3 Alexandr Scherbatiy 2009-11-23 07:14:34 UTC
The same is for the for the loop.

Format the code

---------------------------------------------------------------
import javax.swing.JTable;
import javax.swing.JComponent;
import javax.swing.table.DefaultTableModel;

import javafx.ext.swing.SwingComponent;


package class TableColumn{
    public var text: String;
}

package class SwingTable extends SwingComponent{
        

    var table: JTable;
    var model: DefaultTableModel;

    public var selection: Integer;

    public var columns: TableColumn[] on replace{
       model = new DefaultTableModel(for(column in columns) column.text, 0);
       table.setModel(model);

    };

    override protected function createJComponent () : JComponent {
        return new JTable(model);
    }

}
---------------------------------------------------------------

The result is:
---------------------------------------------------------------
    public var columns: TableColumn[] on replace {
                model = new DefaultTableModel(for (column in columns)
                    column.text, 0);
                table.setModel(model);

            };
---------------------------------------------------------------
Comment 4 Anton Chechel 2009-11-25 09:22:19 UTC
fixed
http://hg.netbeans.org/javafx/rev/2b8c064da945
Comment 5 Alexandr Scherbatiy 2009-12-11 04:55:32 UTC
verified in NetBeans-JavaFX-Soma:  #62
Comment 6 Petr Suchomel 2010-01-15 03:29:00 UTC
Fixed in release68_fixes
http://hg.netbeans.org/javafx/rev/d51b517f64ae
Comment 7 Alexandr Scherbatiy 2010-01-26 02:48:02 UTC
Verified in NB 6.8 patch1 2010-01-25_21-27-59