Skip to content

Commit ea8c144

Browse files
committed
Merge branch 'ide-1.5.x' into dev-ide-1.5.x-discovery
Conflicts: app/src/processing/app/Preferences.java app/src/processing/app/debug/Uploader.java
2 parents a205ceb + 56316ea commit ea8c144

File tree

840 files changed

+170908
-18320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

840 files changed

+170908
-18320
lines changed

app/src/cc/arduino/packages/Uploader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import processing.app.debug.MessageConsumer;
3232
import processing.app.debug.MessageSiphon;
3333
import processing.app.debug.RunnerException;
34+
import processing.app.helpers.ProcessUtils;
3435
import processing.app.helpers.StringUtils;
3536

3637
import java.io.File;
@@ -98,7 +99,7 @@ protected boolean executeUploadCommand(String command[]) throws Exception {
9899
System.out.print(c + " ");
99100
System.out.println();
100101
}
101-
Process process = Runtime.getRuntime().exec(command);
102+
Process process = ProcessUtils.exec(command);
102103
new MessageSiphon(process.getInputStream(), this);
103104
new MessageSiphon(process.getErrorStream(), this);
104105

app/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import processing.app.debug.RunnerException;
3434
import processing.app.debug.TargetPlatform;
3535
import processing.app.helpers.PreferencesMap;
36-
import processing.app.helpers.PreferencesMapException;
3736
import processing.app.helpers.StringReplacer;
3837

3938
import java.io.File;

