Bring RCP App to Top

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Bring RCP App to Top

Postby cebarne2 » Thu Jul 13, 2006 5:19 am

I am using SWT designer in the creation of my RCP application. I have built several views, all populated by several concurrent Runtime Jobs. One particular view and job monitors several servers and reports when a server breaks-down. The desired behavior would be to bring the RCP app to the foreground when this occurs. I have tried the following line:

Code: Select all
Display.getDefault().asyncExec(new Runnable() {
   public void run() {
      if (fBadServer) {
         viewer.getTable().setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
         //bring window to foreground
         PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().forceFocus();
      } else
         viewer.getTable().setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
   }
});


This doesn't seem to be very reliable. I've witnessed it give the window focus, but more often it doesn't really do anything.

Any suggestions?

Thanks
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Re: Bring RCP App to Top

Postby Eric Clayberg » Thu Jul 13, 2006 9:53 am

Have you tried opening your window with the SWT.ON_TOP style? E.g., new Shell(SWT.SHELL_TRIM | SWT.ON_TOP);

You might also look at the Shell.setActive() method and the commented out code in the Decorations.bringToTop() method.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby cebarne2 » Thu Jul 13, 2006 11:19 am

Thanks Eric!

This helps a lot. That is working for bringing the window to the foreground. I'll laso be trying to find information about making the taskbar icon flash if the window is minimized, and even creating a dynamic tray icon.

As always, I welcome your advice.

Thanks again,
Chad
cebarne2
 
Posts: 67
Joined: Tue Sep 23, 2003 10:11 am
Location: Cedar Rapids, IA

Postby Eric Clayberg » Thu Jul 13, 2006 1:56 pm

cebarne2 wrote:I'll laso be trying to find information about making the taskbar icon flash if the window is minimized, and even creating a dynamic tray icon.

I don't know how to do either of those.

I would suggest asking on the Eclipse SWT and/or RCP newsgroups.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 1 guest