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

Bug 288604

Summary: [Workbench] IWorkbenchPage#showView() does not re-highlight view's tab when call from focusLost event -> inconsistent workbench state
Product: [RT] RAP Reporter: Björn Fischer <b.fischer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.3   
Target Milestone: 1.3 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Small expample project to easily reproduce the described behaviour none

Description Björn Fischer CLA 2009-09-04 03:38:16 EDT
Assume a perspective consisting of two stacked views. On one of the views there is a mandatory Text widget, so when the widget is left empty and a focusLost event occurs, the cursor is supposed to be returned to the (empty) Text widget. This can be achieved by a focusLost method looking about like this:

------------------------------------------
// Give focus back to text field if it is empty
if (text.getText().equals("")) {
	// Keep the focus in the invalid field
	text.getDisplay().asyncExec(new Runnable() {
		public void run() {
			IWorkbenchPage activePage = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage();
			try {
				activePage.showView(FormViewPart.ID);
			} catch (PartInitException e) {
				e.printStackTrace();
			}
				text.forceFocus();
		}
	});
}
	}
---------------------------------------------

Now the problem occurs when the user tries to leave the empty field by selecting the other view (instead of clicking somewhere in the view with the Text widget on it). In this case the tab of the other view gets highlighted, but the view shown is still the one with the text field on it. That means the tab highlighted does not match the view shown, so the workbench is left inconsistently.

I will attach a small example project. In this project, do the following steps to reproduce:

1. Start the example project
2. Switch to the view "Form View"
3. Click the mandatory Text widget (do not enter text)
4. Switch back to the "Dummy View"
5. Note that the "Form View" is still shown, but the "Dummy View"s tab is highlighted

I checked this example with RCP, the problem does not appear there.
Comment 1 Björn Fischer CLA 2009-09-04 03:42:05 EDT
Created attachment 146477 [details]
Small expample project to easily reproduce the described behaviour
Comment 2 Ivan Furnadjiev CLA 2009-10-14 11:41:57 EDT
Fixed in CVS HEAD. Removed the code for item selection/deselection from CTabFolder.js#_notifyItemClick, because this is done by the server side anyway.