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 370752
Collapse All | Expand All

(-)src/org/eclipse/swt/widgets/Table.java (+2 lines)
Lines 252-257 Link Here
252
      }
252
      }
253
      clearItemsTextWidths();
253
      clearItemsTextWidths();
254
      updateScrollBars();
254
      updateScrollBars();
255
      adjustTopIndex();
256
      showSelection();
255
    }
257
    }
256
  }
258
  }
257
259
(-)src/org/eclipse/swt/widgets/Tree.java (-4 / +25 lines)
Lines 541-546 Link Here
541
    return topItemIndex;
541
    return topItemIndex;
542
  }
542
  }
543
543
544
  final int getVisibleItemCount( boolean includePartlyVisible ) {
545
    int clientHeight = getBounds().height - getHeaderHeight() - getHScrollBarHeight();
546
    int result = 0;
547
    if( clientHeight >= 0 ) {
548
      int itemHeight = getItemHeight();
549
      result = clientHeight / itemHeight;
550
      if( includePartlyVisible && clientHeight % itemHeight != 0 ) {
551
        result++;
552
      }
553
    }
554
    return result;
555
  }
556
544
  /**
557
  /**
545
   * Shows the column.  If the column is already showing in the receiver,
558
   * Shows the column.  If the column is already showing in the receiver,
546
   * this method simply returns.  Otherwise, the columns are scrolled until
559
   * this method simply returns.  Otherwise, the columns are scrolled until
Lines 2200-2205 Link Here
2200
    }
2213
    }
2201
  }
2214
  }
2202
2215
2216
  private void adjustTopIndex() {
2217
    int visibleItemCount = getVisibleItemCount( false );
2218
    if( topItemIndex > itemCount - visibleItemCount - 1 ) {
2219
      topItemIndex = Math.max( 0, itemCount - visibleItemCount - 1 );
2220
    }
2221
  }
2222
2203
  ///////////////////
2223
  ///////////////////
2204
  // Skinning support
2224
  // Skinning support
2205
2225
Lines 2361-2372 Link Here
2361
2381
2362
  }
2382
  }
2363
2383
2364
  private static final class ResizeListener extends ControlAdapter {
2384
  private final class ResizeListener extends ControlAdapter {
2365
    @Override
2385
    @Override
2366
    public void controlResized( ControlEvent event ) {
2386
    public void controlResized( ControlEvent event ) {
2367
      Tree tree = ( Tree )event.widget;
2387
      updateAllItems();
2368
      tree.updateAllItems();
2388
      updateScrollBars();
2369
      tree.updateScrollBars();
2389
      adjustTopIndex();
2390
      showSelection();
2370
    }
2391
    }
2371
  }
2392
  }
2372
2393

Return to bug 370752