1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

Show BoardName.boardName field in 'Ports' menu

...instead of putting it into the 'label' field during discovery.
This commit is contained in:
Cristian Maglie 2018-11-23 12:35:59 +01:00
parent ec4787a92b
commit 9ba172b0db
2 changed files with 8 additions and 6 deletions

View File

@ -1041,18 +1041,23 @@ public class Editor extends JFrame implements RunnerListener {
private BoardPort port; private BoardPort port;
public BoardPortJCheckBoxMenuItem(BoardPort port) { public BoardPortJCheckBoxMenuItem(BoardPort port) {
super(port.getLabel()); super();
this.port = port;
setText(toString());
addActionListener(e -> { addActionListener(e -> {
selectSerialPort(port.getAddress()); selectSerialPort(port.getAddress());
base.onBoardOrPortChange(); base.onBoardOrPortChange();
}); });
this.port = port;
} }
@Override @Override
public String toString() { public String toString() {
// This is required for serialPrompt() // This is required for serialPrompt()
return port.getLabel(); String label = port.getLabel();
if (port.getBoardName() != null && !port.getBoardName().isEmpty()) {
label += " (" + port.getBoardName() + ")";
}
return label;
} }
} }

View File

@ -196,9 +196,6 @@ public class SerialDiscovery implements Discovery, Runnable {
TargetBoard board = (TargetBoard) boardData.get("board"); TargetBoard board = (TargetBoard) boardData.get("board");
if (board != null) { if (board != null) {
String boardName = board.getName(); String boardName = board.getName();
if (boardName != null) {
label += " (" + boardName + ")";
}
boardPort.setBoardName(boardName); boardPort.setBoardName(boardName);
} }
} else { } else {