How to make a modal Job ? [message #542634] |
Fri, 25 June 2010 09:52  |
Eclipse User |
|
|
|
Hello guyz,
I would like to create a modal Job, that is to say :
* The job need to run in a worker thread as any other job
* I only need the "progress" job dialog to be modal, thus not allowing the user to interact with the workbench until the job has finished
Simple need, but looks hard to implement.
I was considering implementing a UIJob wrapper which would fire a regular job, listens for completion, and prevents user actions while dispatching UI events...
But I think if I dispatch UI events the user will be able to interact with the workbench (so this will be helpless) and if I do not dispatch the UI will look like "frozen", and I definitly don't want this either.
Any idea ?
Thanks,
Christophe
http://www.nextep-softwares.com
|
|
|
Re: How to make a modal Job ? [message #542740 is a reply to message #542634] |
Fri, 25 June 2010 14:35  |
Eclipse User |
|
|
|
Hello
Maybe this approach will help? (It's just a quick idea)
Greetings
> private class ButtonListener extends SelectionAdapter {
> @Override
> public void widgetSelected(SelectionEvent e) {
> super.widgetSelected(e);
>
> // Job starten
> try {
> PlatformUI.getWorkbench().getProgressService()
> .busyCursorWhile(new IRunnableWithProgress() {
> public void run(IProgressMonitor monitor) {
>
> try {
> monitor.beginTask("long running task ", 10);
> for (int i = 0; i < 10; i++) {
> Thread.currentThread().sleep(2000);
> monitor.worked(i);
> }
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
>
> }
> });
> } catch (InvocationTargetException e1) {
> e1.printStackTrace();
> } catch (InterruptedException e1) {
> e1.printStackTrace();
> }
> }
> }
>
Am 25.06.2010 15:52, schrieb Christophe Fondacci:
> Hello guyz,
>
> I would like to create a modal Job, that is to say :
> * The job need to run in a worker thread as any other job
> * I only need the "progress" job dialog to be modal, thus not allowing
> the user to interact with the workbench until the job has finished
>
> Simple need, but looks hard to implement.
> I was considering implementing a UIJob wrapper which would fire a
> regular job, listens for completion, and prevents user actions while
> dispatching UI events...
> But I think if I dispatch UI events the user will be able to interact
> with the workbench (so this will be helpless) and if I do not dispatch
> the UI will look like "frozen", and I definitly don't want this either.
>
> Any idea ?
>
> Thanks,
> Christophe
> http://www.nextep-softwares.com
>
|
|
|
Powered by
FUDForum. Page generated in 0.07735 seconds