Used by the MacroInstaller class to install a set of macro tools.
(String name, MacroInstaller macroInstaller, int id)
| 1854 | |
| 1855 | /** Used by the MacroInstaller class to install a set of macro tools. */ |
| 1856 | public void addMacroTool(String name, MacroInstaller macroInstaller, int id) { |
| 1857 | if (id==0) { |
| 1858 | resetTools(); |
| 1859 | if (name.startsWith("Unused")) |
| 1860 | return; |
| 1861 | } |
| 1862 | if (name.endsWith(" Built-in Tool")) { |
| 1863 | name = name.substring(0,name.length()-14); |
| 1864 | doNotSavePrefs = true; |
| 1865 | boolean ok = installBuiltinTool(name); |
| 1866 | if (!ok) { |
| 1867 | Hashtable commands = Menus.getCommands(); |
| 1868 | if (commands!=null && commands.get(name)!=null) |
| 1869 | IJ.run(name); |
| 1870 | } |
| 1871 | doNotSavePrefs = false; |
| 1872 | return; |
| 1873 | } |
| 1874 | this.macroInstaller = macroInstaller; |
| 1875 | int tool = addTool(name); |
| 1876 | this.macroInstaller = null; |
| 1877 | if (tool!=-1) |
| 1878 | tools[tool] = new MacroToolRunner(macroInstaller); |
| 1879 | } |
| 1880 | |
| 1881 | private void resetTools() { |
| 1882 | for (int i=CUSTOM1; i<getNumTools()-1; i++) { |
no test coverage detected