[Jsxe-cvs] SF.net SVN: jsxe: [1067] trunk/jsxe
Status: Inactive
Brought to you by:
ian_lewis
From: <ian...@us...> - 2006-07-28 20:23:09
|
Revision: 1067 Author: ian_lewis Date: 2006-07-26 09:56:28 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/jsxe/?rev=1067&view=rev Log Message: ----------- Fixed a bug where the shortcuts for Built-In commands were not being honored. Modified Paths: -------------- trunk/jsxe/Changelog trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java trunk/jsxe/src/net/sourceforge/jsxe/jsXe.java Modified: trunk/jsxe/Changelog =================================================================== --- trunk/jsxe/Changelog 2006-07-26 15:30:29 UTC (rev 1066) +++ trunk/jsxe/Changelog 2006-07-26 16:56:28 UTC (rev 1067) @@ -2,6 +2,8 @@ * Updated the find and findnext actions to use proper messages labels. + * Fixed a bug where the shortcuts for Built-In commands were not being + honored. 07/24/2006 Ian Lewis <Ian...@me...> Modified: trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-07-26 15:30:29 UTC (rev 1066) +++ trunk/jsxe/src/net/sourceforge/jsxe/ActionManager.java 2006-07-26 16:56:28 UTC (rev 1067) @@ -82,6 +82,7 @@ public static final String COPY_SUFFIX = ".copy"; public static final String PASTE_SUFFIX = ".paste"; public static final String FIND_SUFFIX = ".find"; + public static final String FIND_NEXT_SUFFIX = ".findnext"; //}}} @@ -173,27 +174,6 @@ Log.log(Log.NOTICE, ActionManager.class, "Loading key bindings."); if (!initialized) { - //Add EditBus Listener to update key bindings when properties are changed - EditBus.addToBus(new EBListener() { - - //{{{ handleMessage() - public void handleMessage(EBMessage message) { - if (message instanceof PropertyChanged) { - PropertyChanged msg = (PropertyChanged)message; - if (msg.getKey().endsWith(".shortcut")) { - String actionName = msg.getKey().substring(0, msg.getKey().lastIndexOf(".")); - String keyBinding = jsXe.getProperty(msg.getKey()); - if (keyBinding != null) { - addKeyBinding(keyBinding, actionName); - } else { - removeKeyBinding(msg.getOldValue()); - } - } - } - }//}}} - - }); - Iterator itr = m_actionSets.iterator(); while (itr.hasNext()) { ActionSet set = (ActionSet)itr.next(); @@ -233,9 +213,15 @@ if (action != null && keyBinding != null) { Action wrapper = getAction(action.getName()); + + KeyEventTranslator.Key key = KeyEventTranslator.parseKey(keyBinding); m_keyBindingMap.put(key, wrapper); + Log.log(Log.DEBUG, ActionManager.class, "Adding binding: "+key.toString()); + Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); + Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); + //need to do this so that the accelerator key is rendered on menu items wrapper.putValue(Action.ACCELERATOR_KEY, KeyEventTranslator.getKeyStroke(keyBinding)); } @@ -268,6 +254,9 @@ */ public static void handleKey(KeyEvent event) { KeyEventTranslator.Key key = KeyEventTranslator.translateKeyEvent(event); + Log.log(Log.DEBUG, ActionManager.class, "Key: "+key.toString()); + Log.log(Log.DEBUG, ActionManager.class, "key.key: "+key.key); + Log.log(Log.DEBUG, ActionManager.class, "key.input: "+key.input); //Gets the action for the Key. Action action = (Action)m_keyBindingMap.get(key); @@ -286,7 +275,8 @@ return (actionName.endsWith(CUT_SUFFIX) || actionName.endsWith(COPY_SUFFIX) || actionName.endsWith(PASTE_SUFFIX) || - actionName.endsWith(FIND_SUFFIX)); + actionName.endsWith(FIND_SUFFIX) || + actionName.endsWith(FIND_NEXT_SUFFIX)); }//}}} //{{{ Wrapper class Modified: trunk/jsxe/src/net/sourceforge/jsxe/jsXe.java =================================================================== --- trunk/jsxe/src/net/sourceforge/jsxe/jsXe.java 2006-07-26 15:30:29 UTC (rev 1066) +++ trunk/jsxe/src/net/sourceforge/jsxe/jsXe.java 2006-07-26 16:56:28 UTC (rev 1067) @@ -321,15 +321,32 @@ initPLAF(); //}}} - //{{{ init key bindings + //{{{ Add EditBus Listener to update key bindings when properties are changed /* - key bindings are loaded before the TabbedView is created - so that the ActionManagers EBListener is added to the EditBus first - Hopefully this is a temporary problem. + This must be done before creating the TabbedView so that + the ActionManager's listener is notified of changes first. */ - ActionManager.initKeyBindings(); - //}}} + EditBus.addToBus(new EBListener() { + + //{{{ handleMessage() + public void handleMessage(EBMessage message) { + if (message instanceof PropertyChanged) { + PropertyChanged msg = (PropertyChanged)message; + if (msg.getKey().endsWith(".shortcut")) { + String actionName = msg.getKey().substring(0, msg.getKey().lastIndexOf(".")); + String keyBinding = jsXe.getProperty(msg.getKey()); + if (keyBinding != null) { + ActionManager.addKeyBinding(keyBinding, actionName); + } else { + ActionManager.removeKeyBinding(msg.getOldValue()); + } + } + } + }//}}} + + });//}}} + //{{{ create the TabbedView Log.log(Log.NOTICE, jsXe.class, "Starting the main window"); TabbedView tabbedview = null; @@ -366,6 +383,10 @@ progressScreen.updateSplashScreenDialog(85); //}}} + //{{{ init key bindings + ActionManager.initKeyBindings(); + //}}} + //{{{ Parse files to open on the command line Log.log(Log.NOTICE, jsXe.class, "Parsing files to open on command line"); if (files.size() > 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |