(int tool)
| 1820 | } |
| 1821 | |
| 1822 | void installMenu(int tool) { |
| 1823 | Program pgm = macroInstaller.getProgram(); |
| 1824 | Hashtable h = pgm.getMenus(); |
| 1825 | if (h==null) return; |
| 1826 | String[] commands = (String[])h.get(names[tool]); |
| 1827 | if (commands==null) |
| 1828 | return; |
| 1829 | if (menus[tool]==null) { |
| 1830 | menus[tool] = new PopupMenu(""); |
| 1831 | GUI.scalePopupMenu(menus[tool]); |
| 1832 | add(menus[tool] ); |
| 1833 | } else |
| 1834 | menus[tool].removeAll(); |
| 1835 | for (int i=0; i<commands.length; i++) { |
| 1836 | if (commands[i].equals("-")) |
| 1837 | menus[tool].addSeparator(); |
| 1838 | else if (commands[i].startsWith("-")) |
| 1839 | menus[tool].addSeparator(); |
| 1840 | else { |
| 1841 | boolean disable = commands[i].startsWith("*"); |
| 1842 | String command = commands[i]; |
| 1843 | if (disable) |
| 1844 | command = command.substring(1); |
| 1845 | MenuItem mi = new MenuItem(command); |
| 1846 | if (disable) |
| 1847 | mi.setEnabled(false); |
| 1848 | mi.addActionListener(this); |
| 1849 | menus[tool].add(mi); |
| 1850 | } |
| 1851 | } |
| 1852 | if (tool==current) setTool(RECTANGLE); |
| 1853 | } |
| 1854 | |
| 1855 | /** Used by the MacroInstaller class to install a set of macro tools. */ |
| 1856 | public void addMacroTool(String name, MacroInstaller macroInstaller, int id) { |
no test coverage detected