|
|
Re: Progress on do save [message #131293 is a reply to message #130895] |
Tue, 05 May 2009 06:54 |
Rüdiger Herrmann Messages: 581 Registered: July 2009 |
Senior Member |
|
|
one would run the actual save operation in a job/background thread.
Think of your code in RCP, the UI would freeze if you run a long
running operation in the UI thread.
Markus Krüger wrote:
> Hi,
>
> i created an edit with "save" and "save as..." possible. Now since the
> "save" needs some time I actually expected a progress monitor to show up or
> see the progress in the status line (status line is activated). There is no
> progress shown at all, just a cursor indicating that it is busy.
>
> Is this a bug (did a search, but could not find one related to it), or am I
> doing something wrong?
>
> You can implement the following mehtods is FooEditor of the Demo:
> @Override
>
> public void doSave( final IProgressMonitor monitor ) {
>
> monitor.beginTask( "Saveing...", IProgressMonitor.UNKNOWN );
>
> try {
>
> Thread.sleep( 10000 );
>
> } catch( InterruptedException exception ) {
>
> // TODO Auto-generated catch block
>
> exception.printStackTrace();
>
> }
>
> editor.setDirty( false );
>
> treeeditor.setDirty( false );
>
> monitor.done();
>
> }
>
>
> @Override
>
> public void doSaveAs() {
>
> try {
>
> getSite().getWorkbenchWindow().run( false,
>
> false,
>
> new IRunnableWithProgress() {
>
>
> public void run( IProgressMonitor monitor )
>
> throws InvocationTargetException,
>
> InterruptedException
>
> {
>
> doSave( monitor );
>
> }
>
> } );
>
> } catch( InvocationTargetException exception ) {
>
> // TODO Auto-generated catch block
>
> exception.printStackTrace();
>
> } catch( InterruptedException exception ) {
>
> // TODO Auto-generated catch block
>
> exception.printStackTrace();
>
> }
>
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03507 seconds