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

Bug 335543

Summary: ProgressAnimationItem toolbar button selection opens ProgressView
Product: [Eclipse Project] Platform Reporter: Srimathi <meetmathi>
Component: UIAssignee: Prakash Rangaraj <prakash>
Status: VERIFIED FIXED QA Contact: Prakash Rangaraj <prakash>
Severity: normal    
Priority: P3 CC: meetmathi, prakash, pwebster
Version: 3.6.1   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 440294    
Attachments:
Description Flags
patch contains the changes proposed in previous comment. none

Description Srimathi CLA 2011-01-27 03:07:34 EST
Build Identifier: 20100917-0705

Once the background job is complete a toolbar button is shown in ProgressRegion. If we select this button the action is being executed and after completing the action ProgressView opens automatically. We see this as a change of behavior from 3.5 to 3.6.

Reproducible: Always

Steps to Reproduce:
1.Set Action Property to a Eclipse job.
2.Run that job.
3.Select the button shown in ProgressRegion after job is complete.
4.We could see the action being execute (like showing results etc). After the action is complete ProgressView is opened.
Comment 1 Srimathi CLA 2011-01-27 04:31:46 EST
I propose the following change in ProgressAnimationItem.java.
void doAction() {

		JobTreeElement[] jobTreeElements = FinishedJobs.getInstance()
				.getKeptElements();
		// search from end (youngest)
		for (int i = jobTreeElements.length - 1; i >= 0; i--) {
			if (jobTreeElements[i] instanceof JobInfo) {
				JobInfo ji = (JobInfo) jobTreeElements[i];
				Job job = ji.getJob();
				if (job != null) {

					        ...
						removeTopElement(ji);
					}

					if(execute(ji, job)) {
					    //This change is to bring back the same behavior of 3.5, 
					    //that is, not opening ProgressView when Action/Command result is shown
					    return;
					}
				}
			}
		}

		progressRegion.processDoubleClick();
		refresh();
	}

	/**
	 * @param ji
	 * @param job
	 */
	private boolean execute(JobInfo ji, Job job) {
		Object prop = job.getProperty(IProgressConstants2.ACTION_PROPERTY);
		if (prop instanceof IAction && ((IAction) prop).isEnabled()) {
			IAction action = (IAction) prop;
			action.run();
			removeTopElement(ji);
			return true;
		}

		prop = job.getProperty(IProgressConstants2.COMMAND_PROPERTY);
		if (prop instanceof ParameterizedCommand) {
			...
            return true;

		}
		return false;
	}
Comment 2 Prakash Rangaraj CLA 2011-01-27 04:35:40 EST
(In reply to comment #1)
> I propose the following change in ProgressAnimationItem.java.

     Can you submit this as a patch?
Comment 3 Paul Webster CLA 2011-01-27 07:08:19 EST
(In reply to comment #2)
> 
>      Can you submit this as a patch?

See http://wiki.eclipse.org/Platform_UI/How_to_Contribute for steps.

PW
Comment 4 Srimathi CLA 2011-01-28 06:25:16 EST
Created attachment 187828 [details]
patch contains the changes proposed in previous comment.
Comment 5 Prakash Rangaraj CLA 2011-02-15 05:06:17 EST
Patch released to HEAD
Comment 6 Prakash Rangaraj CLA 2011-03-09 00:03:49 EST
Verified in I20110307-2110