Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Stornelli2019-05-04 13:40:43 -0400
committerDoug Schaefer2019-05-06 12:08:10 -0400
commit0b113d199cc35b934f718607ed164ab6fcf902ee (patch)
tree093499cf615c1a407ef7aea808394b084324486f
parent665f47395e441584cc79fa1955a77ba1411f6665 (diff)
downloadorg.eclipse.cdt-0b113d199cc35b934f718607ed164ab6fcf902ee.tar.gz
org.eclipse.cdt-0b113d199cc35b934f718607ed164ab6fcf902ee.tar.xz
org.eclipse.cdt-0b113d199cc35b934f718607ed164ab6fcf902ee.zip
Bug 546979 - Fix exception in arduino port management
Change-Id: I6958581f5314898193f9fa670a106a594baa13a7 Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF2
-rw-r--r--toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java19
2 files changed, 16 insertions, 5 deletions
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF b/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF
index 7562afd7b4..a5ccd7a50d 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.arduino.ui;singleton:=true
-Bundle-Version: 2.1.100.qualifier
+Bundle-Version: 2.1.200.qualifier
Bundle-Activator: org.eclipse.cdt.arduino.ui.internal.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.expressions,
diff --git a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java
index 366277381f..c5dc9a2855 100644
--- a/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java
+++ b/toolchains/arduino/org.eclipse.cdt.arduino.ui/src/org/eclipse/cdt/arduino/ui/internal/remote/ArduinoTargetPropertyPage.java
@@ -55,11 +55,20 @@ public class ArduinoTargetPropertyPage extends PropertyPage implements IWorkbenc
portSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
String currentPort = arduinoRemote.getPortName();
- portSelector.setText(currentPort);
try {
- for (String port : SerialPort.list()) {
+ int i = 0;
+ int portIdx = -1;
+ String[] ports = SerialPort.list();
+ for (String port : ports) {
portSelector.add(port);
+ if (port.equals(currentPort))
+ portIdx = i;
+ ++i;
}
+ if (portIdx >= 0)
+ portSelector.select(portIdx);
+ if (ports.length == 0)
+ portSelector.setText(Messages.ArduinoTargetPropertyPage_1);
} catch (IOException e) {
Activator.log(e);
}
@@ -100,8 +109,10 @@ public class ArduinoTargetPropertyPage extends PropertyPage implements IWorkbenc
ArduinoBoard board = boards[boardSelector.getSelectionIndex()];
ArduinoRemoteConnection.setBoardId(workingCopy, board);
- String portName = portSelector.getItem(portSelector.getSelectionIndex());
- ArduinoRemoteConnection.setPortName(workingCopy, portName);
+ int idx = portSelector.getSelectionIndex();
+ if (idx >= 0) {
+ ArduinoRemoteConnection.setPortName(workingCopy, portSelector.getItem(idx));
+ }
try {
workingCopy.save();

Back to the top