Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ProgressBar not updating when running a job the second time
ProgressBar not updating when running a job the second time [message #110763] Wed, 29 October 2008 12:50 Go to next message
Gunnar Wurl is currently offline Gunnar WurlFriend
Messages: 34
Registered: July 2009
Member
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 #110927 is a reply to message #110763] Fri, 31 October 2008 07:17 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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
>>
>>
Re: ProgressBar not updating when running a job the second time [message #111169 is a reply to message #111116] Mon, 03 November 2008 14:17 Go to previous message
Gunnar Wurl is currently offline Gunnar WurlFriend
Messages: 34
Registered: July 2009
Member
Thank you Ivan.

Ivan Furnadjiev wrote:

> 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
>>>
>>>
Previous Topic:Firefox problem when Text is changed front-side and then server-side
Next Topic:User-Sessions Explanation
Goto Forum:
  


Current Time: Thu Apr 25 12:58:47 GMT 2024

Powered by FUDForum. Page generated in 0.02900 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top