SUSHANTH JAYANTHI
SUSHANTH JAYANTHI

Reputation: 17

How to make my e4 swt app icon bounce in the Mac dock

i am trying to make my mac tray icon as suggested in How to make my app icon bounce in the Mac dock

this works fine with pure java applications and swings

but this doesn't works with e4 swt applications , how to make it bounce in this type applications

ref: pfa of the sample code in the following link https://bugs.eclipse.org/bugs/show_bug.cgi?id=321949

Upvotes: 0

Views: 253

Answers (1)

greg-449
greg-449

Reputation: 111142

Application.requestUserAttention works for me in an e4 application (Eclipse 4.3.2 on Mac 10.9.3 with Java 1.8 update 5).

Note: It only does something if the application is not the focused app. With the false parameter there is only one bounce, specify true to make it bounce until the app has focus.

Update:

You can also do this using the SWT Mac specific classes, like this:

private static final long sel_requestUserAttention_ = OS.sel_registerName("requestUserAttention:");

private static final int NSCriticalRequest = 0;
private static final int NSInformationalRequest = 10;

...

NSApplication app = NSApplication.sharedApplication();

OS.objc_msgSend(app.id, sel_requestUserAttention_, NSInformationalRequest);

Use NSInformationalRequest for a single bounce, NSCriticalRequest to bounce until the app receive focus.

Since this is Mac only SWT code you will have to put it in a plugin or fragment with a platform filter in the MANIFEST.MF such as:

Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )

Update:

The above code is for 64 bit SWT on Mac OSX, for 32 bit SWT use

private static final int sel_requestUserAttention_ = OS.sel_registerName("requestUserAttention:");

Upvotes: 1

Related Questions