Tale of two display [message #330707] |
Mon, 11 August 2008 09:41 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03816 seconds