mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 13:25:45 +02:00
Bug 546979 - Fix exception in arduino port management
Change-Id: I6958581f5314898193f9fa670a106a594baa13a7 Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
parent
665f47395e
commit
0b113d199c
2 changed files with 16 additions and 5 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.arduino.ui;singleton:=true
|
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
|
Bundle-Activator: org.eclipse.cdt.arduino.ui.internal.Activator
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.core.expressions,
|
org.eclipse.core.expressions,
|
||||||
|
|
|
@ -55,11 +55,20 @@ public class ArduinoTargetPropertyPage extends PropertyPage implements IWorkbenc
|
||||||
portSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
portSelector.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
String currentPort = arduinoRemote.getPortName();
|
String currentPort = arduinoRemote.getPortName();
|
||||||
portSelector.setText(currentPort);
|
|
||||||
try {
|
try {
|
||||||
for (String port : SerialPort.list()) {
|
int i = 0;
|
||||||
|
int portIdx = -1;
|
||||||
|
String[] ports = SerialPort.list();
|
||||||
|
for (String port : ports) {
|
||||||
portSelector.add(port);
|
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) {
|
} catch (IOException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
|
@ -100,8 +109,10 @@ public class ArduinoTargetPropertyPage extends PropertyPage implements IWorkbenc
|
||||||
ArduinoBoard board = boards[boardSelector.getSelectionIndex()];
|
ArduinoBoard board = boards[boardSelector.getSelectionIndex()];
|
||||||
ArduinoRemoteConnection.setBoardId(workingCopy, board);
|
ArduinoRemoteConnection.setBoardId(workingCopy, board);
|
||||||
|
|
||||||
String portName = portSelector.getItem(portSelector.getSelectionIndex());
|
int idx = portSelector.getSelectionIndex();
|
||||||
ArduinoRemoteConnection.setPortName(workingCopy, portName);
|
if (idx >= 0) {
|
||||||
|
ArduinoRemoteConnection.setPortName(workingCopy, portSelector.getItem(idx));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
workingCopy.save();
|
workingCopy.save();
|
||||||
|
|
Loading…
Add table
Reference in a new issue