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

Bug 406029

Summary: Focus not given to the view when view drop down selected
Product: [Eclipse Project] Platform Reporter: John Ross <jwross>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, emoffatt, Michael_Rennie, pwebster
Version: 4.3   
Target Milestone: 4.3 M7   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=376011
Whiteboard:

Description John Ross CLA 2013-04-18 15:50:10 EDT
Selecting Configure Contents from the drop-down menu will not result in a popup window unless the Problems view has focus.

Another way of stating the issue might be the drop-down menu button does not cause the Problems view to come into focus.

A collegue using an Apple machine says the problem does not occur there, so this might be a Linux thing.

I'm using RHEL 6.3, Oracle JDK 6, Eclise build I20130416-0800 32-bit.
Comment 1 Curtis Windatt CLA 2013-04-18 16:04:23 EDT
Reproduced in Windows 7 I20130416-0800.

Give focus to the editor then try to configure contents of problems view: Nothing happens
Give focus to the view and try again: Dialog opens fine

I would expect clicking on the view menu would give focus the same way right clicking on the view to open the context menu does.
Comment 2 Paul Webster CLA 2013-04-18 16:05:15 EDT
Eric, I thought we fixed this with bug 376011 comment #30

We need to test this tomorrow.

PW
Comment 3 Curtis Windatt CLA 2013-04-18 17:59:55 EDT
(In reply to comment #2)
> Eric, I thought we fixed this with bug 376011 comment #30
> 
> We need to test this tomorrow.
> 
> PW

I can't get that listener to run no matter where/when I click.  Whenever the tab folder is activated, the event detail is still 0.  Not sure if this indicates a problem in the SWT part of that fix.  That being said this problem is independant of the ctabfolder.

The view is never activated when a toolbar item is pressed (both buttons and the view drop down menu).  If maximize is pressed the view does activate.

Since we create the menu (not the model), we can add a selection listener to activate the stack before showing the menu.  In org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showMenuButton(MPart, CTabFolder, MMenu) add the following the the tool item's selection listener before showMenu()

MElementContainer<MUIElement> stack = (MElementContainer<MUIElement>) ctf
							.getData(OWNING_ME);
					activateStack(stack);

We should be using a SelectionAdapter here as well to avoid duplicating the code.
Comment 4 Eric Moffatt CLA 2013-04-19 14:07:49 EDT
Just tried this on my Windows 7 system and selecting the drop down i correctly activating the view. Note that you'll have to be running on a very recent build since the fix went in on 2013-04-05, I'm using 4.3.0.N20130410-2000

Curtis, which build are you using ? Note that the fix requires a supporting fix from SWT so just running an inner with the platform's latest code won't help unless you have a build with the SWT fix.
Comment 5 Curtis Windatt CLA 2013-04-19 14:18:59 EDT
(In reply to comment #4)
> Curtis, which build are you using ? Note that the fix requires a supporting
> fix from SWT so just running an inner with the platform's latest code won't
> help unless you have a build with the SWT fix.

(In reply to comment #1)
> Reproduced in Windows 7 I20130416-0800.
I can reproduce in a target or in my host.  Unless the SWT fix wasn't included in the I build, there is still an issue here.

If you put a breakpoint in the activation listener line 994 in StackRender, is the event.detail ever equals to MouseDown?

Even ignoring that, clicking on the view drop down or another view toolbar action does not fire an activate event on the cTabFolder at all.
Comment 6 Eric Moffatt CLA 2013-04-19 14:40:08 EDT
Curtis, not sure what's going on...I just tried 4.3.0.I20130416-0800 myself and don't see the problem. I'm not running an inner, just using eclipse. If I have focus on the Package Explorer and click the drop down arrow for the Problems view it activates and selecting 'Configure Contents...' will bring up the dialog.

Is there any chance that you have SWT in the workspace you're launching from ?
Comment 7 Michael Rennie CLA 2013-04-19 15:47:02 EDT
(In reply to comment #6)
> Curtis, not sure what's going on...I just tried 4.3.0.I20130416-0800 myself
> and don't see the problem. I'm not running an inner, just using eclipse. If
> I have focus on the Package Explorer and click the drop down arrow for the
> Problems view it activates and selecting 'Configure Contents...' will bring
> up the dialog.
> 
> Is there any chance that you have SWT in the workspace you're launching from
> ?

Just tested on 4.3.0 I20130416-0800 and the problem is easily reproducible.

Steps I tried:
1. select a project in the package explorer
2. select the view menu in the problems view and try to configure - nothing happens
3. select a problem in the problems view
4. select the view menu in the problems view and try configure - the settings dialog shows up
Comment 8 Eric Moffatt CLA 2013-04-22 11:20:20 EDT
Wow, this is strange...usually it's my machine that's the one that it fails on and everybody else works...;-).

Both Paul (Linux) and I (Win7) have tried this with last night's nightly and it's working for us...

If you open StackRenderer at line 958 you should be seeing a check like this:

if (event.detail == SWT.MouseDown) { ...

If that's there then the remaining possibility is that this also needs an SWT fix to supply the correct event.detail information. This should be in the build but perhaps you're overriding it somehow ?
Comment 9 Curtis Windatt CLA 2013-04-22 13:48:02 EDT
(In reply to comment #8)
> Wow, this is strange...usually it's my machine that's the one that it fails
> on and everybody else works...;-).
> 
> Both Paul (Linux) and I (Win7) have tried this with last night's nightly and
> it's working for us...
> 
> If you open StackRenderer at line 958 you should be seeing a check like this:
> 
> if (event.detail == SWT.MouseDown) { ...
> 
> If that's there then the remaining possibility is that this also needs an
> SWT fix to supply the correct event.detail information. This should be in
> the build but perhaps you're overriding it somehow ?

As noted in comment #3 that listener always had event.detail == 0.

However, trying on a freshly downloaded N20130421-2000 build, the activation is happening correctly, both for menus and toolbar items.  So perhaps the SWT fix was missing from I20130416. Will have to verify in the next I build.
Comment 10 Eric Moffatt CLA 2013-04-22 15:16:58 EDT
Yes, comment #3 seems to indicate that the SWT part of the fix wasn't there. Basically that fix was to *set* the event.detail to SWT.MouseDown (i.e. != 0) if the Activate event was triggered by a mouse click.

OK, we should likely all check this tomorrow.

BTW, how do you get you builds; full copy / download or through updates ? I'm wondering whether there may be an issue with the SWT change not being picked up when using the update site (perhaps they haven't up-revved?).
Comment 11 Curtis Windatt CLA 2013-04-23 11:14:46 EDT
(In reply to comment #10)
> OK, we should likely all check this tomorrow.
> 
> BTW, how do you get you builds; full copy / download or through updates ?
> I'm wondering whether there may be an issue with the SWT change not being
> picked up when using the update site (perhaps they haven't up-revved?).

Verified that this is working in I20130423-0800.  Closing as WORKSFORME.

Typically I update my builds, though I will occasionally download an N build either for testing directly or use as a target platform.
Comment 12 Eric Moffatt CLA 2013-04-23 13:43:53 EDT
Curtis, just to be safe we should check this next week with the M7 candidate. If you could upgrade from some earlier version (i.e. one from before the SWT change) and I just pick up the ZIP we should be able to cover both cases. It's actually more likely that there is / was an issue in the update site anyways...
Comment 13 John Ross CLA 2013-05-01 09:05:51 EDT
Verified in I20130430-2000.