Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Starting an RCP app invisibly
Starting an RCP app invisibly [message #463805] Thu, 15 February 2007 14:31 Go to next message
Eclipse UserFriend
Hi,

I'm trying to modify an RCP application such that when it launches, it
docks itself into the system tray and hides the main application window.
Double clicking the system tray icon will make the window open.

I've mostly been able to accomplish this effect by overriding the
behaviour of the WorkbenchWindowAdvisor (code below), however there is a
brief period where the window becomes visible before this code is executed.

Is there a way to prevent the window from becoming visible at all during
the workbench launching process, or is there a way to delay the
workbench window from opening?

Thanks,
Mark


public class MyWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
{
....
public boolean postWindowOpen ()
{
super.postWindowOpen ();

Shell shell = Display.getActiveShell ();
shell.setVisible (false);

// Create a system tray entry
...
}
}
Re: Starting an RCP app invisibly [message #463810 is a reply to message #463805] Thu, 15 February 2007 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Are you using the org.eclipse.core.runtime.applications extension to
launch your own IApplication? Most of the Application classes generated
by PDE just call PlatformUI.createAndRunWorkbench(). You could write
your own IApplication so that it create the tray item, and add a
listener to it to launch the workbench when appropriate. Then just run
the standard SWT event loop:

while (!display.isDisposed())
if (!display.readAndDispatch())
display.sleep();

Matthew

Mark Siegel wrote:
> Hi,
>
> I'm trying to modify an RCP application such that when it launches, it
> docks itself into the system tray and hides the main application window.
> Double clicking the system tray icon will make the window open.
>
> I've mostly been able to accomplish this effect by overriding the
> behaviour of the WorkbenchWindowAdvisor (code below), however there is a
> brief period where the window becomes visible before this code is executed.
>
> Is there a way to prevent the window from becoming visible at all during
> the workbench launching process, or is there a way to delay the
> workbench window from opening?
>
> Thanks,
> Mark
>
>
> public class MyWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
> {
> ...
> public boolean postWindowOpen ()
> {
> super.postWindowOpen ();
>
> Shell shell = Display.getActiveShell ();
> shell.setVisible (false);
>
> // Create a system tray entry
> ...
> }
> }
Re: Starting an RCP app invisibly [message #463813 is a reply to message #463810] Thu, 15 February 2007 16:28 Go to previous message
Eclipse UserFriend
Thanks Matt, I'll give this a shot. It sounds like this should work.

Mark

Matthew Hall wrote:
> Are you using the org.eclipse.core.runtime.applications extension to
> launch your own IApplication? Most of the Application classes generated
> by PDE just call PlatformUI.createAndRunWorkbench(). You could write
> your own IApplication so that it create the tray item, and add a
> listener to it to launch the workbench when appropriate. Then just run
> the standard SWT event loop:
>
> while (!display.isDisposed())
> if (!display.readAndDispatch())
> display.sleep();
>
> Matthew
>
> Mark Siegel wrote:
>> Hi,
>>
>> I'm trying to modify an RCP application such that when it launches, it
>> docks itself into the system tray and hides the main application
>> window. Double clicking the system tray icon will make the window open.
>>
>> I've mostly been able to accomplish this effect by overriding the
>> behaviour of the WorkbenchWindowAdvisor (code below), however there is
>> a brief period where the window becomes visible before this code is
>> executed.
>>
>> Is there a way to prevent the window from becoming visible at all
>> during the workbench launching process, or is there a way to delay the
>> workbench window from opening?
>>
>> Thanks,
>> Mark
>>
>>
>> public class MyWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
>> {
>> ...
>> public boolean postWindowOpen ()
>> {
>> super.postWindowOpen ();
>>
>> Shell shell = Display.getActiveShell ();
>> shell.setVisible (false);
>>
>> // Create a system tray entry
>> ...
>> }
>> }
Previous Topic:How to shutdown RCP from within
Next Topic:n00b RCP deployment problem
Goto Forum:
  


Current Time: Tue Apr 15 03:10:36 EDT 2025

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

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

Back to the top