Also the code you modified below doesn't work with the same error...
is there you do some work, without freezing the interface. But I can't
find working examples.
well.
I guess I 'm missing something of the deeper theory.
Hi,
I did some asking around, this is what a friend of mine came up with....
You have to implement a job, org.eclipse.core.runtime.jobs.Job . You
have
run(IprogressMonitor pm) there, where you implement the method and
change
whatever you want through pm. You can add listeners if you want to do
something after the job is done.
And your code from first post, reworked some
Display display = Display.getCurrent();
if (display == null)
{
display = Display.getDefault();
}
display.asyncExec(new Runnableevent)
{
public void run()
{
IWorkbench wb = PlatformUI.getWorkbench();
IProgressService ps = wb.getProgressService();
ps.busyCursorWhile(new IRunnableWithProgress(){
public void run( IProgressMonitor pm ) {
doMyCodeWithMonitorActivity()
}
});
}
});
I hope this helps....
Zlatko.
-----Original Message-----
Sent: Monday, April 23, 2007 2:42 PM
To: Zlatko Perenda
Cc: 'User-friendly Desktop Internet GIS'
Subject: Re: [udig-devel] how to start threads with monitor?
Hi Zlatko,
that is indeed what I am doing to make it work for now (the asyncExec I
mean), but that doesn't supply my the so much loved monitor...
Where do I get the monitor from?
Thanks,
Andrea
Zlatko Perenda probaly wrote:
Hm, seems like you are accesing UI thread, from another....
Try Display.asyncExec(runnable), and let runnable do the neccesary
work. I
think this should work.
-----Original Message-----
Antonello
Sent: Monday, April 23, 2007 2:25 PM
To: User-friendly Desktop Internet GIS
Subject: [udig-devel] how to start threads with monitor?
I know this is more a rcp question than a udig, but I'm not able to
add
progress tracking to my actions.
The tool extention point doesn't supply a monitor and whenever I try
somethin g like:
IWorkbench wb = PlatformUI.getWorkbench();
IProgressService ps = wb.getProgressService();
ps.busyCursorWhile(new IRunnableWithProgress(){
public void run( IProgressMonitor pm ) {
doMyCodeWithMonitorActivity()
}
});
I get an Invalid thread access exception.
Any hint?
Thanks in advance,
Andrea
_______________________________________________
User-friendly Desktop Internet GIS (uDig)