MCPcopy
hub / github.com/arduino/Arduino / addLibraries

Method addLibraries

app/src/processing/app/Base.java:1843–1869  ·  view source on GitHub ↗
(JMenu menu, LibraryList libs)

Source from the content-addressed store, hash-verified

1841 }
1842
1843 protected void addLibraries(JMenu menu, LibraryList libs) throws IOException {
1844
1845 LibraryList list = new LibraryList(libs);
1846 list.sort();
1847
1848 for (UserLibrary lib : list) {
1849 @SuppressWarnings("serial")
1850 AbstractAction action = new AbstractAction(lib.getName()) {
1851 public void actionPerformed(ActionEvent event) {
1852 UserLibrary l = (UserLibrary) getValue("library");
1853 try {
1854 activeEditor.getSketchController().importLibrary(l);
1855 } catch (IOException e) {
1856 showWarning(tr("Error"), format("Unable to list header files in {0}", l.getSrcFolder()), e);
1857 }
1858 }
1859 };
1860 action.putValue("library", lib);
1861
1862 // Add new element at the bottom
1863 JMenuItem item = new JMenuItem(action);
1864 item.putClientProperty("library", lib);
1865 menu.add(item);
1866
1867 // XXX: DAM: should recurse here so that library folders can be nested
1868 }
1869 }
1870
1871 /**
1872 * Given a folder, return a list of the header files in that folder (but not

Callers

nothing calls this directly

Calls 3

sortMethod · 0.95
getNameMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected