mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-30 19:52:13 +01:00
Removed dependency from Preferences in a bunch of classes.
This commit is contained in:
parent
22be22a5a7
commit
f2d92bbd0f
@ -25,7 +25,7 @@
|
||||
package cc.arduino.packages;
|
||||
|
||||
import processing.app.I18n;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.PreferencesData;
|
||||
import processing.app.debug.MessageConsumer;
|
||||
import processing.app.debug.MessageSiphon;
|
||||
import processing.app.debug.RunnerException;
|
||||
@ -67,7 +67,7 @@ public abstract class Uploader implements MessageConsumer {
|
||||
|
||||
protected Uploader() {
|
||||
this.error = null;
|
||||
this.verbose = Preferences.getBoolean("upload.verbose");
|
||||
this.verbose = PreferencesData.getBoolean("upload.verbose");
|
||||
this.notFoundError = false;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ import cc.arduino.packages.BoardPort;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.Session;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.PreferencesData;
|
||||
|
||||
public class SSHPwdSetup implements SSHClientSetupChainRing {
|
||||
|
||||
@ -13,7 +13,7 @@ public class SSHPwdSetup implements SSHClientSetupChainRing {
|
||||
String ipAddress = port.getAddress();
|
||||
|
||||
Session session = jSch.getSession("root", ipAddress, 22);
|
||||
session.setPassword(Preferences.get("runtime.pwd." + ipAddress));
|
||||
session.setPassword(PreferencesData.get("runtime.pwd." + ipAddress));
|
||||
|
||||
return session;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ import com.jcraft.jsch.JSchException;
|
||||
import com.jcraft.jsch.Session;
|
||||
import processing.app.BaseNoGui;
|
||||
import processing.app.I18n;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.PreferencesData;
|
||||
import processing.app.debug.RunnerException;
|
||||
import processing.app.debug.TargetPlatform;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
@ -82,7 +82,7 @@ public class SSHUploader extends Uploader {
|
||||
SSHClientSetupChainRing sshClientSetupChain = new SSHConfigFileSetup(new SSHPwdSetup());
|
||||
session = sshClientSetupChain.setup(port, jSch);
|
||||
|
||||
session.setUserInfo(new NoInteractionUserInfo(Preferences.get("runtime.pwd." + port.getAddress())));
|
||||
session.setUserInfo(new NoInteractionUserInfo(PreferencesData.get("runtime.pwd." + port.getAddress())));
|
||||
session.connect(30000);
|
||||
|
||||
scp = new SCP(session);
|
||||
@ -118,7 +118,7 @@ public class SSHUploader extends Uploader {
|
||||
|
||||
private boolean runAVRDude(SSH ssh) throws IOException, JSchException {
|
||||
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
|
||||
PreferencesMap prefs = Preferences.getMap();
|
||||
PreferencesMap prefs = PreferencesData.getMap();
|
||||
prefs.putAll(BaseNoGui.getBoardPreferences());
|
||||
prefs.putAll(targetPlatform.getTool(prefs.get("upload.tool")));
|
||||
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
||||
|
||||
import processing.app.BaseNoGui;
|
||||
import processing.app.I18n;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.PreferencesData;
|
||||
import processing.app.Serial;
|
||||
import processing.app.SerialException;
|
||||
import processing.app.debug.RunnerException;
|
||||
@ -49,7 +49,7 @@ public class SerialUploader extends Uploader {
|
||||
public boolean uploadUsingPreferences(File sourcePath, String buildPath, String className, boolean usingProgrammer, List<String> warningsAccumulator) throws Exception {
|
||||
// FIXME: Preferences should be reorganized
|
||||
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
|
||||
PreferencesMap prefs = Preferences.getMap();
|
||||
PreferencesMap prefs = PreferencesData.getMap();
|
||||
prefs.putAll(BaseNoGui.getBoardPreferences());
|
||||
String tool = prefs.getOrExcept("upload.tool");
|
||||
if (tool.contains(":")) {
|
||||
@ -132,7 +132,7 @@ public class SerialUploader extends Uploader {
|
||||
|
||||
try {
|
||||
if (uploadResult && doTouch) {
|
||||
String uploadPort = Preferences.get("serial.port");
|
||||
String uploadPort = PreferencesData.get("serial.port");
|
||||
if (waitForUploadPort) {
|
||||
// For Due/Leonardo wait until the bootloader serial port disconnects and the
|
||||
// sketch serial port reconnects (or timeout after a few seconds if the
|
||||
@ -203,14 +203,14 @@ public class SerialUploader extends Uploader {
|
||||
public boolean uploadUsingProgrammer(String buildPath, String className) throws Exception {
|
||||
|
||||
TargetPlatform targetPlatform = BaseNoGui.getTargetPlatform();
|
||||
String programmer = Preferences.get("programmer");
|
||||
String programmer = PreferencesData.get("programmer");
|
||||
if (programmer.contains(":")) {
|
||||
String[] split = programmer.split(":", 2);
|
||||
targetPlatform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
|
||||
programmer = split[1];
|
||||
}
|
||||
|
||||
PreferencesMap prefs = Preferences.getMap();
|
||||
PreferencesMap prefs = PreferencesData.getMap();
|
||||
prefs.putAll(BaseNoGui.getBoardPreferences());
|
||||
PreferencesMap programmerPrefs = targetPlatform.getProgrammer(programmer);
|
||||
if (programmerPrefs == null)
|
||||
@ -249,7 +249,7 @@ public class SerialUploader extends Uploader {
|
||||
|
||||
// Find preferences for the selected programmer
|
||||
PreferencesMap programmerPrefs;
|
||||
String programmer = Preferences.get("programmer");
|
||||
String programmer = PreferencesData.get("programmer");
|
||||
if (programmer.contains(":")) {
|
||||
String[] split = programmer.split(":", 2);
|
||||
TargetPlatform platform = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
|
||||
@ -263,7 +263,7 @@ public class SerialUploader extends Uploader {
|
||||
_("Please select a programmer from Tools->Programmer menu"));
|
||||
|
||||
// Build configuration for the current programmer
|
||||
PreferencesMap prefs = Preferences.getMap();
|
||||
PreferencesMap prefs = PreferencesData.getMap();
|
||||
prefs.putAll(BaseNoGui.getBoardPreferences());
|
||||
prefs.putAll(programmerPrefs);
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class BaseNoGui {
|
||||
|
||||
PreferencesMap prefs = new PreferencesMap(board.getPreferences());
|
||||
for (String menuId : board.getMenuIds()) {
|
||||
String entry = Preferences.get("custom_" + menuId);
|
||||
String entry = PreferencesData.get("custom_" + menuId);
|
||||
if (board.hasMenu(menuId) && entry != null &&
|
||||
entry.startsWith(board.getId())) {
|
||||
String selectionId = entry.substring(entry.indexOf("_") + 1);
|
||||
@ -114,7 +114,7 @@ public class BaseNoGui {
|
||||
}
|
||||
|
||||
static public TargetPlatform getCurrentTargetPlatformFromPackage(String pack) {
|
||||
return getTargetPlatform(pack, Preferences.get("target_platform"));
|
||||
return getTargetPlatform(pack, PreferencesData.get("target_platform"));
|
||||
}
|
||||
|
||||
static public File getHardwareFolder() {
|
||||
@ -164,7 +164,7 @@ public class BaseNoGui {
|
||||
|
||||
File settingsFolder = null;
|
||||
|
||||
String preferencesPath = Preferences.get("settings.path");
|
||||
String preferencesPath = PreferencesData.get("settings.path");
|
||||
if (preferencesPath != null) {
|
||||
settingsFolder = absoluteFile(preferencesPath);
|
||||
|
||||
@ -190,8 +190,8 @@ public class BaseNoGui {
|
||||
|
||||
static public File getSketchbookFolder() {
|
||||
if (portableFolder != null)
|
||||
return new File(portableFolder, Preferences.get("sketchbook.path"));
|
||||
return absoluteFile(Preferences.get("sketchbook.path"));
|
||||
return new File(portableFolder, PreferencesData.get("sketchbook.path"));
|
||||
return absoluteFile(PreferencesData.get("sketchbook.path"));
|
||||
}
|
||||
|
||||
static public File getSketchbookHardwareFolder() {
|
||||
@ -199,7 +199,7 @@ public class BaseNoGui {
|
||||
}
|
||||
|
||||
public static TargetBoard getTargetBoard() {
|
||||
String boardId = Preferences.get("board");
|
||||
String boardId = PreferencesData.get("board");
|
||||
return getTargetPlatform().getBoard(boardId);
|
||||
}
|
||||
|
||||
@ -209,8 +209,8 @@ public class BaseNoGui {
|
||||
* @return
|
||||
*/
|
||||
static public TargetPlatform getTargetPlatform() {
|
||||
String packageName = Preferences.get("target_package");
|
||||
String platformName = Preferences.get("target_platform");
|
||||
String packageName = PreferencesData.get("target_package");
|
||||
String platformName = PreferencesData.get("target_platform");
|
||||
return getTargetPlatform(packageName, platformName);
|
||||
}
|
||||
|
||||
@ -303,8 +303,8 @@ public class BaseNoGui {
|
||||
}
|
||||
|
||||
// help 3rd party installers find the correct hardware path
|
||||
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
|
||||
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);
|
||||
PreferencesData.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
|
||||
PreferencesData.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);
|
||||
}
|
||||
|
||||
static protected void loadHardware(File folder) {
|
||||
@ -360,7 +360,7 @@ public class BaseNoGui {
|
||||
}
|
||||
|
||||
// run static initialization that grabs all the prefs
|
||||
Preferences.init(absoluteFile(preferencesFile));
|
||||
PreferencesData.init(absoluteFile(preferencesFile));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public class NetworkMonitor extends AbstractMonitor {
|
||||
SSHClientSetupChainRing sshClientSetupChain = new SSHConfigFileSetup(new SSHPwdSetup());
|
||||
session = sshClientSetupChain.setup(port, jSch);
|
||||
|
||||
session.setUserInfo(new NoInteractionUserInfo(Preferences.get(getAuthorizationKey())));
|
||||
session.setUserInfo(new NoInteractionUserInfo(PreferencesData.get(getAuthorizationKey())));
|
||||
session.connect(30000);
|
||||
|
||||
tryConnect();
|
||||
|
@ -110,7 +110,7 @@ public class Platform {
|
||||
|
||||
|
||||
public void openURL(String url) throws Exception {
|
||||
String launcher = Preferences.get("launcher");
|
||||
String launcher = PreferencesData.get("launcher");
|
||||
if (launcher != null) {
|
||||
Runtime.getRuntime().exec(new String[] { launcher, url });
|
||||
} else {
|
||||
@ -120,12 +120,12 @@ public class Platform {
|
||||
|
||||
|
||||
public boolean openFolderAvailable() {
|
||||
return Preferences.get("launcher") != null;
|
||||
return PreferencesData.get("launcher") != null;
|
||||
}
|
||||
|
||||
|
||||
public void openFolder(File file) throws Exception {
|
||||
String launcher = Preferences.get("launcher");
|
||||
String launcher = PreferencesData.get("launcher");
|
||||
if (launcher != null) {
|
||||
String folder = file.getAbsolutePath();
|
||||
Runtime.getRuntime().exec(new String[] { launcher, folder });
|
||||
|
@ -63,40 +63,40 @@ public class Serial implements SerialPortEventListener {
|
||||
MessageConsumer consumer;
|
||||
|
||||
public Serial(boolean monitor) throws SerialException {
|
||||
this(Preferences.get("serial.port"),
|
||||
Preferences.getInteger("serial.debug_rate"),
|
||||
Preferences.get("serial.parity").charAt(0),
|
||||
Preferences.getInteger("serial.databits"),
|
||||
new Float(Preferences.get("serial.stopbits")).floatValue());
|
||||
this(PreferencesData.get("serial.port"),
|
||||
PreferencesData.getInteger("serial.debug_rate"),
|
||||
PreferencesData.get("serial.parity").charAt(0),
|
||||
PreferencesData.getInteger("serial.databits"),
|
||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
public Serial() throws SerialException {
|
||||
this(Preferences.get("serial.port"),
|
||||
Preferences.getInteger("serial.debug_rate"),
|
||||
Preferences.get("serial.parity").charAt(0),
|
||||
Preferences.getInteger("serial.databits"),
|
||||
new Float(Preferences.get("serial.stopbits")).floatValue());
|
||||
this(PreferencesData.get("serial.port"),
|
||||
PreferencesData.getInteger("serial.debug_rate"),
|
||||
PreferencesData.get("serial.parity").charAt(0),
|
||||
PreferencesData.getInteger("serial.databits"),
|
||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||
}
|
||||
|
||||
public Serial(int irate) throws SerialException {
|
||||
this(Preferences.get("serial.port"), irate,
|
||||
Preferences.get("serial.parity").charAt(0),
|
||||
Preferences.getInteger("serial.databits"),
|
||||
new Float(Preferences.get("serial.stopbits")).floatValue());
|
||||
this(PreferencesData.get("serial.port"), irate,
|
||||
PreferencesData.get("serial.parity").charAt(0),
|
||||
PreferencesData.getInteger("serial.databits"),
|
||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||
}
|
||||
|
||||
public Serial(String iname, int irate) throws SerialException {
|
||||
this(iname, irate, Preferences.get("serial.parity").charAt(0),
|
||||
Preferences.getInteger("serial.databits"),
|
||||
new Float(Preferences.get("serial.stopbits")).floatValue());
|
||||
this(iname, irate, PreferencesData.get("serial.parity").charAt(0),
|
||||
PreferencesData.getInteger("serial.databits"),
|
||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||
}
|
||||
|
||||
public Serial(String iname) throws SerialException {
|
||||
this(iname, Preferences.getInteger("serial.debug_rate"),
|
||||
Preferences.get("serial.parity").charAt(0),
|
||||
Preferences.getInteger("serial.databits"),
|
||||
new Float(Preferences.get("serial.stopbits")).floatValue());
|
||||
this(iname, PreferencesData.getInteger("serial.debug_rate"),
|
||||
PreferencesData.get("serial.parity").charAt(0),
|
||||
PreferencesData.getInteger("serial.databits"),
|
||||
new Float(PreferencesData.get("serial.stopbits")).floatValue());
|
||||
}
|
||||
|
||||
public static boolean touchPort(String iname, int irate) throws SerialException {
|
||||
|
Loading…
x
Reference in New Issue
Block a user