Project: SWT
Bug 281725 [Cocoa SWT] TabItem.setImage() not working
Reported: 2009-06-26 18:30:56 | Status: resolved fixed

Build ID: I20090611-1540 Steps To Reproduce: Under the Cocoa x86_64 Mac OS X version of Eclipse 3.5, TabItem images don't appear. Under the Carbon version of 3.5, they do. The code below reproduces the problem -- it works on both platforms, but the tabs are image-less on Carbon. (I don't know if this is a limitation with the native Cocoa widgets or not; if it is, perhaps a Javadoc note that images aren't supported on all platforms would help.) Shell shell = new Shell(); TabFolder tf = new TabFolder(shell, SWT.BORDER); tf.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) ); TabItem ti = new TabItem(tf, SWT.NONE); ti.setControl( new Composite(tf, SWT.NONE) ); ti.setText("One"); ti.setImage( JFaceResources.getImage(Dialog.DLG_IMG_HELP) ); ti = new TabItem(tf, SWT.NONE); ti.setControl( new Composite(tf, SWT.NONE) ); ti.setText("Two"); ti.setImage( JFaceResources.getImage(Dialog.DLG_IMG_HELP) ); tf.pack(); shell.pack(); shell.open();

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSTabViewItem.java bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/SWTTabViewItem.java bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Display.java bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabFolder.java bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/TabItem.java bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Widget.java