Blocking command execution (wainting for results) [message #481728] |
Mon, 24 August 2009 06:37 |
Eclipse User |
|
|
|
Originally posted by: eclipsercp.nurfuerspam.de
Hi,
I am wondering how it is possible to execute a command in a way that the
application waits for the command to complete.
At the moment I execute the command like this:
IHandlerService service = (IHandlerService) Workbench.getInstance()
getService(IHandlerService.class);
result = service.executeCommand(commandName, event);
// do something with the result
This makes the command to be executed in another thread some time later.
What I want is to execute the command immediately and wait for it to
complete. Then I want to continue working with the commands result.
Is this possible?
Thanks,
Krid
|
|
|
|
Re: Blocking command execution (wainting for results) [message #481756 is a reply to message #481733] |
Mon, 24 August 2009 08:22 |
Eclipse User |
|
|
|
Originally posted by: eclipsercp.nurfuerspam.de
Hi and thanks for your reply,
my problem is not to execute a job asynchronously but to execute a Eclipse
command synchronously!
Krid
Charlie Kelly wrote:
> Hello Krid,
> See the "Jobs" API, in particular workspace job.
> Jobs run asychronously from the UI thread.
> You will need a "JobAdapter" to process your results
> (possibly using an AsynchExec to update UI elements).
> Charlie
|
|
|
Re: Blocking command execution (wainting for results) [message #481769 is a reply to message #481756] |
Mon, 24 August 2009 09:13 |
|
I think you've some miss on tracing your code flow.
Why do you think command will be executed on separated thread?
Command is not executed on separated thread except you invoke that in
separated thread. At almost, They are executed on main UI thread,
because handlers have high chance to fire event that needs to updating UI.
If you just give complicate and slow codes in handler then You can see
UI which is not respond while.
So, just describe your command execution and handling result in same
code block in sequence. that's no problem. Whatever job or not.
Krid wrote:
> Hi and thanks for your reply,
>
> my problem is not to execute a job asynchronously but to execute a
> Eclipse command synchronously!
>
> Krid
>
> Charlie Kelly wrote:
>
>> Hello Krid,
>
>> See the "Jobs" API, in particular workspace job.
>
>> Jobs run asychronously from the UI thread.
>> You will need a "JobAdapter" to process your results
>> (possibly using an AsynchExec to update UI elements).
>
>> Charlie
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03096 seconds