Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Tale of two display
Tale of two display [message #330707] Mon, 11 August 2008 09:41 Go to next message
Eclipse UserFriend
Originally posted by: puneet82sri.yahoo.com

Hi All,

I have a application that :
1. Reads data from database.
2. Write it to msword. I am using <b>org.eclipse.swt.ole.win32.OleFrame</b> for interacting with word. It requires a composite.

Both 1 & 2 are long running process. I need to show their progress. So when putting them in progress monitor bring 'Invalid thread access'.

After investigation it is found that <u>interacting with word is a gui operation</u>(uses a composite) and invoking it from a non-gui thread caused the exception.

I tried to use <u>Display.asysn(xxx) & Display.sysn(xxx)</u> method but even this didn't worked as 1 & 2 works in loop.

I even created a <b>new display</b> for the 2 process and dispose it once process is complete, but it works for the first time only. Running my application second time again gives 'invalid thread access'.

I am using draw2d for some drawing. So for the second time even the <u>drawing is done incomplete</u>.

Is there any solution for it ?

Thanks
Puneet
Re: Tale of two display [message #330708 is a reply to message #330707] Mon, 11 August 2008 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

Puneet Srivastava wrote:
> Hi All,
>
> I have a application that :
> 1. Reads data from database.
> 2. Write it to msword. I am using <b>org.eclipse.swt.ole.win32.OleFrame</b> for interacting with word. It requires a composite.
>
> Both 1 & 2 are long running process. I need to show their progress. So when putting them in progress monitor bring 'Invalid thread access'.
>
> After investigation it is found that <u>interacting with word is a gui operation</u>(uses a composite) and invoking it from a non-gui thread caused the exception.
>
> I tried to use <u>Display.asysn(xxx) & Display.sysn(xxx)</u> method but even this didn't worked as 1 & 2 works in loop.
>
> I even created a <b>new display</b> for the 2 process and dispose it once process is complete, but it works for the first time only. Running my application second time again gives 'invalid thread access'.
>
> I am using draw2d for some drawing. So for the second time even the <u>drawing is done incomplete</u>.
>
> Is there any solution for it ?
>
> Thanks
> Puneet
Try
workbench.getProgressService().runInUI()


--
Derek
Re: Tale of two display [message #330784 is a reply to message #330708] Wed, 13 August 2008 13:30 Go to previous message
Eclipse UserFriend
Originally posted by: puneet82sri.yahoo.com

> "workbench.getProgressService().runInUI() "
Seemed fine, but the problem with the drawing part still persists.

I need to <b>verify:</b>
1. Creating a new display and disposing it from eclipse workbench is correct ?

Try to explain my code:
I am running my code in a thread that is passed as IRunnableWithProgress to PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(tru e, false, thread) / PlatformUI.getWorkbench().getProgressService().busyCursorWhi le( thread);.

Following is done in:
Creating a new display object.
Creating a composite over new display for word automation.
After completing the process display is disposed.

At times it works fine. But occasionally bring SWTException on <u>disposing display object</u> and then all text from drawing editors disappears.

Plz comment

thanks
Puneet
Previous Topic:Text Highlighting
Next Topic:Re: Message Dialog default focus button
Goto Forum:
  


Current Time: Tue Oct 15 09:43:27 GMT 2024

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

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

Back to the top