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 278346 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/swt/internal/widgets/ListModel.java (+5 lines)
Lines 277-282 Link Here
277
        if( i < length - 1 ) {
277
        if( i < length - 1 ) {
278
          System.arraycopy( selection, i + 1, newSelection, i, length - i - 1 );
278
          System.arraycopy( selection, i + 1, newSelection, i, length - i - 1 );
279
        }
279
        }
280
        for( int j = 0; j < newSelection.length; j++ ) {
281
          if( newSelection[ j ] > index ) {
282
            newSelection[ j ] = newSelection[ j ] - 1;
283
          }
284
        }
280
        selection = newSelection;
285
        selection = newSelection;
281
        found = true;
286
        found = true;
282
      }
287
      }
(-)src/org/eclipse/swt/widgets/List_Test.java (-1 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH.
2
 * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 757-762 Link Here
757
    assertEquals( 0, list.getSelectionIndices()[ 0 ] );
757
    assertEquals( 0, list.getSelectionIndices()[ 0 ] );
758
    assertEquals( 1, list.getSelectionIndices()[ 1 ] );
758
    assertEquals( 1, list.getSelectionIndices()[ 1 ] );
759
    assertEquals( 2, list.getSelectionIndices()[ 2 ] );
759
    assertEquals( 2, list.getSelectionIndices()[ 2 ] );
760
761
    // Ensure that no selection indices after remove all items one by one
762
    list.removeAll();
763
    list.add( "item0" );
764
    list.add( "item1" );
765
    list.add( "item2" );
766
    list.select( new int[] { 0, 1, 2 } );
767
    String[] listSelection = list.getSelection();
768
    for( int i = 0; i < listSelection.length; i++ ) {
769
      list.remove( listSelection[ i ] );
770
    }
771
    assertEquals( 0, list.getSelectionCount() );
772
773
    // Ensure that no selection indices after remove selected items one by one
774
    list.removeAll();
775
    list.add( "item0" );
776
    list.add( "item1" );
777
    list.add( "item2" );
778
    list.select( new int[] { 0, 1 } );
779
    listSelection = list.getSelection();
780
    for( int i = 0; i < listSelection.length; i++ ) {
781
      list.remove( listSelection[ i ] );
782
    }
783
    assertEquals( 0, list.getSelectionCount() );
760
  }
784
  }
761
785
762
  public void testSetItem() {
786
  public void testSetItem() {

Return to bug 278346