View | Details | Raw Unified | Return to bug 223944
Collapse All | Expand All

(-)Tree.java.original (-2 / +8 lines)
Lines 3526-3538 Link Here
3526
3526
3527
int imageIndex (Image image, int index) {
3527
int imageIndex (Image image, int index) {
3528
	if (image == null) return OS.I_IMAGENONE;
3528
	if (image == null) return OS.I_IMAGENONE;
3529
	boolean updateImageList;
3529
	if (imageList == null) {
3530
	if (imageList == null) {
3530
		Rectangle bounds = image.getBounds ();
3531
		Rectangle bounds = image.getBounds ();
3531
		imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height);
3532
		imageList = display.getImageList (style & SWT.RIGHT_TO_LEFT, bounds.width, bounds.height);
3533
		updateImageList = true;
3534
	} else {
3535
	    updateImageList = false;
3532
	}
3536
	}
3533
	int imageIndex = imageList.indexOf (image);
3537
	int imageIndex = imageList.indexOf (image);
3534
	if (imageIndex == -1) imageIndex = imageList.add (image);
3538
	if (imageIndex == -1) {
3535
	if (hwndHeader == 0 || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) == index) {
3539
	    imageIndex = imageList.add (image);
3540
	}
3541
	if (updateImageList && (hwndHeader == 0 || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) == index)) {
3536
		int /*long*/ hImageList = imageList.getHandle ();
3542
		int /*long*/ hImageList = imageList.getHandle ();
3537
		int /*long*/ hOldImageList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
3543
		int /*long*/ hOldImageList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
3538
		if (hOldImageList != hImageList) {
3544
		if (hOldImageList != hImageList) {
(-)TreeItem.java.original (-7 / +19 lines)
Lines 1634-1640 Link Here
1634
 * @since 3.1
1634
 * @since 3.1
1635
 */
1635
 */
1636
public void setImage (Image [] images) {
1636
public void setImage (Image [] images) {
1637
	checkWidget();
1637
1638
    /*
1639
     * It doesn't make sense to checkWidget() here because the method just
1640
     * delegates to another method and doesn't use the instance state before
1641
     * doing so i.e. if checkWidget() is at all necessary, it will be performed
1642
     * by the called method. 
1643
     */
1644
	// checkWidget();
1638
	if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
1645
	if (images == null) error (SWT.ERROR_NULL_ARGUMENT);
1639
	for (int i=0; i<images.length; i++) {
1646
	for (int i=0; i<images.length; i++) {
1640
		setImage (i, images [i]);
1647
		setImage (i, images [i]);
Lines 1684-1695 Link Here
1684
		images [index] = image;
1691
		images [index] = image;
1685
	}
1692
	}
1686
	if ((parent.style & SWT.VIRTUAL) != 0) cached = true;
1693
	if ((parent.style & SWT.VIRTUAL) != 0) cached = true;
1687
	
1694
1688
	/* Ensure that the image list is created */
1689
	//TODO - items that are not in column zero don't need to be in the image list
1690
	parent.imageIndex (image, index);
1691
	
1692
	if (index == 0) {
1695
	if (index == 0) {
1696
	    /* Ensure that the image list is created */
1697
	    parent.imageIndex (image, index);
1698
1693
		if ((parent.style & SWT.VIRTUAL) == 0 &&!cached && !parent.painted) {
1699
		if ((parent.style & SWT.VIRTUAL) == 0 &&!cached && !parent.painted) {
1694
			return;
1700
			return;
1695
		}
1701
		}
Lines 1714-1720 Link Here
1714
}
1720
}
1715
1721
1716
public void setImage (Image image) {
1722
public void setImage (Image image) {
1717
	checkWidget ();
1723
1724
    /*
1725
     * It doesn't make sense to checkWidget() here because the method just
1726
     * delegates to another method i.e. if checkWidget() is at all necessary, it
1727
     * will be performed by the called method. 
1728
     */
1729
	// checkWidget ();
1718
	setImage (0, image);
1730
	setImage (0, image);
1719
}
1731
}
1720
1732

Return to bug 223944