Bug 177095

Summary: if condition statement is not properly formatted in function invocation
Product: javafx Reporter: Alexandr Scherbatiy <sunflower>
Component: EditorAssignee: Anton Chechel <manowar>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: sustaining
Version: 6.x   
Target Milestone: TBD   
Hardware: PC   
OS: Windows XP   
Whiteboard: 68patch1-verified
Issue Type: DEFECT Exception Report:
Bug Depends on:    
Bug Blocks: 173487    

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
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo