Author: slotia
Date: 2009-03-26 05:52:50 -0700 (Thu, 26 Mar 2009)
New Revision: 16339

Modified:
   
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java
Log:
Changed CytoscapeAction such that it reads the "keyCombo" attribute when 
loading TaskFactories.


Modified: 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java
===================================================================
--- 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java  
    2009-03-26 10:33:49 UTC (rev 16338)
+++ 
cytoscape3/trunk/application/src/main/java/cytoscape/util/CytoscapeAction.java  
    2009-03-26 12:52:50 UTC (rev 16339)
@@ -44,6 +44,7 @@
 import javax.swing.event.MenuEvent;
 import javax.swing.event.MenuListener;
 import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -88,6 +89,20 @@
                super((String)(configProps.get("title")));
                this.consoleName = (String)(configProps.get("title"));
                setPreferredMenu((String)(configProps.get("preferredMenu")));
+               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;
+                       }
+                       else
+                               System.out.println(String.format("Warning: The 
action \'%s\' has specified the following invalid key combination: %s", 
consoleName, keyComboString));
+               }
                this.netmgr = netmgr;
                consoleName = consoleName.replaceAll(":. \'", "");
                initialize();


--~--~---------~--~----~------------~-------~--~----~
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