Index: openide/src/org/openide/awt/Actions.java
===================================================================
RCS file: /cvs/openide/src/org/openide/awt/Actions.java,v
retrieving revision 1.64
diff -c -r1.64 Actions.java
*** openide/src/org/openide/awt/Actions.java 9 Jul 2002 14:40:37 -0000 1.64
--- openide/src/org/openide/awt/Actions.java 23 Aug 2002 19:37:48 -0000
***************
*** 200,210 ****
} else {
item.setText(text.substring(0, i) + text.substring(i + 1));
if (useMnemonic) {
! item.setMnemonic(text.charAt(i + 1));
}
}
}
}
/** Replaces the first occurence of &? by ? or (&?? by the empty string
* where ? is a wildcard for any character.
--- 200,276 ----
} else {
item.setText(text.substring(0, i) + text.substring(i + 1));
if (useMnemonic) {
! char ch = text.charAt(i + 1);
! if ((ch>='A' && ch<='Z') || (ch>='a' && ch<='z') ||
! (ch>='0' && ch<='9')) {
! // it's latin character or arabic digit,
! // setting it as mnemonics
! item.setMnemonic(ch);
! } else {
! char latinChar = getLatinKeyboardChar(ch);
! item.setMnemonic (latinChar);
! setDisplayedMnemonicIndex(item, i, latinChar);
! }
}
}
}
}
+
+ /** Gets the latin symbol, which corresponds
+ * to some non-Latin symbol on the localized keyboard.
+ * The search is done via lookup of Resource bundle
+ * for pairs having the form, e.g. MNEMONIC_\u0424=A
.
+ * @param localeChar non-Latin character to be used as mnemonic
+ * @return character on latin keyboard, corresponding to the locale character.
+ */
+ private static char getLatinKeyboardChar(char localeChar) {
+ try {
+ // associated should be a latin character, arabic digit
+ // or US-keyboard punctuation
+ return org.openide.util.NbBundle.getBundle(Actions.class)
+ .getString("MNEMONIC_" + localeChar).charAt(0); // NOI18N
+ } catch (java.util.MissingResourceException ex) {
+ // correspondence not found, returning the character itself
+ return localeChar;
+ }
+ }
+
+ /** holds instance of Actions14 or plain object if not on JDK1.4 */
+ private static Object actions14;
+ /** Wrapper for the
+ * AbstractButton.setDisplayedMnemonicIndex
method.
+ *