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

Method installPlugins

ij/src/main/java/ij/Menus.java:631–691  ·  view source on GitHub ↗

Install plugins using "pluginxx=" keys in IJ_Prefs.txt. Plugins not listed in IJ_Prefs are added to the end of the Plugins menu.

()

Source from the content-addressed store, hash-verified

629 Plugins not listed in IJ_Prefs are added to the end
630 of the Plugins menu. */
631 void installPlugins() {
632 int nPlugins0 = nPlugins;
633 String value, className;
634 char menuCode;
635 Menu menu;
636 String[] pluginList = getPlugins();
637 String[] pluginsList2 = null;
638 Hashtable skipList = new Hashtable();
639 for (int index=0; index<100; index++) {
640 value = Prefs.getString("plugin" + (index/10)%10 + index%10);
641 if (value==null)
642 break;
643 menuCode = value.charAt(0);
644 switch (menuCode) {
645 case PLUGINS_MENU: default: menu = pluginsMenu; break;
646 case IMPORT_MENU: menu = getMenu("File>Import"); break;
647 case SAVE_AS_MENU: menu = getMenu("File>Save As"); break;
648 case SHORTCUTS_MENU: menu = shortcutsMenu; break;
649 case ABOUT_MENU: menu = getMenu("Help>About Plugins"); break;
650 case FILTERS_MENU: menu = getMenu("Process>Filters"); break;
651 case TOOLS_MENU: menu = getMenu("Analyze>Tools"); break;
652 case UTILITIES_MENU: menu = utilitiesMenu; break;
653 }
654 String prefsValue = value;
655 value = value.substring(2,value.length()); //remove menu code and coma
656 className = value.substring(value.lastIndexOf(',')+1,value.length());
657 boolean found = className.startsWith("ij.");
658 if (!found && pluginList!=null) { // does this plugin exist?
659 if (pluginsList2==null)
660 pluginsList2 = getStrippedPlugins(pluginList);
661 for (int i=0; i<pluginsList2.length; i++) {
662 if (className.startsWith(pluginsList2[i])) {
663 found = true;
664 break;
665 }
666 }
667 }
668 if (found && menu!=pluginsMenu) {
669 addPluginItem(menu, value);
670 pluginsPrefs.addElement(prefsValue);
671 if (className.endsWith("\")")) { // remove any argument
672 int argStart = className.lastIndexOf("(\"");
673 if (argStart>0)
674 className = className.substring(0, argStart);
675 }
676 skipList.put(className, "");
677 }
678 }
679 if (pluginList!=null) {
680 for (int i=0; i<pluginList.length; i++) {
681 if (!skipList.containsKey(pluginList[i]))
682 installUserPlugin(pluginList[i]);
683 }
684 }
685 if ((nPlugins-nPlugins0)<=1 && IJ.getDir("imagej")!=null && IJ.getDir("imagej").startsWith("/private")) {
686 pluginsMenu.addSeparator();
687 addPlugInItem(pluginsMenu, "Why are Plugins Missing?", "ij.plugin.SimpleCommands(\"missing\")", 0, false);
688 }

Callers 1

addMenuBarMethod · 0.95

Calls 15

getPluginsMethod · 0.95
getStringMethod · 0.95
getMenuMethod · 0.95
getStrippedPluginsMethod · 0.95
addPluginItemMethod · 0.95
installUserPluginMethod · 0.95
getDirMethod · 0.95
addPlugInItemMethod · 0.95
installJarPluginsMethod · 0.95
installMacrosMethod · 0.95
charAtMethod · 0.80
substringMethod · 0.80

Tested by

no test coverage detected