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

Method addPluginItem

ij/src/main/java/ij/Menus.java:554–592  ·  view source on GitHub ↗
(Menu submenu, String s)

Source from the content-addressed store, hash-verified

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) {

Callers 4

addSubMenuMethod · 0.95
addPluginsMenuMethod · 0.95
installPluginsMethod · 0.95
installJarPluginMethod · 0.95

Calls 10

addSeparatorMethod · 0.95
convertShortcutToCodeMethod · 0.95
addItemMethod · 0.95
startsWithMethod · 0.80
substringMethod · 0.80
valueOfMethod · 0.80
charAtMethod · 0.80
lengthMethod · 0.65
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected