private void resetTools() { for (int i=CUSTOM1; i<getNumTools()-1; i++) { names[i] = null; tools[i] = null; icons[i] = null; if (menus[i]!=null) menus[i].removeAll(); } }
private void resetTools() { for (int i=CUSTOM1; i<getNumTools()-1; i++) { names[i] = null; tools[i] = null; icons[i] = null; if (menus[i]!=null) menus[i].removeAll(); } }
void installPopupMenu(String name, Program pgm) { Hashtable h = pgm.getMenus(); if (h==null) return; String[] commands = (String[])h.get(name); if (commands==null) return; PopupMenu popup = Menus.getPopupMenu(); if (popup==null) return; popup.removeAll(); for (int i=0; i<commands.length; i++) { if (commands[i].equals("-")) popup.addSeparator(); else { MenuItem mi = new MenuItem(commands[i]); mi.addActionListener(this); popup.add(mi); } } }
/** Used by the MacroInstaller class to add a macro tool to the toolbar. */ public void addMacroTool(String name, MacroInstaller macroInstaller) { String custom1Name = names[CUSTOM1]; this.macroInstaller = macroInstaller; addingSingleTool = true; int tool = addTool(name); addingSingleTool = false; this.macroInstaller = null; if (tool!=-1) { tools[tool] = new MacroToolRunner(macroInstaller); if (!name.contains(" Menu Tool")) { if (menus[tool]!=null) menus[tool].removeAll(); if (!installingStartupTool) setTool(tool); else installingStartupTool = false; } if ((tool-CUSTOM1)>0 || custom1Name==null) setPrefs(tool); } }
void installPopupMenu(String name, Program pgm) { Hashtable h = pgm.getMenus(); if (h==null) return; String[] commands = (String[])h.get(name); if (commands==null) return; PopupMenu popup = Menus.getPopupMenu(); if (popup==null) return; popup.removeAll(); for (int i=0; i<commands.length; i++) { if (commands[i].equals("-")) popup.addSeparator(); else { MenuItem mi = new MenuItem(commands[i]); mi.addActionListener(this); popup.add(mi); } } }
/** Used by the MacroInstaller class to add a macro tool to the toolbar. */ public void addMacroTool(String name, MacroInstaller macroInstaller) { String custom1Name = names[CUSTOM1]; this.macroInstaller = macroInstaller; addingSingleTool = true; int tool = addTool(name); addingSingleTool = false; this.macroInstaller = null; if (tool!=-1) { tools[tool] = new MacroToolRunner(macroInstaller); if (!name.contains(" Menu Tool")) { if (menus[tool]!=null) menus[tool].removeAll(); if (!installingStartupTool) setTool(tool); else installingStartupTool = false; } if ((tool-CUSTOM1)>0 || custom1Name==null) setPrefs(tool); } }
} else list = new String[0]; switchPopup.removeAll(); path = IJ.getDir("macros") + "StartupMacros.txt"; f = new File(path);
} else list = new String[0]; switchPopup.removeAll(); path = IJ.getDir("macros") + "StartupMacros.txt"; f = new File(path);
add(menus[tool] ); } else menus[tool].removeAll(); for (int i=0; i<commands.length; i++) { if (commands[i].equals("-"))
/** Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. */ public static void addPlugInTool(PlugInTool tool) { if (instance==null) return; String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon(); instance.addingSingleTool = true; int id = instance.addTool(nameAndIcon); instance.addingSingleTool = false; if (id!=-1) { instance.tools[id] = tool; if (instance.menus[id]!=null) instance.menus[id].removeAll(); instance.repaintTool(id); if (!instance.installingStartupTool) instance.setTool(id); else instance.installingStartupTool = false; instance.setPrefs(id); } }
add(menus[tool] ); } else menus[tool].removeAll(); for (int i=0; i<commands.length; i++) { if (commands[i].equals("-"))
/** Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. */ public static void addPlugInTool(PlugInTool tool) { if (instance==null) return; String nameAndIcon = tool.getToolName()+" - "+tool.getToolIcon(); instance.addingSingleTool = true; int id = instance.addTool(nameAndIcon); instance.addingSingleTool = false; if (id!=-1) { instance.tools[id] = tool; if (instance.menus[id]!=null) instance.menus[id].removeAll(); instance.repaintTool(id); if (!instance.installingStartupTool) instance.setTool(id); else instance.installingStartupTool = false; instance.setPrefs(id); } }