Bug 379128 - Wrong editor is activated
Summary: Wrong editor is activated
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: 4.2 RC3   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
: 380090 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-10 10:02 EDT by Jan Koehnlein CLA
Modified: 2012-06-01 08:49 EDT (History)
6 users (show)

See Also:
ob1.eclipse: review+
pwebster: review+


Attachments
Screencast showing the tab switching and hyperlink errors (938.07 KB, video/quicktime)
2012-05-10 10:03 EDT, Jan Koehnlein CLA
no flags Details
Java Editor tab highlighted - manifest editor contents showed (269.11 KB, image/png)
2012-05-12 03:49 EDT, Marcel Bruch CLA
no flags Details
Remove extra calls to 'readAndDispatch (2.00 KB, patch)
2012-05-30 11:27 EDT, Eric Moffatt CLA
no flags Details | Diff
Updated patch that also reverts the list checks (2.26 KB, patch)
2012-05-30 12:37 EDT, Eric Moffatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Koehnlein CLA 2012-05-10 10:02:14 EDT
I have a couple of Java editors open in the same tabbed pane. The funny bug is every second time I select another tab, the edittor in the first tab is actually selected. The outline shows the right file. "Open type" is broken as well, same with following hyperlinks.
Comment 1 Jan Koehnlein CLA 2012-05-10 10:03:45 EDT
Created attachment 215399 [details]
Screencast showing the tab switching and hyperlink errors

I've attached a small screencast demonstrating the bug.
Comment 2 Jan Koehnlein CLA 2012-05-10 10:04:13 EDT
Setting to blocker, as this is a real no-go.
Comment 3 Jan Koehnlein CLA 2012-05-10 10:11:44 EDT
Problem's gone after a restart. Let's see if it reappears...
Comment 4 Paul Webster CLA 2012-05-10 10:33:16 EDT
Was this with 4.2 M7?

PW
Comment 5 Jan Koehnlein CLA 2012-05-10 10:56:13 EDT
Version: 4.2.0
Build id: I20120503-1800

I've been working a lot with 4.2M6 before, the error never appeared.
Comment 6 Marcel Bruch CLA 2012-05-12 03:49:39 EDT
Created attachment 215517 [details]
Java Editor tab highlighted - manifest editor contents showed

I think this screenshot may be related to Jan's issue - but I'm not sure whether this should go to a new bug report or not.


FWIW, I exactly had the same problems Jan described with M7 several times this week on Mac. During the 1-week e4 training this seems not to happen on the customers' Windows 7/XP machines nor on Linux (12 machines) - at least no one complained about it.
Comment 7 Oleg Besedin CLA 2012-05-22 10:12:07 EDT
I can not duplicate this. 

Jan, Marcel - do you remember by chance what were you doing before getting into this state?

Adding Bogdan to CC on the off-chance that he can find a problem in the CTabFolder from a code inspection.

Could it also be Mac-specific?
Comment 8 Jan Koehnlein CLA 2012-05-24 05:42:22 EDT
Something similar happened yesterday during workshop on a Windows7 machine. 
Double clicked on a new editor tab: Tab was selected and magnified but content pane showed previous content belonging to another tab.
Comment 9 Nobody - feel free to take it CLA 2012-05-24 16:20:44 EDT
(In reply to comment #8)
> Something similar happened yesterday during workshop on a Windows7 machine.
> Double clicked on a new editor tab: Tab was selected and magnified but content
> pane showed previous content belonging to another tab.
This behavior is also described on bug 380090
Comment 10 Eric Moffatt CLA 2012-05-30 11:23:07 EDT
It turns out that this (and a few other) odd effects are the result of the fix made for bug 375576 (on 2012-04-30). We were spinning the SWT event loop (once) in various parts of WorkbenchPage, leading to the results we are now experiencing.

We have tested the scenarios with these changes reverted and everything is much better. You can easily see the effect  in action (especially on a Mac), just select multiple and open multiple files; in M6 this a 'clean' but in M7 it flashes all over the place...and ends up 'broken'.

I'll remove the 'readAndDispatch' calls for now and we can look into another approach for bug 375576 (which I'll re-open) in 4.2.1.
Comment 11 Eric Moffatt CLA 2012-05-30 11:27:28 EDT
Created attachment 216485 [details]
Remove extra calls to 'readAndDispatch
Comment 12 Oleg Besedin CLA 2012-05-30 11:54:09 EDT
It seems that the lines:

		if (partListenerList.size() + partListener2List.size() == 0)
			return;

from the original fix are not reversed. They might make a difference for #firePartOpened() as the last statement will be skipped if there are no listeners:

		if (part instanceof IPageChangeProvider) {
			((IPageChangeProvider) part).addPageChangedListener(pageChangedListener);
		}

Is this a desired effect?
Comment 13 Eric Moffatt CLA 2012-05-30 12:37:17 EDT
Created attachment 216490 [details]
Updated patch that also reverts the list checks


Oleg was sharp enough to determine that the checks could actually prevent the code at the end of 'firePartOpened' to execute if there are no other listeners...
Comment 14 Paul Webster CLA 2012-05-30 14:00:24 EDT
+1 as component lead.

Eric, could you or Silenio update the bug with results from him testing it on his mac?

PW
Comment 15 Oleg Besedin CLA 2012-05-30 14:21:51 EDT
+1, works for me on Mac and Windows.
Comment 16 Eric Moffatt CLA 2012-05-30 14:26:36 EDT
commit 7df93988a8b50f3fdce6a6ca9f1928f1823afbc9

This reverts the WorkbenchPage code that was causing the issues on the Mac (and likely was unsafe on other systems as well).
Comment 17 Eric Moffatt CLA 2012-05-31 13:00:27 EDT
Verified in I20120530-1900. 

I used the Mac in the SWT lab as well as having Silenio and Bogdan check on their machines. I've also smoke tested on Windows.
Comment 18 Paul Webster CLA 2012-06-01 08:49:24 EDT
*** Bug 380090 has been marked as a duplicate of this bug. ***