Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 67574

Summary: [Progress] KEEPONE doesn't remove duplicate jobs from the progress view
Product: [Eclipse Project] Platform Reporter: Jean-Michel Lemieux <jean-michel_lemieux>
Component: UIAssignee: Andre Weinand <andre_weinand>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: douglas.pollock, marcus.lindblom, Michael.Valenta, michaelvanmeekeren, n.a.edgar, Tod_Creasey
Version: 3.0   
Target Milestone: 3.0 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch for org.eclipse.ui.workbench none

Description Jean-Michel Lemieux CLA 2004-06-16 22:57:29 EDT
3.0 RC2

It seems that duplicate sync jobs are not removed from the progress view. I've
investigated and noticed that the specification for IProgressConstants#KEEPONE
property state that duplicate jobs are removed when a job is finished. But in
the FinishedJob class it doesn't seem to be calling checkForDuplicates when a
job is done. And in my case, adding a breakpoint in the belongsTo() method of my
job shows that it is never called.

Shouldn't the remove() method in FinishedJob call checkForDuplicates? Adding
this line will fix the problem. But it may be a bug somewhere else.

This was found when fixing bug 67573.
Comment 1 Andre Weinand CLA 2004-06-17 18:21:55 EDT
The specification for IProgressConstants#KEEPONE is incorrect: a job with the KEEPONE property 
removes other jobs of the same family on start. Without this behavior there would be two and not one 
job in the progress view.
I verified this behavior with the JobExample and it worked fine for me.

However, this behavior is problematic if you cannot set the KEEPONE property early (before starting the 
job). In this case other jobs of the family aren't removed because the existence of the property is only 
checked once at start.

What do you suggest?
    fix the doc and keep the behavior (if you are able to set KEEPONE early)
or
    change the behavior to test the KEEPONE property on start and finish
    (and adapt the doc too)
Comment 2 Jean-Michel Lemieux CLA 2004-06-17 21:13:15 EDT
+1 for option 2. We set KEEPONE==true if the job is run in the background. But
we can't tell if the job is run in the background when the job is started or
created. Instead, at the end of the job we set the KEEPONE==!IN_DIALOG.

I don't mind having two jobs at once in some cases, it is better than the
progress view accumulating many of them.

I'm sorry I didn't catch this earlier, but such is life :)
Comment 3 Andre Weinand CLA 2004-06-18 04:45:43 EDT
So for RC3 I recommend to add an additional check for the KEEPONE property to the remove case
and update the doc of IProgressConstants#KEEPONE to the following:

     "That is, whenever a Job with the KEEPONE property starts and finishes, all other
     kept Jobs of the same family are removed first."

Without this change, doc and implementation are out of sync and jobs will add up if clients set the 
KEEPONE property too late.
Comment 4 Andre Weinand CLA 2004-06-18 07:01:56 EDT
Created attachment 12464 [details]
patch for org.eclipse.ui.workbench
Comment 5 Jean-Michel Lemieux CLA 2004-06-18 09:00:09 EDT
Again, +1 and I've reviewed and actually tested the change.
Comment 6 Jean-Michel Lemieux CLA 2004-06-18 13:18:01 EDT
*** Bug 67750 has been marked as a duplicate of this bug. ***
Comment 7 Michael Valenta CLA 2004-06-21 10:27:11 EDT
*** Bug 66715 has been marked as a duplicate of this bug. ***
Comment 8 Jean-Michel Lemieux CLA 2004-06-22 10:50:02 EDT
*** Bug 68020 has been marked as a duplicate of this bug. ***
Comment 9 Tod Creasey CLA 2004-06-22 10:59:23 EDT
Patch approved +1
Comment 10 Tod Creasey CLA 2004-06-23 09:04:41 EDT
Can someone give me good steps to replicate this before we release it please?
Comment 11 Andre Weinand CLA 2004-06-23 09:13:53 EDT
Jean-Michel?
Comment 12 Jean-Michel Lemieux CLA 2004-06-23 09:45:27 EDT
Use Case 1:
- disable 'always run in backgorund' preference. 
- run a Team > Synchronize with Repository
- Progress dialog appears - don't touch it and let the operation complete
- When the operation is done an entry will be left in the progress view

Use Case 2:
- Schedule a team sychronize (e.g. view the synchronize view menu) for every one
minute.
- Let a couple of scheduled synchronizations occur and notice that they will
accumulate in the progress view. 
- You won't be able to remove them with the 'XX' button. They stay in the view.

Use Case 3:
- Run Team > Synchronize and in the progress dialog select "run in background".
- The finished synchronize should stay in the progress view
- Run another and run in background
- Only one synchronize should be in the progress at the end.

The synchronize job sets the KEEPONE property in the following way:
- when job is started KEEPONE = ! IN_DIALOG
- when job ends (e.g. at the end of the run() method) KEEPONE = ! IN_DIALOG
Comment 13 Tod Creasey CLA 2004-06-23 10:14:59 EDT
I can't get any of JMs use cases to work. JM could you recheck this patch 
please?
Comment 14 Tod Creasey CLA 2004-06-23 10:15:37 EDT
Sorry - forget that. I was looking at the wrong workbench. let me retry.

i have verified the current state however.
Comment 15 Tod Creasey CLA 2004-06-23 10:28:48 EDT
This fixes case 2 but not case 1 or 3 - the main issue is that these finished 
jobs do not leave the view which I think is actually Bug 62995.

If this patch is stil acceptable to Jean-Michel I will release it.
Comment 16 Tod Creasey CLA 2004-06-23 10:36:47 EDT
Released the patch. I will leave this open until we are sure that the other 
two cases are really Bug 62995
Comment 17 Jean-Michel Lemieux CLA 2004-06-23 10:58:17 EDT
*** Bug 68274 has been marked as a duplicate of this bug. ***
Comment 18 Tod Creasey CLA 2004-06-23 19:08:57 EDT
Marking as fixed as we have verified that the other cases are Bug 62995
Comment 19 Tod Creasey CLA 2004-06-23 19:10:54 EDT
Verified in 20040623-1600