Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327365 - Need methods in internal Cocoa classes
Summary: Need methods in internal Cocoa classes
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Scott Kovatch CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-08 16:30 EDT by Prakash Rangaraj CLA
Modified: 2010-10-21 17:39 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prakash Rangaraj CLA 2010-10-08 16:30:25 EDT
I'm trying to make use of NSApplication.arrangeInFront & NSWindow.setRepresentedFilename for few mac tweaks. It would be great to have those methods in the SWT Cocoa internal classes (without them I'm unable to proceed).

These methods are not directly used in SWT, so there is no reason for SWT to add them. Thats why I decided to bribe with a beer for the person who adds these :-)
Comment 1 Scott Kovatch CLA 2010-10-08 20:32:58 EDT
Can't you just use OS.sel_registerName() to define them for yourself? They're just selectors. I guess they would be more convenient if they were callable from Java.

setRepresentedFileName is a feature I know folks have been looking for, so that's no problem at all. arrangeInFront implies you're adding a Window menu, or going to make one available. What are you adding there?
Comment 2 Prakash Rangaraj CLA 2010-10-09 01:39:27 EDT
(In reply to comment #1)
> Can't you just use OS.sel_registerName() to define them for yourself? They're
> just selectors. I guess they would be more convenient if they were callable
> from Java.

    For both the methods, I'm currently doing that.

// on the class level
private static final long sel_setRepresentedFilename = OS
			.sel_registerName("setRepresentedFilename:");

//elsewhere in a method
NSWindow nsWindow = window.getShell().view.window();
NSString filePathString = NSString.stringWith(path);
OS.objc_msgSend(nsWindow.id, sel_setRepresentedFilename, filePathString.id);

This is currently working fine for me. I'm on Cocoa 64 bit and not sure whether this will work fine in 32 bit, (where its int all over the methods instead of long). 


> setRepresentedFileName is a feature I know folks have been looking for, so
> that's no problem at all. arrangeInFront implies you're adding a Window menu,
> or going to make one available. What are you adding there?

     If you haven't noticed, Minimize & Zoom added to the Window menu in the recent Cocoa nightly builds. The last missing standard mac menu item in the Windows menu is 'Bring All to Front' one. (and a fix for Bug# 187052)
Comment 3 Scott Kovatch CLA 2010-10-12 12:53:32 EDT
Added arrangeInFront:, setRepresentedFilename: and setRepresentedURL:. One might be easier to use than the other.
Comment 4 Scott Kovatch CLA 2010-10-12 12:55:18 EDT
I forgot about 32 vs 64 bit. It will be easier to call these from Java, since the SWT hides that from you. Fixed > 20101012.
Comment 5 Prakash Rangaraj CLA 2010-10-12 13:19:54 EDT
Thanks Scott!

Remind me of the beer when we meet :-)