Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to get flashing on OS task bar work?
How to get flashing on OS task bar work? [message #466712] Mon, 16 January 2006 01:46 Go to next message
Eclipse User
Originally posted by: rain_zzj.zdus.com

Hi, every one
I got a trouble to make my app flash on OS task bar:
My app is keeping receiving messages from JMS server; for every message it
received, I'd like it flash on the OS task bar when the app window is
minimized or unactive, just like the behaviour MSN does when I receive a
message.
I use the following statement to get it work:
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.window.getShell().forceActive();
Everything goes fine when the app is running on Win2000.
But on Winxp, the app acts totally differently, the backend RCP
application will always popup to interrupt the user's current activity on
other application.

Any one has some idea on it?

Another question followed-up: It seems the statement does not work at all:
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.window.getShell().setActive();
So what's the difference between them?

It may be a bussiness of RCP, but I was told that I could probably find
help here.

Thanks in advance,
Jason
Re: How to get flashing on OS task bar work? [message #466779 is a reply to message #466712] Tue, 17 January 2006 16:24 Go to previous messageGo to next message
Eclipse User
Originally posted by: rain_zzj.zdus.com

I found the following comment on this issue in the Plugin-in Developer
Guide of Help Content:

public void run() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
IWorkbenchWindow window =

PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
// Bring the Workbench window to the top of other
// windows; On some Windows systems, it will only
flash
// the Workbench icon on the task bar
Shell shell = window.getShell();
shell.setMinimized(false);
shell.forceActive();
// Open a message dialog
MessageDialog.openInformation(
window.getShell(),
"Hello World.",
"Hello World.");
}
}
});
}
}

Does someone have any ideas?
Re: How to get flashing on OS task bar work? [message #466817 is a reply to message #466779] Tue, 17 January 2006 21:46 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel Spiewak
Messages: 263
Registered: July 2009
Senior Member
Flashing in windows is based on the application requiring a message to be delivered. This is done in a very specific way through WFC which is not mirrored through SWT. The best way to simulate the behavior is Shell#forceActive() As has been pointed out, this does have the unfortunate consequence of putting the window on top of the others occaisionally. Also, if the window is the *only* window open and is then minimized, windows won't even flash the toolbar on forceActive(), it will simply ignore the call.

As was pointed out, it is possible to force a flash by using MessageBox, but then this pulls up an unsightly and undesired message box which must be closed by the user. In other words, there really isn't a good way to do this in either Swing or SWT. If you really, really need this functionality and are willing to tie yourself to win32, build your own method which calls the native methods to force the flash. The window control handle is in Shell#handle.
Re: How to get flashing on OS task bar work? [message #466848 is a reply to message #466817] Wed, 18 January 2006 08:09 Go to previous messageGo to next message
Eclipse User
Originally posted by: rain_zzj.zdus.com

Thank you very much.
Maybe we have turn to JNI for help.
Re: How to get flashing on OS task bar work? [message #466854 is a reply to message #466817] Wed, 18 January 2006 12:53 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex Blewitt
Messages: 946
Registered: July 2009
Senior Member
Might be useful to have, though. Mac OS X supports the ability to bounce the icon in the dock. Is there an XWindows equivalent too?

Alex.
Re: How to get flashing on OS task bar work? [message #466857 is a reply to message #466854] Wed, 18 January 2006 14:40 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel Spiewak
Messages: 263
Registered: July 2009
Senior Member
Unfortunately, there isn't a 'normal' XWindows equivalent. Ubuntu has something similar, with a flashing (or pulsating) task bar entry, but I haven't seen anything like that in any other distro's Gnome and I'm almost a hundred percent positive that there's no special API for it. Curiously enough, Eclipse seems to pulsate in the Ubuntu task bar as appropriately as other Gnome apps. Ubuntu probably triggers it off of the creation of modal dialogs on the parent shell. Just a guess...

AFAIK, the only problem with OS X's dock icon bounce functionality is that the API to interface with it is in Cocoa. The Mac port is Carbon only. While rumor has it that Apple is working on a Cocoa port, there isn't one yet. I suppose that the SWT team could do what the did with Spinner and use the Carbon-Cocoa bridge. But that seems a bit clumsy to me. Either way, it would be nice to have, but I don't think we're going to get it. :-)
Re: How to get flashing on OS task bar work? [message #466891 is a reply to message #466857] Wed, 18 January 2006 23:31 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex Blewitt
Messages: 946
Registered: July 2009
Senior Member
Cocoa is way cooler than Carbon. You get access to services and a decent OO language instead of all that nasty C stuff ...

But anyhoo, there's a notification manager in Carbon that is used to interact with the user. Specifically:

"In Mac OS X version 10.1 and later, mark and alert notifications are both supported. If you set the nmMark field to a non-zero value, your process icon will bounce in the dock."

http://developer.apple.com/documentation/Carbon/Reference/No tification_Manager/Reference/reference.html

Don't know if this would work (I don't have any Carbon applications to play with) but it might do the job.

Alex.
Re: How to get flashing on OS task bar work? [message #466948 is a reply to message #466891] Thu, 19 January 2006 18:16 Go to previous messageGo to next message
Ivan is currently offline Ivan
Messages: 149
Registered: July 2009
Senior Member
Howbout talk to jniwrapper.com ? They got Cocoa-Java library...
Re: How to get flashing on OS task bar work? [message #466960 is a reply to message #466948] Fri, 20 January 2006 03:06 Go to previous message
Alex Blewitt is currently offline Alex Blewitt
Messages: 946
Registered: July 2009
Senior Member
It's not a problem talking to Cocoa; you can do that on Mac OS X anyway. The problem is that Cocoa and Carbon applications are completely different. (Think the difference between a Gnome app and a KDE app -- or on windows, the difference between Firefox and Internet Explorer.) They both achieve roughly the same goal, but do it in completely different ways.

So knowing how to flash a Cocoa app's icon isn't going to help Eclipse, which is a Carbon-based life form. The notification manager Carbon API might help this.

Alex.
Previous Topic:Force Browser Repaint
Next Topic:Setting font size (pocket pc)
Goto Forum:
  


Current Time: Tue Oct 21 05:41:33 GMT 2014

Powered by FUDForum. Page generated in 0.06680 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software