|
Re: Invalid Thread Access [message #525867 is a reply to message #525864] |
Thu, 08 April 2010 05:49 |
Daniel Krügler Messages: 853 Registered: July 2009 |
Senior Member |
|
|
On 08.04.2010 06:57, daitkarsachin wrote:
> Hi all,
> I have to run a program which will run in parallel to my RCP
> application. I used following statement in
> ApplicationWorkbenchWindowAdvisor class
>
> ...
> public void preWindowOpen() {
> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
> configurer.setInitialSize(new Point(400, 300));
> configurer.setShowCoolBar(false);
> configurer.setShowStatusLine(false);
> configurer.setTitle("RCP Application");
> Thread t=new Thread(new StreamConnection1(configurer.getWindow()));
At this point it would help, if you say, *which* particular
operation fails.
> But it gives invalid thread access exception. Later i modified this
> statement to
> Desktop.getDefault(). asyncExec (new
> StreamConnection1(configurer.getWindow()));
Do you mean
Display.getDefault.asyncExec?
But again: This description does still not say, what kind of operation
is failing.
> but problem still persists. please help me to solve this problem. I am
> sendinng IWindowWorkbench object as an parameter so that my parallel
> running process will update the view at runtime whenever some other
> process passes value to it.
You are in the preOpen function. The docs say that the window's controls
have not been created, when this function is called:
"Performs arbitrary actions before the window is opened.
This method is called before the window's controls have been created.
Clients must not call this method directly (although super calls are
okay). The default implementation does nothing. Subclasses may override.
Typical clients will use the window configurer to tweak the workbench
window in an application-specific way; however, filling the window's
menu bar, tool bar, and status line must be done in
ActionBarAdvisor.fillActionBars, which is called immediately after this
method is called."
You didn't really say what you are trying to do in the UI thread,
but it looks as if you are trying to update a view, which cannot
exist at that point of time. What are you doing to access the view?
If you want to update a view, why don't you register such a
refresher in the init or createPartControl method of this particular
view?
Greetings from Bremen,
Daniel Krügler
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03550 seconds