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

Bug 165362

Summary: Switching from and then back to task editor should preserve focus
Product: z_Archived Reporter: Eugene Kuleshov <ekuleshov>
Component: MylynAssignee: Mik Kersten <mik.kersten>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: robert.elves, wmitsuda
Version: unspecifiedKeywords: helpwanted
Target Milestone: 1.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 166088    
Attachments:
Description Flags
mylar/context/zip
none
mylar/context/zip none

Description Eugene Kuleshov CLA 2006-11-21 14:20:25 EST
Switching from and then back to task editor should preserve focus. For example if you've been entering a comment and then switched to other editor or view (Ctrl-F6, etc) and back to task editor you should stay in the same entry field as before switching.
Comment 1 Willian Mitsuda CLA 2006-11-21 15:43:09 EST
+1, this bugs me too.
Comment 2 Eugene Kuleshov CLA 2006-12-22 14:12:24 EST
It must have something to do with the focus handler. I just noticed that if you switch of the editor to some view (even using mouse), then click back anywhere in the editor area, editor jumps to the top.
Comment 3 Mik Kersten CLA 2006-12-22 15:58:53 EST
This is problematic so I went ahead and investigated for 1.0.1.  I ended up removing the following method from TaskEditor, which appeared to be doing some bugus focusing:

	@Override
	public void setFocus() {
		if (this.getActivePage() > -1 && this.getActivePage() != browserPageIndex) {
			IFormPage page = this.getPages()[this.getActivePage()];
			if (page != null) {
				page.setFocus();
			}
		} else if(this.getActivePage() == browserPageIndex && webBrowser != null) {
			webBrowser.setFocus();
		}
	}
	
So we no longer override focusing and the problem is gone.  I am not certain whether this was a work-around to some other problem, so if you guys could update to the dev build that I'm about to post, and put some mileage on this that would be helpful.
Comment 4 Mik Kersten CLA 2006-12-22 15:58:55 EST
Created attachment 56107 [details]
mylar/context/zip
Comment 5 Eugene Kuleshov CLA 2006-12-22 16:06:22 EST
Willian complained about some focus issues in task editor just few days ago and Rob said that this focus method was needed to work around focus on summary upon new task construction. See comments in bug 166088.
Comment 6 Eugene Kuleshov CLA 2006-12-22 16:08:10 EST
Oh, by the way, Mik, you should use Team -> Show Annotations action. It would of brought you to bug 166088. :-)
Comment 7 Mik Kersten CLA 2006-12-22 16:42:23 EST
Thanks for the pointer (and the tip) Eugene.  That could have been an annoying regression.  I have fixed this by keeping the work-around focusing code removed out of the TaskEditor, but adding a setFocusOfActivePage() method that's called when a new task is created.

Tested for creating new local tasks and for ensuring focus doesn't jump to top when task editor is brought to the top.
Comment 8 Mik Kersten CLA 2006-12-22 16:42:26 EST
Created attachment 56108 [details]
mylar/context/zip