Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:30 Go to next message
Lukas Zapletal is currently offline Lukas ZapletalFriend
Messages: 33
Registered: July 2009
Member
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 21:38 Go to previous message
Jacek Pospychala is currently offline Jacek PospychalaFriend
Messages: 159
Registered: July 2009
Senior Member
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: Fri Apr 26 10:26:52 GMT 2024

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

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

Back to the top