Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Accessing the workbench from "outside" thread
Accessing the workbench from "outside" thread [message #461235] Sun, 07 January 2007 11:30 Go to next message
Eclipse UserFriend
Hello,

I have a WebStarted application that listens for incoming calls using this callback method:

listener = new javax.jnlp.SingleInstanceListener() {
public void newActivation(String args[]) {
// AN ACTIVATION
PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // is null
}
}

The problem is clear -- its called from "outside" thread and this is probably reason why

PlatformUI.getWorkbench().getActiveWorkbenchWindow()

returns null.

How can I notify the main thread about new event coming from outside? I need to open a new document that is coming as argument (I am using SingleInstanceListener from JNLP).

Btw I solved a very strange thing so I am posting it here for others: In case SingleInstanceService is not working for you you should notice the application distribuded over WebStart should not include the jnlp.jar (or javaws.jar in later versions). You must add this to classpath but only in compile time, not runtime! If you do the application won’t work and the listener won’t be called. Ever!

Thanks
Re: Accessing the workbench from "outside" thread [message #461245 is a reply to message #461235] Sun, 07 January 2007 16:38 Go to previous message
Eclipse UserFriend
have you tried this?

PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
System.out.println("inside:" +
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
}
});

there is also syncExec()

Jacek

Lukas Zapletal napisał(a):
> Hello,
>
> I have a WebStarted application that listens for incoming calls using this callback method:
>
> listener = new javax.jnlp.SingleInstanceListener() {
> public void newActivation(String args[]) {
> // AN ACTIVATION
> PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // is null
> }
> }
>
> The problem is clear -- its called from "outside" thread and this is probably reason why
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow()
>
> returns null.
>
> How can I notify the main thread about new event coming from outside? I need to open a new document that is coming as argument (I am using SingleInstanceListener from JNLP).
>
> Btw I solved a very strange thing so I am posting it here for others: In case SingleInstanceService is not working for you you should notice the application distribuded over WebStart should not include the jnlp.jar (or javaws.jar in later versions). You must add this to classpath but only in compile time, not runtime! If you do the application won’t work and the listener won’t be called. Ever!
>
> Thanks
Previous Topic:How can I read or write the file in jar?
Next Topic:get shell from jobs
Goto Forum:
  


Current Time: Sun Mar 16 06:12:21 EDT 2025

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

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

Back to the top