How to get flashing on OS task bar work? [message #466712] |
Mon, 16 January 2006 01:46 |
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 |
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 |
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.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04866 seconds