mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-10 15:08:43 +00:00
8026929: remove accelerators from policytool resources
Reviewed-by: alexp, weijun
This commit is contained in:
parent
53d9506586
commit
47f35a5166
@ -1092,19 +1092,19 @@ class ToolWindow extends JFrame {
|
||||
JMenu menu = new JMenu();
|
||||
configureButton(menu, "File");
|
||||
ActionListener actionListener = new FileMenuListener(tool, this);
|
||||
addMenuItem(menu, NEW_POLICY_FILE, actionListener);
|
||||
addMenuItem(menu, OPEN_POLICY_FILE, actionListener);
|
||||
addMenuItem(menu, SAVE_POLICY_FILE, actionListener);
|
||||
addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener);
|
||||
addMenuItem(menu, VIEW_WARNINGS, actionListener);
|
||||
addMenuItem(menu, QUIT, actionListener);
|
||||
addMenuItem(menu, NEW_POLICY_FILE, actionListener, "N");
|
||||
addMenuItem(menu, OPEN_POLICY_FILE, actionListener, "O");
|
||||
addMenuItem(menu, SAVE_POLICY_FILE, actionListener, "S");
|
||||
addMenuItem(menu, SAVE_AS_POLICY_FILE, actionListener, null);
|
||||
addMenuItem(menu, VIEW_WARNINGS, actionListener, null);
|
||||
addMenuItem(menu, QUIT, actionListener, null);
|
||||
menuBar.add(menu);
|
||||
|
||||
// create a KeyStore menu
|
||||
menu = new JMenu();
|
||||
configureButton(menu, "KeyStore");
|
||||
actionListener = new MainWindowListener(tool, this);
|
||||
addMenuItem(menu, EDIT_KEYSTORE, actionListener);
|
||||
addMenuItem(menu, EDIT_KEYSTORE, actionListener, null);
|
||||
menuBar.add(menu);
|
||||
setJMenuBar(menuBar);
|
||||
|
||||
@ -1220,23 +1220,24 @@ class ToolWindow extends JFrame {
|
||||
// Platform specific modifier (control / command).
|
||||
private int shortCutModifier = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
|
||||
|
||||
private void addMenuItem(JMenu menu, String key, ActionListener actionListener) {
|
||||
private void addMenuItem(JMenu menu, String key, ActionListener actionListener, String accelerator) {
|
||||
JMenuItem menuItem = new JMenuItem();
|
||||
configureButton(menuItem, key);
|
||||
|
||||
if (PolicyTool.rb.containsKey(key + ".accelerator")) {
|
||||
String accelerator = PolicyTool.getMessage(key + ".accelerator");
|
||||
if (accelerator != null && !accelerator.isEmpty()) {
|
||||
KeyStroke keyStroke;
|
||||
if (accelerator.matches("^control .$")) {
|
||||
// Map "control" key to "command" on MacOS
|
||||
keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(8)),
|
||||
shortCutModifier);
|
||||
} else {
|
||||
keyStroke = KeyStroke.getKeyStroke(accelerator);
|
||||
}
|
||||
menuItem.setAccelerator(keyStroke);
|
||||
// Accelerator from resources takes precedence
|
||||
accelerator = PolicyTool.getMessage(key + ".accelerator");
|
||||
}
|
||||
|
||||
if (accelerator != null && !accelerator.isEmpty()) {
|
||||
KeyStroke keyStroke;
|
||||
if (accelerator.length() == 1) {
|
||||
keyStroke = KeyStroke.getKeyStroke(KeyEvent.getExtendedKeyCodeForChar(accelerator.charAt(0)),
|
||||
shortCutModifier);
|
||||
} else {
|
||||
keyStroke = KeyStroke.getKeyStroke(accelerator);
|
||||
}
|
||||
menuItem.setAccelerator(keyStroke);
|
||||
}
|
||||
|
||||
menuItem.addActionListener(actionListener);
|
||||
|
||||
@ -45,11 +45,8 @@ public class Resources extends java.util.ListResourceBundle {
|
||||
{".file.file.policy.file.location",
|
||||
" [-file <file>] policy file location"},
|
||||
{"New", "&New"},
|
||||
{"New.accelerator", "control N"},
|
||||
{"Open", "&Open..."},
|
||||
{"Open.accelerator", "control O"},
|
||||
{"Save", "&Save"},
|
||||
{"Save.accelerator", "control S"},
|
||||
{"Save.As", "Save &As..."},
|
||||
{"View.Warning.Log", "View &Warning Log"},
|
||||
{"Exit", "E&xit"},
|
||||
@ -92,8 +89,6 @@ public class Resources extends java.util.ListResourceBundle {
|
||||
{"OK.to.overwrite.existing.file.filename.",
|
||||
"OK to overwrite existing file {0}?"},
|
||||
{"Cancel", "Cancel"},
|
||||
|
||||
// Policy Entry Dialog
|
||||
{"CodeBase.", "&CodeBase:"},
|
||||
{"SignedBy.", "&SignedBy:"},
|
||||
{"Add.Principal", "&Add Principal"},
|
||||
@ -104,13 +99,10 @@ public class Resources extends java.util.ListResourceBundle {
|
||||
{".Edit.Permission", " Ed&it Permission"},
|
||||
{"Remove.Permission", "Re&move Permission"},
|
||||
{"Done", "Done"},
|
||||
|
||||
// KeyStore Edit Dialog
|
||||
{"KeyStore.URL.", "KeyStore &URL:"},
|
||||
{"KeyStore.Type.", "KeyStore &Type:"},
|
||||
{"KeyStore.Provider.", "KeyStore &Provider:"},
|
||||
{"KeyStore.Password.URL.", "KeyStore Pass&word URL:"},
|
||||
|
||||
{"Principals", "Principals"},
|
||||
{".Edit.Principal.", " Edit Principal:"},
|
||||
{".Add.New.Principal.", " Add New Principal:"},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user