Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 375723 - Handle MENU_KEYBOARD in more widgets
Summary: Handle MENU_KEYBOARD in more widgets
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.8   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-30 09:38 EDT by Markus Keller CLA
Modified: 2019-09-02 15:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2012-03-30 09:38:41 EDT
Follow-up to bug 374147

Handle MENU_KEYBOARD from MenuDetect events in more widgets. E.g. the Text widget should use the same strategy as StyledText (with bug 375721 fixed), and Tree and Table should also show the menu close to the focus item.

See org.eclipse.ui.actions.QuickMenuCreator#computeMenuLocation(Control) from org.eclipse.ui.workbench for inspiration. That's what Navigate > Show In (Alt+Shift+W) uses. Note that the menus for Tree and Table are indented a bit so that items below the focus item stay partly visible.
Comment 1 Carolyn MacLeod CLA 2012-04-30 10:32:04 EDT
Fix in 4.2 for Table, Tree, List on Windows only (so far):
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=dc8b70b8b17620c5e26d2b27a9531e3a6acaed33
Comment 2 Markus Keller CLA 2012-04-30 11:23:11 EDT
The horizontal centering looks a bit strange if the items have varying length. E.g. if you open the context menu on fCount in the Outline view here:

public class Hello {
    int fCount;
    AbstractList<LinkedHashMap<StringBuffer, FileOutputStream>> cache;
}

For multi-selection I also prefer the QuickMenuCreator's approach (show menu on a selected item close to the mouse position).
Comment 4 Carolyn MacLeod CLA 2012-04-30 11:36:24 EDT
We decided not to use the mouse position because that seemed like a very strange property to consider when the fix is mostly being done for keyboard only users.
Comment 6 Carolyn MacLeod CLA 2012-04-30 12:57:49 EDT
(In reply to comment 2)
> The horizontal centering looks a bit strange if the items have varying length.

Thank-you, Markus. I was using [Tree|Table]Item.getTextBounds(0) and I should have been using [Tree|Table]Item.getBounds() to measure the width of the item string.

Fixed in 4.2: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=7e7c23207b059dd8f2f569032a4266c17d005c2c
and in 3.8: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?h=R3_8_maintenance&id=71b464964b4568fbd72962189eeae03e7d8e938c
Comment 7 Markus Keller CLA 2012-04-30 13:46:25 EDT
> We decided not to use the mouse position because that seemed like a very
> strange property to consider when the fix is mostly being done for keyboard
> only users.

Sounds reasonable for the Open Context Menu command, yes. IIRC, the QuickMenuCreator uses the mouse position to support workflows where the user selects multiple items with Ctrl+Click and then e.g. presses Alt+Shift+W to open the "Show In" quick menu.


> Thank-you, Markus. I was using [Tree|Table]Item.getTextBounds(0) and I should
> have been using [Tree|Table]Item.getBounds() to measure the width of the item
> string.

Sounds like the API should have a bit more documentation (see bug 314867;-).
Comment 8 Eclipse Genie CLA 2018-11-23 18:03:08 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Lars Vogel CLA 2019-09-02 15:04:47 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.
Comment 10 Lars Vogel CLA 2019-09-02 15:08:37 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.