jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1845017 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/MainFrame.java xdocs/changes.xml
Date Sun, 28 Oct 2018 11:49:44 GMT
Author: fschumacher
Date: Sun Oct 28 11:49:43 2018
New Revision: 1845017

URL: http://svn.apache.org/viewvc?rev=1845017&view=rev
Log:
Some shortcuts are not working correctly on windows

Contributed by Michael Pavlov (michael.paulau at gmail.com)

Bugzilla Id: 62336
Closes #396 on github

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java?rev=1845017&r1=1845016&r2=1845017&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java Sun Oct 28 11:49:43 2018
@@ -18,11 +18,13 @@
 
 package org.apache.jmeter.gui;
 
+import java.awt.AWTEvent;
 import java.awt.BorderLayout;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Cursor;
 import java.awt.Dimension;
+import java.awt.EventQueue;
 import java.awt.Insets;
 import java.awt.Toolkit;
 import java.awt.datatransfer.DataFlavor;
@@ -36,6 +38,7 @@ import java.awt.dnd.DropTargetEvent;
 import java.awt.dnd.DropTargetListener;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -680,7 +683,7 @@ public class MainFrame extends JFrame im
 
             @Override
             public void actionPerformed(ActionEvent actionEvent) {
-                String propname = "gui.quick_" + actionEvent.getActionCommand();
+                String propname = "gui.quick_" + getCurrentKey(actionEvent);
                 String comp = JMeterUtils.getProperty(propname);
                 log.debug("Event {}: {}", propname, comp);
 
@@ -707,6 +710,24 @@ public class MainFrame extends JFrame im
                     log.warn("Failed to perform quick component add: {}", comp, err); //
$NON-NLS-1$
                 }
             }
+
+            /*
+             * Bug 62336: On Windows CTRL+6 doesn't give us an actionCommand, so
+             * we have to try harder and read the KeyEvent from the EventQueue
+             */
+            private String getCurrentKey(ActionEvent actionEvent) {
+                String actionCommand = actionEvent.getActionCommand();
+                if (actionCommand != null) {
+                    return actionCommand;
+                }
+                AWTEvent currentEvent = EventQueue.getCurrentEvent();
+                if (currentEvent instanceof KeyEvent) {
+                    KeyEvent keyEvent = (KeyEvent) currentEvent;
+                    return KeyEvent.getKeyText(keyEvent.getKeyCode());
+                }
+                log.debug("No keycode could be found for this actionEvent {}", actionEvent);
+                return "NONE";
+            }
         };
 
         InputMap inputMap = treevar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1845017&r1=1845016&r2=1845017&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun Oct 28 11:49:43 2018
@@ -184,6 +184,7 @@ Summary
     <li><bug>62767</bug>NPE when searching under certain conditions. Contributed
by Ubik Load Pack (support at ubikloadpack.com)</li>
     <li><bug>62790</bug>ArrayIndexOutOfBoundsException when calling replace
without selecting the first match</li>
     <li><bug>62795</bug>JMeter master sometimes ends distributed test even
though some of the slaves have not finished</li>
+    <li><bug>62336</bug><pr>396</pr>Some shortcuts are not
working correctly on windows. Contributed by Michael Pavlov (michael.paulau at gmail.com)</li>
 </ul>
 
  <!--  =================== Thanks =================== -->
@@ -198,6 +199,7 @@ Summary
     <li>Artem Fedorov (artem.fedorov at blazemeter.com)</li>
     <li>Stefan Seide (stefan at trilobyte-se.de)</li>
     <li>刘士 (liushilive at outlook.com)</li>
+    <li>Michael Pavlov (michael.paulau at gmail.com)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter.</p>
 <ul>



Mime
View raw message