MCPcopy Index your code
hub / github.com/processing/processing / createToolItem

Method createToolItem

app/src/processing/app/Base.java:845–870  ·  view source on GitHub ↗
(final Tool tool)

Source from the content-addressed store, hash-verified

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 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Callers 1

populateToolsMenuMethod · 0.95

Calls 1

getMenuTitleMethod · 0.65

Tested by

no test coverage detected