Skip to content

Commit 9ba172b

Browse files
committed
Show BoardName.boardName field in 'Ports' menu
...instead of putting it into the 'label' field during discovery.
1 parent ec4787a commit 9ba172b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

app/src/processing/app/Editor.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -1041,18 +1041,23 @@ class BoardPortJCheckBoxMenuItem extends JCheckBoxMenuItem {
10411041
private BoardPort port;
10421042

10431043
public BoardPortJCheckBoxMenuItem(BoardPort port) {
1044-
super(port.getLabel());
1044+
super();
1045+
this.port = port;
1046+
setText(toString());
10451047
addActionListener(e -> {
10461048
selectSerialPort(port.getAddress());
10471049
base.onBoardOrPortChange();
10481050
});
1049-
this.port = port;
10501051
}
10511052

10521053
@Override
10531054
public String toString() {
10541055
// This is required for serialPrompt()
1055-
return port.getLabel();
1056+
String label = port.getLabel();
1057+
if (port.getBoardName() != null && !port.getBoardName().isEmpty()) {
1058+
label += " (" + port.getBoardName() + ")";
1059+
}
1060+
return label;
10561061
}
10571062
}
10581063

arduino-core/src/cc/arduino/packages/discoverers/serial/SerialDiscovery.java

-3
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,6 @@ public synchronized void forceRefresh() {
196196
TargetBoard board = (TargetBoard) boardData.get("board");
197197
if (board != null) {
198198
String boardName = board.getName();
199-
if (boardName != null) {
200-
label += " (" + boardName + ")";
201-
}
202199
boardPort.setBoardName(boardName);
203200
}
204201
} else {

0 commit comments

Comments
 (0)