mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Added Contributions for libraries
This commit is contained in:
committed by
Federico Fissore
parent
75d1cb874d
commit
0b9223c158
@ -22,6 +22,15 @@
|
||||
|
||||
package processing.app;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import cc.arduino.libraries.contributions.LibrariesIndexer;
|
||||
import cc.arduino.packages.DiscoveryManager;
|
||||
import cc.arduino.packages.contributions.ui.ContributionManagerUI;
|
||||
import cc.arduino.view.SplashScreenHelper;
|
||||
@ -34,8 +43,9 @@ import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import processing.app.legacy.PApplet;
|
||||
import processing.app.macosx.ThinkDifferent;
|
||||
import processing.app.packages.Library;
|
||||
import processing.app.legacy.PConstants;
|
||||
import processing.app.packages.LibraryList;
|
||||
import processing.app.packages.UserLibrary;
|
||||
import processing.app.tools.MenuScroller;
|
||||
import processing.app.tools.ZipDeflater;
|
||||
|
||||
@ -1083,14 +1093,14 @@ public class Base {
|
||||
// Add examples from libraries
|
||||
LibraryList ideLibs = getIDELibs();
|
||||
ideLibs.sort();
|
||||
for (Library lib : ideLibs)
|
||||
for (UserLibrary lib : ideLibs)
|
||||
addSketchesSubmenu(menu, lib, false);
|
||||
|
||||
LibraryList userLibs = getUserLibs();
|
||||
if (userLibs.size()>0) {
|
||||
menu.addSeparator();
|
||||
userLibs.sort();
|
||||
for (Library lib : userLibs)
|
||||
for (UserLibrary lib : userLibs)
|
||||
addSketchesSubmenu(menu, lib, false);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -1098,14 +1108,6 @@ public class Base {
|
||||
}
|
||||
}
|
||||
|
||||
public LibraryList scanLibraries(List<File> folders) throws IOException {
|
||||
return BaseNoGui.scanLibraries(folders);
|
||||
}
|
||||
|
||||
public LibraryList scanLibraries(File folder) throws IOException {
|
||||
return BaseNoGui.scanLibraries(folder);
|
||||
}
|
||||
|
||||
public void onBoardOrPortChange() {
|
||||
BaseNoGui.onBoardOrPortChange();
|
||||
|
||||
@ -1431,10 +1433,10 @@ public class Base {
|
||||
return ifound;
|
||||
}
|
||||
|
||||
private boolean addSketchesSubmenu(JMenu menu, Library lib,
|
||||
private boolean addSketchesSubmenu(JMenu menu, UserLibrary lib,
|
||||
boolean replaceExisting)
|
||||
throws IOException {
|
||||
return addSketchesSubmenu(menu, lib.getName(), lib.getFolder(),
|
||||
return addSketchesSubmenu(menu, lib.getName(), lib.getInstalledFolder(),
|
||||
replaceExisting);
|
||||
}
|
||||
|
||||
@ -1516,11 +1518,11 @@ public class Base {
|
||||
LibraryList list = new LibraryList(libs);
|
||||
list.sort();
|
||||
|
||||
for (Library lib : list) {
|
||||
for (UserLibrary lib : list) {
|
||||
@SuppressWarnings("serial")
|
||||
AbstractAction action = new AbstractAction(lib.getName()) {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
Library l = (Library) getValue("library");
|
||||
UserLibrary l = (UserLibrary) getValue("library");
|
||||
try {
|
||||
activeEditor.getSketch().importLibrary(l);
|
||||
} catch (IOException e) {
|
||||
|
@ -34,7 +34,8 @@ import processing.app.forms.PasswordAuthorizationDialog;
|
||||
import processing.app.helpers.OSUtils;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
import processing.app.helpers.PreferencesMapException;
|
||||
import processing.app.packages.Library;
|
||||
import processing.app.packages.UserLibrary;
|
||||
import static processing.app.I18n._;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@ -938,7 +939,7 @@ public class Sketch {
|
||||
}
|
||||
|
||||
|
||||
public void importLibrary(Library lib) throws IOException {
|
||||
public void importLibrary(UserLibrary lib) throws IOException {
|
||||
importLibrary(lib.getSrcFolder());
|
||||
}
|
||||
|
||||
|
@ -26,11 +26,12 @@ package processing.app.syntax;
|
||||
|
||||
import processing.app.*;
|
||||
import processing.app.legacy.PApplet;
|
||||
import processing.app.packages.Library;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import cc.arduino.libraries.contributions.ContributedLibrary;
|
||||
|
||||
|
||||
public class PdeKeywords extends CTokenMarker {
|
||||
|
||||
@ -61,8 +62,8 @@ public class PdeKeywords extends CTokenMarker {
|
||||
keywordColoring = new KeywordMap(false);
|
||||
keywordToReference = new Hashtable();
|
||||
getKeywords(Base.getLibStream("keywords.txt"));
|
||||
for (Library lib : Base.getLibraries()) {
|
||||
File keywords = new File(lib.getFolder(), "keywords.txt");
|
||||
for (ContributedLibrary lib : Base.getLibraries()) {
|
||||
File keywords = new File(lib.getInstalledFolder(), "keywords.txt");
|
||||
if (keywords.exists()) getKeywords(new FileInputStream(keywords));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
Reference in New Issue
Block a user