Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317872 - cocoa icon problem
Summary: cocoa icon problem
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Scott Kovatch CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 14:35 EDT by Andre Weinand CLA
Modified: 2010-09-15 16:57 EDT (History)
1 user (show)

See Also:


Attachments
cocoa icon problem (54.35 KB, image/png)
2010-06-24 14:35 EDT, Andre Weinand CLA
no flags Details
cocoa icon problem (118.28 KB, image/png)
2010-06-24 14:38 EDT, Andre Weinand CLA
no flags Details
Fix (12.52 KB, patch)
2010-08-23 18:29 EDT, Scott Kovatch CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Weinand CLA 2010-06-24 14:35:39 EDT
Created attachment 172660 [details]
cocoa icon problem

Eclipse 3.6 Cocoa seems to have problems with certain (SWT?) images.
See attached screenshot.

The images are shown correctly in Carbon.
Comment 1 Andre Weinand CLA 2010-06-24 14:38:14 EDT
Created attachment 172662 [details]
cocoa icon problem
Comment 2 Scott Kovatch CLA 2010-08-23 17:04:57 EDT
Do you have an application that has claimed files of type 'note'? Change some file to have an extension of '.note'. I bet the icon changes to the same one as in the Cocoa screen shot.

I think I have a fix, but I want to check first on how we get into this state.
Comment 3 Andre Weinand CLA 2010-08-23 17:24:18 EDT
I've created a "abc.note" file but its Finder icon is just a blank document icon.
So I'm very sorry that I cannot confirm your hypothesis.
But the problem seems to be a specific problem of my Mac: other Mac users in Zurich do not have this problem.
Comment 4 Scott Kovatch CLA 2010-08-23 17:46:06 EDT
Run this app and see what you get. This is how we are getting the note icon, but I suspect on your system it will show the strange icon and hopefully the owning application.

-------------
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.cocoa.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class NoteIconTest {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new GridLayout(1, false));
		NSString fileType = new NSString (OS.NSFileTypeForHFSTypeCode (OS.kAlertNoteIcon));
		System.out.println ("Note icon file type = " + fileType.getString());
		NSImage nsImage = NSWorkspace.sharedWorkspace ().iconForFileType (fileType);
		if (nsImage != null) nsImage.retain();
		Image img = Image.cocoa_new(display, SWT.ICON, nsImage);
		Label label = new Label(shell, SWT.NONE);
		label.setImage(img);

		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}

---------------
Comment 5 Andre Weinand CLA 2010-08-23 18:04:36 EDT
yes, the snippet shows the note icon and prints this to the console:
Note icon file type = 'note'
Comment 6 Scott Kovatch CLA 2010-08-23 18:29:13 EDT
Created attachment 177278 [details]
Fix
Comment 7 Scott Kovatch CLA 2010-08-23 18:30:20 EDT
Used a different IconRef/NSImage combination for retrieving the system icons.

Fixed > 20100823.