7 import java.awt.event.*;
12 public void run(String arg) {
13 if (arg.equals(
"shortcuts"))
19 public void listCommands() {
21 Vector v =
new Vector();
22 for (Enumeration en=commands.keys(); en.hasMoreElements();) {
23 String command = (String)en.nextElement();
24 v.addElement(command+
"\t"+(String)commands.get(command));
26 showList(
"Commands",
"Command\tPlugin", v);
29 public void listShortcuts() {
30 Hashtable shortcuts = Menus.getShortcuts();
31 Vector v =
new Vector();
32 for (Enumeration en=shortcuts.keys(); en.hasMoreElements();) {
33 Integer key = (Integer)en.nextElement();
34 int keyCode = key.intValue();
35 boolean upperCase =
false;
40 String shortcut = KeyEvent.getKeyText(keyCode);
41 if (!upperCase && shortcut.length()==1) {
42 char c = shortcut.charAt(0);
45 char[] chars =
new char[1];
47 shortcut =
new String(chars);
49 if (shortcut.length()>1)
50 shortcut =
" " + shortcut;
51 v.addElement(shortcut+
"\t"+(String)shortcuts.get(key));
53 showList(
"Keyboard Shortcuts",
"Hot Key\tCommand", v);
56 void showList(String title, String headings, Vector v) {
57 String[] list =
new String[v.size()];
58 v.copyInto((String[])list);
59 StringSorter.sort(list);
60 StringBuffer sb =
new StringBuffer();
61 for (
int i=0; i<list.length; i++) {
65 TextWindow tw =
new TextWindow(title, headings, sb.toString(), 300, 400);