(final Tool tool)
| 843 | |
| 844 | |
| 845 | JMenuItem createToolItem(final Tool tool) { //, Map<String, JMenuItem> toolItems) { |
| 846 | String title = tool.getMenuTitle(); |
| 847 | final JMenuItem item = new JMenuItem(title); |
| 848 | item.addActionListener(new ActionListener() { |
| 849 | |
| 850 | public void actionPerformed(ActionEvent e) { |
| 851 | try { |
| 852 | tool.run(); |
| 853 | |
| 854 | } catch (NoSuchMethodError nsme) { |
| 855 | activeEditor.statusError("\"" + tool.getMenuTitle() + "\" is not" + |
| 856 | "compatible with this version of Processing"); |
| 857 | //nsme.printStackTrace(); |
| 858 | Messages.loge("Incompatible tool found during tool.run()", nsme); |
| 859 | item.setEnabled(false); |
| 860 | |
| 861 | } catch (Exception ex) { |
| 862 | activeEditor.statusError("An error occurred inside \"" + tool.getMenuTitle() + "\""); |
| 863 | ex.printStackTrace(); |
| 864 | item.setEnabled(false); |
| 865 | } |
| 866 | } |
| 867 | }); |
| 868 | //toolItems.put(title, item); |
| 869 | return item; |
| 870 | } |
| 871 | |
| 872 | |
| 873 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
no test coverage detected