Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 277089 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/swt/internal/widgets/tableitemkit/TableItemLCA_Test.java (+14 lines)
Lines 351-354 Link Here
351
    String result = Fixture.getAllMarkup();
351
    String result = Fixture.getAllMarkup();
352
    assertTrue( result.indexOf( expected ) != -1 );
352
    assertTrue( result.indexOf( expected ) != -1 );
353
  }
353
  }
354
355
  public void testDynamicColumns() {
356
    Display display = new Display();
357
    Shell shell = new Shell( display );
358
    Table table = new Table( shell, SWT.NONE );
359
    new TableColumn( table, SWT.NONE );
360
    TableItem item = new TableItem( table, SWT.NONE );
361
    item.setBackground( 0, display.getSystemColor( SWT.COLOR_BLACK ) );
362
    // Create another column after setting a cell background
363
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=277089
364
    new TableColumn( table, SWT.NONE );
365
    RWTFixture.markInitialized( display );
366
    RWTFixture.preserveWidgets();
367
  }
354
}
368
}
(-)src/org/eclipse/swt/widgets/TableItem.java (-9 / +15 lines)
Lines 48-56 Link Here
48
    public Color[] getCellBackgrounds() {
48
    public Color[] getCellBackgrounds() {
49
      int columnCount = Math.max( 1, getParent().getColumnCount() );
49
      int columnCount = Math.max( 1, getParent().getColumnCount() );
50
      Color[] result = new Color[ columnCount ];
50
      Color[] result = new Color[ columnCount ];
51
      for( int i = 0; i < result.length; i++ ) {
51
      if( data != null ) {
52
        if( data != null && data[ i ] != null ) {
52
        for( int i = 0; i < data.length; i++ ) {
53
          result[ i ] = data[ i ].background;
53
          if( data[ i ] != null ) {
54
            result[ i ] = data[ i ].background;
55
          }
54
        }
56
        }
55
      }
57
      }
56
      return result;
58
      return result;
Lines 59-67 Link Here
59
    public Color[] getCellForegrounds() {
61
    public Color[] getCellForegrounds() {
60
      int columnCount = Math.max( 1, getParent().getColumnCount() );
62
      int columnCount = Math.max( 1, getParent().getColumnCount() );
61
      Color[] result = new Color[ columnCount ];
63
      Color[] result = new Color[ columnCount ];
62
      for( int i = 0; i < result.length; i++ ) {
64
      if( data != null ) {
63
        if( data != null && data[ i ] != null ) {
65
        for( int i = 0; i < data.length; i++ ) {
64
          result[ i ] = data[ i ].foreground;
66
          if( data[ i ] != null ) {
67
            result[ i ] = data[ i ].foreground;
68
          }
65
        }
69
        }
66
      }
70
      }
67
      return result;
71
      return result;
Lines 70-78 Link Here
70
    public Font[] getCellFonts() {
74
    public Font[] getCellFonts() {
71
      int columnCount = Math.max( 1, getParent().getColumnCount() );
75
      int columnCount = Math.max( 1, getParent().getColumnCount() );
72
      Font[] result = new Font[ columnCount ];
76
      Font[] result = new Font[ columnCount ];
73
      for( int i = 0; i < result.length; i++ ) {
77
      if( data != null ) {
74
        if( data != null && data[ i ] != null ) {
78
        for( int i = 0; i < data.length; i++ ) {
75
          result[ i ] = data[ i ].font;
79
          if( data[ i ] != null ) {
80
            result[ i ] = data[ i ].font;
81
          }
76
        }
82
        }
77
      }
83
      }
78
      return result;
84
      return result;

Return to bug 277089