Messages.get() within IRunnableWithProgress [message #119831] |
Tue, 27 January 2009 13:14  |
Eclipse User |
|
|
|
Hi,
I have a wizard that does some long runnning operation in method
"performFinish".
This is currently doen with the following call:
getContainer().run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
monitor.beginTask(Messages.get().myText, IProgressMonitor.UNKNOWN);
}
The call to Messages.get() raises the following exception:
java.lang.IllegalStateException: No context available outside of the request
service lifecycle.
Is there any solution to this or am I doing something wrong?
Regards,
Markus
|
|
|
|
|
Re: Messages.get() within IRunnableWithProgress [message #120314 is a reply to message #120170] |
Tue, 03 February 2009 10:12   |
Eclipse User |
|
|
|
Markus,
if you read the method signature, you will know the answer: very
unlikely. The method requires a disply to be passed in and this
isn't usually available in your Messages implementation.
HTH
Rüdiger
Markus Krüger wrote:
> Hi,
>
> can I always do this in the class Messages of my plugin?
>
> Regards,
> Markus
>
> "Rüdiger Herrmann" <rherrmann@eclipsesource.com> schrieb im Newsbeitrag
> news:gls12f$4dv$1@build.eclipse.org...
>> Markus,
>>
>> your code tries to access session-information but isn't run from the UI
>> thread (the only thread that has a session context associated by default).
>>
>> The soltion is to wrap your code in a Runnable and have it executed by
>> UICallBack#runNonUIThreadWithFakeContext().
>>
>> Please also see this thread:
>> http://dev.eclipse.org/newslists/news.eclipse.technology.rap /msg01311.html
>>
>> HTH
>> Rüdiger
>>
>>
>>
>> Markus Krüger wrote:
>>> Hi,
>>> I have a wizard that does some long runnning operation in method
>>> "performFinish".
>>> This is currently doen with the following call:
>>> getContainer().run(true, true, new IRunnableWithProgress() {
>>>
>>> public void run(IProgressMonitor monitor) throws
>>> InvocationTargetException {
>>>
>>> monitor.beginTask(Messages.get().myText, IProgressMonitor.UNKNOWN);
>>>
>>> }
>>>
>>> The call to Messages.get() raises the following exception:
>>>
>>> java.lang.IllegalStateException: No context available outside of the
>>> request service lifecycle.
>>>
>>> Is there any solution to this or am I doing something wrong?
>>>
>>> Regards,
>>>
>>> Markus
>>>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.09737 seconds