Bug 54784 - can't use keyboard to Add elements with right-click menu
Summary: can't use keyboard to Add elements with right-click menu
Status: RESOLVED FIXED
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 4.0
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2013-04-02 11:35 UTC by rikard_edgren
Modified: 2018-03-27 01:39 UTC (History)
2 users (show)



Attachments
Current WIP. (29.71 KB, patch)
2014-10-19 11:23 UTC, Graham Russell
Details | Diff
Updated Patch. (12.68 KB, patch)
2014-10-19 15:05 UTC, Graham Russell
Details | Diff
Second attempt. (11.80 KB, patch)
2014-12-21 02:46 UTC, Graham Russell
Details | Diff
3rd ugly attempt (13.63 KB, patch)
2015-02-15 13:40 UTC, Philippe Mouawad
Details | Diff
My fix for JMeter 4.1-Snapshot (6.30 KB, patch)
2018-03-27 01:37 UTC, Yuping Wu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rikard_edgren 2013-04-02 11:35:44 UTC
JMeter is very fast to use, but on my Windows machine I cannnot use the right-click menu fully with keyboard navigation.

1. Launch JMeter
2. Select a Thread Group
3. Press Shift+F10

Result: Nothing happens
Expected: That the right-click menu is displayed, as in other Windows applications.

4. Right-click on the Thread Group
5. Navigate with keyboard arrow buttons to an element, e.g. Add, Sampler, HTTP Request
6. Press Enter on keyboard

Result: Nothing happens.
Expected: That the selected element is inserted

A fix would make JMeter even more fast to use for people like me that find keyboard navigation useful.
Comment 1 Graham Russell 2014-10-15 20:46:29 UTC
I am looking to implement this. Where exactly do we think the popup should appear:
1. always in the same place (i.e. top left of the tree) or 
2. top left of the element you have selected, or maybe 
3. middle of the element you have selected?
Comment 2 rikard_edgren 2014-10-16 19:18:08 UTC
Using Windows Explorer as Oracle, I would say that close to upper left corner of selected element is fine.
Crossing my fingers that this gets into the product!

/Rikard
Comment 3 Graham Russell 2014-10-19 11:23:36 UTC
Created attachment 32127 [details]
Current WIP.

I've almost got it working - however there seems to be a bug whereby after adding a thread group then a controller then, for example, adding a timer, it adds the element but leaves the popup menu still displayed.

The main points are:
- displayPopUp method in GuiPackage.java
- keyPressed in JMeterTreeListener.java
- makeMenuItem in MenuFactory.java

P.S. Sorry for the code tidy-up related changes also in this patch - if it makes it too hard to read I can try to pull the salient changes to a new patch.

Thanks.
Comment 4 Philippe Mouawad 2014-10-19 12:33:22 UTC
Hello Graham,
Thanks a lot for contribution.
Unfortunately attached patch is not very readable and I am not able to apply it easily. It is showing lot of conflicts.

Could you submit a new patch based on nightly build ?
I think for now, we should avoid formatting patches .

Thanks
Comment 5 Graham Russell 2014-10-19 15:05:03 UTC
Created attachment 32128 [details]
Updated Patch.

I've updated the patch and applied it to current trunk.
Comment 6 Philippe Mouawad 2014-10-19 20:24:09 UTC
Hi Graham,
Thanks for patch.
I tested it, I don't reproduce your issue but I faced another one.
If I select Thread Group to add, it adds setup Thread Group.

I removed from MenuFactory#makeMenuItem as it does not seem useful to me:
newMenuChoice.registerKeyboardAction(ActionRouter.getInstance(), 
      actionCommand,
      KeyStrokes.ENTER, 
      JMenuItem.WHEN_IN_FOCUSED_WINDOW); // Bug 54784

and it worked fine.

Can you make some further tests on Windows or Linux ?
Thanks
Comment 7 Graham Russell 2014-10-19 21:09:30 UTC
If I remove that line in Ubuntu 14.04 using xfce and Oracle Java 7 it then doesn't do anything when pressing enter - no idea how the behaviour can be so different.

I can't see why it sometimes adds a different element to the one which was selected.

I've also notice two other bugs, but am not sure how to fix them:
- If you add a config element (or timer and probably more) the popup menu doesn't hide I've tried this in Linux (Java 7) and Win 7 (Java 8)
- If you press enter after adding an element, i.e. once the popup menu has closed, it just keeps adding more elements to the tree.

Hopefully someone else with more knowledge of java awt, swing and/or the JM UI is able to help?
Comment 8 Graham Russell 2014-12-21 02:46:20 UTC
Created attachment 32314 [details]
Second attempt.

My second attempt, seems to work now, i.e. none of the previous three issues, at least on Linux. Although my solution doesn't feel very neat i.e. the MenuKeyListener maybe should be moved, but then again it's not that big.
Comment 9 Philippe Mouawad 2014-12-24 14:39:37 UTC
Hi,
Thanks for this new patch.
Unfortunately it is not working on MacOSX, when I enter after selecting Thread Group GUI is blocked and I cannot do anything except quit.

I will try to have a look these upcoming days.
Regards
Comment 10 Philippe Mouawad 2015-02-15 13:40:10 UTC
Created attachment 32482 [details]
3rd ugly attempt
Comment 11 Yuping Wu 2018-03-27 01:37:02 UTC
Created attachment 35812 [details]
My fix for JMeter 4.1-Snapshot