(Menu submenu, String s)
| 552 | } |
| 553 | |
| 554 | static void addPluginItem(Menu submenu, String s) { |
| 555 | if (s.startsWith("\"-\"")) { |
| 556 | // add menu separator if command="-" |
| 557 | addSeparator(submenu); |
| 558 | return; |
| 559 | } |
| 560 | int lastComma = s.lastIndexOf(','); |
| 561 | if (lastComma<=0) |
| 562 | return; |
| 563 | String command = s.substring(1,lastComma-1); |
| 564 | int keyCode = 0; |
| 565 | boolean shift = false; |
| 566 | if (command.endsWith("]")) { |
| 567 | int openBracket = command.lastIndexOf('['); |
| 568 | if (openBracket>0) { |
| 569 | String shortcut = command.substring(openBracket+1,command.length()-1); |
| 570 | keyCode = convertShortcutToCode(shortcut); |
| 571 | boolean functionKey = keyCode>=KeyEvent.VK_F1 && keyCode<=KeyEvent.VK_F12; |
| 572 | if (keyCode>0 && !functionKey) |
| 573 | command = command.substring(0,openBracket); |
| 574 | } |
| 575 | } |
| 576 | if (keyCode>=KeyEvent.VK_F1 && keyCode<=KeyEvent.VK_F12) { |
| 577 | shortcuts.put(Integer.valueOf(keyCode),command); |
| 578 | keyCode = 0; |
| 579 | } else if (keyCode>=265 && keyCode<=290) { |
| 580 | keyCode -= 200; |
| 581 | shift = true; |
| 582 | } |
| 583 | addItem(submenu,command,keyCode,shift); |
| 584 | while(s.charAt(lastComma+1)==' ' && lastComma+2<s.length()) |
| 585 | lastComma++; // remove leading spaces |
| 586 | String className = s.substring(lastComma+1,s.length()); |
| 587 | //IJ.log(command+" "+className); |
| 588 | if (installingJars) |
| 589 | duplicateCommand = pluginsTable.get(command)!=null; |
| 590 | pluginsTable.put(command, className); |
| 591 | nPlugins++; |
| 592 | } |
| 593 | |
| 594 | void checkForDuplicate(String command) { |
| 595 | if (pluginsTable.get(command)!=null) { |
no test coverage detected