Revision: 7197
Author: [email protected]
Date: Sun Nov 29 20:33:35 2009
Log: Merge trunk r7195 into this branch

Change keybindings for find-next and find-prev in the Swing UI to better
match expectations.

     svn merge --ignore-ancestry -c7195 \
       https://google-web-toolkit.googlecode.com/svn/trunk/ .


http://code.google.com/p/google-web-toolkit/source/detail?r=7197

Modified:
  /releases/2.0/branch-info.txt
   
/releases/2.0/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java

=======================================
--- /releases/2.0/branch-info.txt       Sun Nov 29 20:24:51 2009
+++ /releases/2.0/branch-info.txt       Sun Nov 29 20:33:35 2009
@@ -1096,3 +1096,9 @@
    Make RunStyle public, improve docs.
      svn merge --ignore-ancestry -c7194 \
        https://google-web-toolkit.googlecode.com/svn/trunk/ .
+
+tr...@7195 was merged into this branch
+ Change keybindings for find-next and find-prev in the Swing UI to better
+ match expectations.
+    svn merge --ignore-ancestry -c7195 \
+      https://google-web-toolkit.googlecode.com/svn/trunk/ .
=======================================
---  
/releases/2.0/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java   
 
Mon Nov 23 19:54:09 2009
+++  
/releases/2.0/dev/core/src/com/google/gwt/dev/shell/log/SwingLoggerPanel.java   
 
Sun Nov 29 20:33:35 2009
@@ -418,14 +418,14 @@
        }
      }
      logger = bestLogger;
-    KeyStroke key = getCommandKeyStroke(KeyEvent.VK_F);
+    KeyStroke key = getCommandKeyStroke(KeyEvent.VK_F, false);
      getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(key, "find");
      getActionMap().put("find", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
          showFindBox();
        }
      });
-    key = getCommandKeyStroke(KeyEvent.VK_C);
+    key = getCommandKeyStroke(KeyEvent.VK_C, false);
      tree.getInputMap().put(key, "copy");
      tree.getActionMap().put("copy", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
@@ -433,14 +433,14 @@
        }
      });
      findBox = new FindBox();
-    key = getCommandKeyStroke(KeyEvent.VK_N);
+    key = getCommandKeyStroke(KeyEvent.VK_G, false);
       
tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(key, "findnext");
      tree.getActionMap().put("findnext", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
          findBox.nextMatch();
        }
      });
-    key = getCommandKeyStroke(KeyEvent.VK_P);
+    key = getCommandKeyStroke(KeyEvent.VK_G, true);
       
tree.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(key, "findprev");
      tree.getActionMap().put("findprev", new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
@@ -646,11 +646,16 @@
     * Returns a keystroke which adds the appropriate modifier for a command  
key:
     * Command on mac, Ctrl everywhere else.
     *
-   * @param key
+   * @param key virtual key defined in {...@code KeyEvent#VK_*}
+   * @param shift true if the Ctrl/Command key must be shifted
     * @return KeyStroke of the Ctrl/Command-key
     */
-  private KeyStroke getCommandKeyStroke(int key) {
-    return KeyStroke.getKeyStroke(key, ctrlKeyDown);
+  private KeyStroke getCommandKeyStroke(int key, boolean shift) {
+    int mask = ctrlKeyDown;
+    if (shift) {
+      mask |= InputEvent.SHIFT_DOWN_MASK;
+    }
+    return KeyStroke.getKeyStroke(key, mask);
    }

    private String htmlUnescape(String str) {

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to