app/src/processing/app/Base.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static public void main(String args[]) throws Exception {
145145
File versionFile = getContentFile("lib/version.txt");
146146
if (versionFile.exists()) {
147147
String version = PApplet.loadStrings(versionFile)[0];
148-
if (!version.equals(VERSION_NAME)) {
148+
if (!version.equals(VERSION_NAME) && !version.equals("${version}")) {
149149
VERSION_NAME = version;
150150
RELEASE = true;
151151
}
@@ -154,6 +154,10 @@ static public void main(String args[]) throws Exception {
154154
e.printStackTrace();
155155
}
156156

157+
// help 3rd party installers find the correct hardware path
158+
Preferences.set("last.ide." + VERSION_NAME + ".hardwarepath", getHardwarePath());
159+
Preferences.set("last.ide." + VERSION_NAME + ".daterun", "" + (new Date()).getTime() / 1000);
160+
157161
// if (System.getProperty("mrj.version") != null) {
158162
// //String jv = System.getProperty("java.version");
159163
// String ov = System.getProperty("os.version");

app/src/processing/app/Editor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ public void actionPerformed(ActionEvent e) {
650650

651651
if (importMenu == null) {
652652
importMenu = new JMenu(_("Import Library..."));
653+
MenuScroller.setScrollerFor(importMenu);
653654
base.rebuildImportMenu(importMenu, this);
654655
}
655656
sketchMenu.add(importMenu);

app/src/processing/app/EditorStatus.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -452,25 +452,21 @@ public void keyTyped(KeyEvent event) {
452452
add(progressBar);
453453
progressBar.setVisible(false);
454454

455-
copyErrorButton = new JButton(
456-
"<html>" + _("Copy error") + "<br>" + _("to clipboard") + "</html>");
457-
Font font = copyErrorButton.getFont();
458-
font = new Font(font.getName(), font.getStyle(), (int) (font.getSize()*0.7));
459-
copyErrorButton.setFont(font);
460-
copyErrorButton.setHorizontalAlignment(JLabel.CENTER);
455+
copyErrorButton = new JButton(_("Copy error"));
461456
add(copyErrorButton);
462457
copyErrorButton.setVisible(false);
463458
copyErrorButton.addActionListener(new ActionListener() {
464459
public void actionPerformed(ActionEvent e) {
465-
String message="";
460+
String message = "";
461+
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
462+
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n\n";
463+
message += editor.console.consoleTextPane.getText().trim();
466464
if ((Preferences.getBoolean("build.verbose")) == false) {
467-
message = " " + _("This report would have more information with") + "\n";
465+
message += "\n\n";
466+
message += " " + _("This report would have more information with") + "\n";
468467
message += " \"" + _("Show verbose output during compilation") + "\"\n";
469468
message += " " + _("enabled in File > Preferences.") + "\n";
470469
}
471-
message += _("Arduino: ") + Base.VERSION_NAME + " (" + System.getProperty("os.name") + "), ";
472-
message += _("Board: ") + "\"" + Base.getBoardPreferences().get("name") + "\"\n";
473-
message += editor.console.consoleTextPane.getText().trim();
474470
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
475471
StringSelection data = new StringSelection(message);
476472
clipboard.setContents(data, null);

app/src/processing/app/Preferences.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public class Preferences {
218218
// data model
219219

220220
static Hashtable defaults;
221-
static Hashtable table = new Hashtable();
221+
static Hashtable<String, String> table = new Hashtable<String, String>();
222222
static File preferencesFile;
223223

224224

@@ -242,9 +242,8 @@ static protected void init(String commandLinePrefs) {
242242
// check for platform-specific properties in the defaults
243243
String platformExt = "." + Base.platform.getName();
244244
int platformExtLength = platformExt.length();
245-
Enumeration e = table.keys();
246-
while (e.hasMoreElements()) {
247-
String key = (String) e.nextElement();
245+
Set<String> keySet = new HashSet<String>(table.keySet());
246+
for (String key : keySet) {
248247
if (key.endsWith(platformExt)) {
249248
// this is a key specific to a particular platform
250249
String actualKey = key.substring(0, key.length() - platformExtLength);
@@ -791,12 +790,12 @@ static protected void save() {
791790
// Fix for 0163 to properly use Unicode when writing preferences.txt
792791
PrintWriter writer = PApplet.createWriter(preferencesFile);
793792

794-
String[] keys = (String[])table.keySet().toArray(new String[0]);
793+
String[] keys = table.keySet().toArray(new String[0]);
795794
Arrays.sort(keys);
796795
for (String key: keys) {
797796
if (key.startsWith("runtime."))
798797
continue;
799-
writer.println(key + "=" + ((String) table.get(key)));
798+
writer.println(key + "=" + table.get(key));
800799
}
801800

802801
writer.flush();
@@ -818,7 +817,7 @@ static protected void save() {
818817
//}
819818

820819
static public String get(String attribute /*, String defaultValue */) {
821-
return (String) table.get(attribute);
820+
return table.get(attribute);
822821
/*
823822
//String value = (properties != null) ?
824823
//properties.getProperty(attribute) : applet.getParameter(attribute);

app/src/processing/app/debug/Compiler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import processing.app.Sketch;
4040
import processing.app.SketchCode;
4141
import processing.app.helpers.PreferencesMap;
42+
import processing.app.helpers.ProcessUtils;
4243
import processing.app.helpers.StringReplacer;
4344
import processing.app.helpers.filefilters.OnlyDirs;
4445
import processing.app.packages.Library;
@@ -343,9 +344,8 @@ private void execAsynchronously(String[] command) throws RunnerException {
343344
secondErrorFound = false;
344345

345346
Process process;
346-
347347
try {
348-
process = Runtime.getRuntime().exec(command);
348+
process = ProcessUtils.exec(command);
349349
} catch (IOException e) {
350350
RunnerException re = new RunnerException(e.getMessage());
351351
re.hideStackTrace();

app/src/processing/app/debug/Sizer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.regex.Pattern;
3131

3232
import processing.app.helpers.PreferencesMap;
33+
import processing.app.helpers.ProcessUtils;
3334
import processing.app.helpers.StringReplacer;
3435

3536
public class Sizer implements MessageConsumer {
@@ -67,7 +68,7 @@ public long[] computeSize() throws RunnerException {
6768
textSize = -1;
6869
dataSize = -1;
6970
eepromSize = -1;
70-
Process process = Runtime.getRuntime().exec(cmd);
71+
Process process = ProcessUtils.exec(cmd);
7172
MessageSiphon in = new MessageSiphon(process.getInputStream(), this);
7273
MessageSiphon err = new MessageSiphon(process.getErrorStream(), this);
7374

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package processing.app.helpers;
2+
3+
import java.io.IOException;
4+
5+
import processing.app.Base;
6+
7+
public class ProcessUtils {
8+
9+
public static Process exec(String[] command) throws IOException {
10+
// No problems on linux and mac
11+
if (!Base.isWindows()) {
12+
return Runtime.getRuntime().exec(command);
13+
}
14+
15+
// Brutal hack to workaround windows command line parsing.
16+
// http://stackoverflow.com/questions/5969724/java-runtime-exec-fails-to-escape-characters-properly
17+
// http://msdn.microsoft.com/en-us/library/a1y7w461.aspx
18+
// http://bugs.sun.com/view_bug.do?bug_id=6468220
19+
// http://bugs.sun.com/view_bug.do?bug_id=6518827
20+
String[] cmdLine = new String[command.length];
21+
for (int i = 0; i < command.length; i++)
22+
cmdLine[i] = command[i].replace("\"", "\\\"");
23+
return Runtime.getRuntime().exec(cmdLine);
24+
}
25+
}

app/src/processing/app/linux/Platform.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public boolean openFolderAvailable() {
108108

109109
public void openFolder(File file) throws Exception {
110110
if (openFolderAvailable()) {
111-
String lunch = Preferences.get("launcher");
111+
String launcher = Preferences.get("launcher");
112112
try {
113-
String[] params = new String[] { lunch, file.getAbsolutePath() };
113+
String[] params = new String[] { launcher, file.getAbsolutePath() };
114114
//processing.core.PApplet.println(params);
115115
/*Process p =*/ Runtime.getRuntime().exec(params);
116116
/*int result =*/ //p.waitFor();

0 commit comments

Comments
 (0)