|
Re: ProgressBar not updating when running a job the second time [message #110927 is a reply to message #110763] |
Fri, 31 October 2008 07:17 |
Eclipse User |
|
|
|
Originally posted by: ifurnadjiev.innoopract.com
Hi Gunnar,
I can't find anything wrong with your code. I've managed to reproduce
exactly what you described. Please file a bug for easy issue tracking.
Best,
Ivan
Gunnar Wurl wrote:
> Hi,
>
> I tried some tutorial on eclipse jobs and displaying its progress in a
> progress bar. I am setting the job to a user job so that the progress
> is displayed. It works fine for the first time. The progress bar shows
> up and shows the progress in its main and in its detail part. When
> starting the job the second time the main part keeps showing the
> progress but the detail part freezes as i open it.
> Here is some code to show what i am doing:
>
> button2.addSelectionListener( new SelectionListener()
> {
>
> @Override
> public void widgetDefaultSelected( SelectionEvent e )
> {
> // TODO Auto-generated method stub
> }
>
> @Override
> public void widgetSelected( SelectionEvent e )
> {
> Job job = new Job( "My Job" )
> {
> @Override
> protected IStatus run( IProgressMonitor monitor )
> {
> try
> {
> monitor.beginTask( "Printing messages", 10 );
> for( int i = 0; i < 10; i++ )
> {
> System.out.println( "Hello World (from a background
> job) " + i );
> try
> {
> Thread.sleep( 1000 );
> }
> catch( InterruptedException e )
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> monitor.worked( 1 );
> if( monitor.isCanceled() ) return Status.CANCEL_STATUS;
> }
> return Status.OK_STATUS;
> }
> finally
> {
> monitor.done();
> }
> }
> };
>
> job.addJobChangeListener( new JobChangeAdapter()
> {
> public void done( IJobChangeEvent event )
> {
> if( event.getResult().isOK() ) System.out.println( "Job
> completed successfully" );
> else
> System.out.println( "Job did not complete successfully" );
> }
> } );
> job.setUser( true );
> job.schedule();
> }
> } );
>
> The code works fine in a RCP example. So I would like to know if I am
> doing something wrong and its maybe just a coincidence that it works
> in RCP.
>
> Thanks in advance
>
> Gunnar
>
|
|
|
Re: ProgressBar not updating when running a job the second time [message #111116 is a reply to message #110927] |
Mon, 03 November 2008 08:22 |
Eclipse User |
|
|
|
Originally posted by: ifurnadjiev.innoopract.com
Here is the bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=253143
Best,
Ivan
Ivan Furnadjiev wrote:
> Hi Gunnar,
>
> I can't find anything wrong with your code. I've managed to reproduce
> exactly what you described. Please file a bug for easy issue tracking.
>
> Best,
> Ivan
>
> Gunnar Wurl wrote:
>
>> Hi,
>>
>> I tried some tutorial on eclipse jobs and displaying its progress in a
>> progress bar. I am setting the job to a user job so that the progress
>> is displayed. It works fine for the first time. The progress bar shows
>> up and shows the progress in its main and in its detail part. When
>> starting the job the second time the main part keeps showing the
>> progress but the detail part freezes as i open it.
>> Here is some code to show what i am doing:
>>
>> button2.addSelectionListener( new SelectionListener()
>> {
>>
>> @Override
>> public void widgetDefaultSelected( SelectionEvent e )
>> {
>> // TODO Auto-generated method stub
>> }
>>
>> @Override
>> public void widgetSelected( SelectionEvent e )
>> {
>> Job job = new Job( "My Job" )
>> {
>> @Override
>> protected IStatus run( IProgressMonitor monitor )
>> {
>> try
>> {
>> monitor.beginTask( "Printing messages", 10 );
>> for( int i = 0; i < 10; i++ )
>> {
>> System.out.println( "Hello World (from a background
>> job) " + i );
>> try
>> {
>> Thread.sleep( 1000 );
>> }
>> catch( InterruptedException e )
>> {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> monitor.worked( 1 );
>> if( monitor.isCanceled() ) return Status.CANCEL_STATUS;
>> }
>> return Status.OK_STATUS;
>> }
>> finally
>> {
>> monitor.done();
>> }
>> }
>> };
>>
>> job.addJobChangeListener( new JobChangeAdapter()
>> {
>> public void done( IJobChangeEvent event )
>> {
>> if( event.getResult().isOK() ) System.out.println( "Job
>> completed successfully" );
>> else
>> System.out.println( "Job did not complete successfully" );
>> }
>> } );
>> job.setUser( true );
>> job.schedule();
>> }
>> } );
>>
>> The code works fine in a RCP example. So I would like to know if I am
>> doing something wrong and its maybe just a coincidence that it works
>> in RCP.
>>
>> Thanks in advance
>>
>> Gunnar
>>
>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02900 seconds