Starting an RCP app invisibly [message #463805] |
Thu, 15 February 2007 14:31  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
>> ...
>> }
>> }
|
|
|
Powered by
FUDForum. Page generated in 0.03341 seconds