Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314432 - [hovering] First click on not yet enriched hover closes hover immediately
Summary: [hovering] First click on not yet enriched hover closes hover immediately
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.6 RC3   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 07:13 EDT by Dani Megert CLA
Modified: 2010-05-28 05:22 EDT (History)
4 users (show)

See Also:
Silenio_Quarti: review+
eclipse.felipe: review+
gheorghe: review+
markus.kell.r: review+


Attachments
SnippetBrowserFocusOutBug314432.java (6.60 KB, text/plain)
2010-05-26 14:49 EDT, Markus Keller CLA
no flags Details
patch (1.79 KB, patch)
2010-05-26 15:18 EDT, Grant Gayed CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-05-26 07:13:33 EDT
3.6 RC2, broken during 3.6 M3 (works in 3.5.2)

When I click a link in a not yet enriched hover (be fast to make sure it doesn't get enriched before you click), then the hover shell closes immediately and does not give the focus back to the editor.

Steps to reproduce:
1. paste this into Package Explorer of new workspace
public class ClassParent {
    public void foo1() {
    }
}

public class ClassChild extends ClassParent{
    /**
     * @see #foo1()
     */
    public void foo2() {
        foo1();
    }
}

2. hover over foo2() and quickly click on foo1()

NOTE: If you are not fast enough then you have to close and reopen the editor as the bug can only be seen the first time.
Comment 1 Dani Megert CLA 2010-05-26 07:14:22 EDT
Seems to work on Linux.
Maybe caused by fix for bug 275890 and bug 276065.
Comment 2 Markus Keller CLA 2010-05-26 07:18:30 EDT
Steps to reproduce reliably in I20100523-0800:

- Preferences > Text Editors: When mouse moved into hover: Enrich on click
- paste to Package Explorer:
/**
 * @see java.util.Collections
 */
public class HyperlinkTest {
}
- hover over HyperlinkTest
- click the link
Comment 3 Markus Keller CLA 2010-05-26 10:56:21 EDT
Reproduced in 3.6M3 with SWT v3612. Does not happen with SWT v3611d.
Bug 275890 does not affect this problem.

The bug appears with IE.java 1.54 (from bug 289470). The new Runnable from setText(String) line 1011 causes an unexpected FocusOut event later from OleFrame$2.run() line: 154, which makes StickyHoverManager$Closer.handleEvent(Event) close the rich hover control:

StickyHoverManager$Closer.handleEvent(Event) line: 267	
EventTable.sendEvent(Event) line: 84	
Display.filterEvent(Event) line: 1196	
WebSite(Widget).sendEvent(Event) line: 1001	
WebSite(Widget).sendEvent(int, Event, boolean) line: 1026	
WebSite(Widget).sendEvent(int, Event) line: 1011	
WebSite(Widget).notifyListeners(int, Event) line: 769	
OleFrame$2.run() line: 154	
Display.runTimer(int) line: 3948	
Display.messageProc(int, int, int, int) line: 3140	
OS.DispatchMessageW(MSG) line: not available [native method]	
OS.DispatchMessage(MSG) line: 2424	
Display.readAndDispatch() line: 3476	
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2404
Comment 4 Markus Keller CLA 2010-05-26 14:32:04 EDT
The stack in comment 3 is not the real problem of this bug. That one only happens if I set a breakpoint in IE.java 1.80 line 1417 (before the Runnable is executed), and then resume from the first hit. The 'display.getFocusControl()' in OleFrame#initCheckFocus(Display) still looks scary...


The real problem can be seen by setting a breakpoint at the first line of StickyHoverManager.Closer#focusLost(FocusEvent). After clicking the link, the resizable hover shell gets a WM_ACTIVATE message, and in Shell(Decorations).WM_ACTIVATE(int, int) line: 1686, it sends an SWT.Deactivate event for the resizable hover shell, since 'display.findControl (lParam)' returned the fixed-size hover shell. This SWT.Deactivate event is the unexpected one:

StickyHoverManager$Closer.focusLost(FocusEvent) line: 222	
AbstractInformationControl$7.handleEvent(Event) line: 685	
EventTable.sendEvent(Event) line: 89	
Shell(Widget).sendEvent(Event) line: 1053	
Shell(Widget).sendEvent(int, Event, boolean) line: 1077	
Shell(Widget).sendEvent(int) line: 1058	
Shell(Decorations).WM_ACTIVATE(int, int) line: 1686	
Shell.WM_ACTIVATE(int, int) line: 2114	
Shell(Control).windowProc(int, int, int, int) line: 4157	
Shell(Canvas).windowProc(int, int, int, int) line: 341	
Shell(Decorations).windowProc(int, int, int, int) line: 1637	
Shell.windowProc(int, int, int, int) line: 2038	
Display.windowProc(int, int, int, int) line: 4873	
OS.$$YJP$$DispatchMessageW(MSG) line: not available [native method]	
OS.DispatchMessageW(MSG) line: not available	
OS.DispatchMessage(MSG) line: 2459	
Display.readAndDispatch() line: 3655	
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2629	

I have a snippet that shows that this only occurs when the
    if (_getUrl().equals(ABOUT_BLANK)) {..}
in IE#setText(String, boolean) is there, but it doesn't happen if I comment that out (i.e. revert bug 289470).

The snippet is currently unreadable -- I'll attach a cleaned version in a minute.
Comment 5 Markus Keller CLA 2010-05-26 14:49:43 EDT
Created attachment 170072 [details]
SnippetBrowserFocusOutBug314432.java

To see all Activate/Deactivate events, just uncomment this line:
//        addDisplayFilters(display);
Comment 6 Grant Gayed CLA 2010-05-26 15:18:30 EDT
Created attachment 170076 [details]
patch

Removing this block that made the problem appear actually looks to be a valid fix, as the original case that it was fixing (bug 289470) now works in HEAD without it.  Doing this effectively reverts the process of handling consecutive Browser.setText() calls to what it previously was for several releases, which is the safest path to follow, especially given that 3.6RC3 is wrapping up soon.
Comment 7 Markus Keller CLA 2010-05-26 15:30:34 EDT
+1 for RC3.
Comment 8 Grant Gayed CLA 2010-05-26 16:14:55 EDT
fixed > 20100526
Comment 9 Dani Megert CLA 2010-05-28 05:22:05 EDT
Verified with I20100527-1700 on Windows XP and Windows 7.