MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / removeHotkey

Method removeHotkey

ij/src/main/java/ij/plugin/Hotkeys.java:88–125  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86 }
87
88 void removeHotkey() {
89 String[] shortcuts = getShortcuts();
90 if (shortcuts==null) {
91 IJ.showMessage("Remove...", "No shortcuts found.");
92 return;
93 }
94 GenericDialog gd = new GenericDialog("Remove");
95 gd.addChoice("Shortcut:", shortcuts, "");
96 if (shortcuts.length>1)
97 gd.addCheckbox("Remove all "+shortcuts.length+" shortcuts", false);
98 gd.addMessage("Shortcuts are not removed\nuntil ImageJ is restarted.");
99 gd.showDialog();
100 if (gd.wasCanceled())
101 return;
102 command = gd.getNextChoice();
103 boolean removeAll = false;
104 if (shortcuts.length>1)
105 removeAll = gd.getNextBoolean();
106 if (removeAll) {
107 boolean ok = IJ.showMessageWithCancel("Remove", "Remove all "+shortcuts.length+" shortcuts?");
108 if (!ok)
109 return;
110 command = "";
111 } else {
112 shortcuts = new String[1];
113 shortcuts[0] = command;
114 }
115 int count = 0;
116 for (int i=0; i<shortcuts.length; i++) {
117 int err = Menus.uninstallPlugin(shortcuts[i]);
118 if (err==Menus.NORMAL_RETURN)
119 count++;
120 }
121 if (count==0)
122 IJ.showStatus("No shortcuts removed");
123 else
124 IJ.showStatus(count+" shortcut"+(count>1?"s":"")+" removed; ImageJ restart required");
125 }
126
127 private void listCommands() {
128 String[] commands = getAllCommands();

Callers 1

runMethod · 0.95

Calls 12

getShortcutsMethod · 0.95
showMessageMethod · 0.95
addChoiceMethod · 0.95
addCheckboxMethod · 0.95
addMessageMethod · 0.95
showDialogMethod · 0.95
wasCanceledMethod · 0.95
getNextChoiceMethod · 0.95
getNextBooleanMethod · 0.95
showMessageWithCancelMethod · 0.95
uninstallPluginMethod · 0.95
showStatusMethod · 0.95

Tested by

no test coverage detected