Author: slotia
Date: 2009-04-16 06:02:42 -0700 (Thu, 16 Apr 2009)
New Revision: 16594

Modified:
   
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java
Log:
Updated CytoscapeAction to handle keyboard combinations


Modified: 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java
===================================================================
--- 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java  
    2009-04-15 23:51:15 UTC (rev 16593)
+++ 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java  
    2009-04-16 13:02:42 UTC (rev 16594)
@@ -107,13 +107,16 @@
 
                String keyComboString = (String) configProps.get("keyCombo");
                if (keyComboString != null) {
-                       KeyStroke keyStroke = 
KeyStroke.getKeyStroke(keyComboString);
-                       if (keyStroke != null) {
-                               int commandModifier = 
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
-                               this.keyCode = keyStroke.getKeyCode();
-                               this.keyModifiers = commandModifier | 
keyStroke.getModifiers();
-                               acceleratorSet = true;
-                       } 
+                       try
+                       {
+                               KeyStroke keyStroke = 
AcceleratorParser.parse(keyComboString);
+                               super.putValue(Action.ACCELERATOR_KEY, 
keyStroke);
+                       }
+                       catch (IllegalArgumentException ex)
+                       {
+                               System.out.println(String.format("WARNING: The 
action \'%s\' has specified the following invalid key combination: %s", 
consoleName, keyComboString));
+                               System.out.println(" => " + ex.getMessage());
+                       }
                }
        }
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to