| Summary: | cocoa icon problem | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Andre Weinand <andre_weinand> | ||||||||
| Component: | SWT | Assignee: | Scott Kovatch <skovatch> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Silenio Quarti <Silenio_Quarti> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | skovatch | ||||||||
| Version: | 3.6 | ||||||||||
| Target Milestone: | 3.7 M2 | ||||||||||
| Hardware: | Macintosh | ||||||||||
| OS: | Mac OS X | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 172662 [details]
cocoa icon problem
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. 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. 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();
}
}
---------------
yes, the snippet shows the note icon and prints this to the console: Note icon file type = 'note' Created attachment 177278 [details]
Fix
Used a different IconRef/NSImage combination for retrieving the system icons. Fixed > 20100823. |
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.