Community
Participate
Working Groups
I20070424-0930 - paste to Package Explorer: /******************************************************************************* * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package p; public class C { } - click on '+' besides the first line to expand the header comment => keyboard focus is lost between the editor area and the window toolbar
Important step is to wait for the projection hover to appear before clicking on the (+). This is in since at least 3.0.
Created attachment 71021 [details] Bug Fix setting the SWT.NO_FOCUS flag for the annotation column canvas control does it on windows. i have no way to test on other platforms. any reason for any of the ruler columns to be able to accept keyboard focus - accessibility or any other exotic reason? if not, then this fix should be good
Unfortunately the NO_FOCUS bit is only a hint (see its Javadoc) and hence we cannot expect that this works on all Platforms.
Created attachment 71044 [details] equivalent fix for quick diff column as it turns out, clicking on the quick diff bar when an information bar is visible also takes the focus away from the editor
Yes, I am aware of that, however, since this bug is only filed for Windows (OS flag), I figured I could submit my patch. > Unfortunately the NO_FOCUS bit is only a hint (see its Javadoc) and hence we > cannot expect that this works on all Platforms. >
> as it turns out, clicking on the quick diff bar when an information bar is > visible also takes the focus away from the editor I can't reproduce that with I20070608-1718. When I click the quick diff bar, the editor selects the whole line (and the focus stays in the text widget).
(In reply to comment #6) > > as it turns out, clicking on the quick diff bar when an information bar is > > visible also takes the focus away from the editor > > I can't reproduce that with I20070608-1718. When I click the quick diff bar, the > editor selects the whole line (and the focus stays in the text widget). OK, I investigated this and here is what I found out. This problem is introduced by my fix to bug 40889. The projection ruler prevents external mouse listeners from attaching to its canvas and I replicate this behavior on the line number ruler in my fix to 40899. Apparently one of the external listeners takes care of canceling the focus event so that focus is not lost. Maybe a better solution to this bug would be to replicate what the external mouse listener does to prevent the focus change here. Comment 5 in bug 192222 talks about a ruler API enhancement that could end up eliminating these problems altogether.
Created attachment 89962 [details] Updated Patch Here is an updated patch, which does NOT rely on SWT.NO_FOCUS (exclusively). Here is a very detailed description: 1) SWT_NO_FOCUS is still there because there is no reason for an annotation ruler to request focus on mouse behavior. 2) The projection ruler caused the styled widget to lose focus because the NO_FOCUS flag was missing *AND* it uses the isPropagatingMouseListener() flag to turn off external mouse listeners for the ruler, which in turn disables the AbstractTextEditor mouse listener. The AbstractTextEditor mouse listener always sets the focus to the text widget on mouse up, effectively restoring focus. I replicate this behavior by calling the focus method on the text widget on mouse up for annotation rulers with isPropagatingMouseListener() = false.
Will review during M7.
Testing on different platforms and assessing the risk at this point I will commit the patch but only the part with NO_FOCUS (works on the platforms I tested). I added the following credentials for you to the copyright notice: Nikolay Botev <bono8106@hotmail.com> - [projection] Editor loses keyboard focus when expanding folded region - https://bugs.eclipse.org/bugs/show_bug.cgi?id=184255 Please speak up if there's a bug in it. Thanks.