Skip to content

Commit 81c1bca

Browse files
cmagliefacchinm
authored andcommitted
Show BoardName.boardName field in 'Ports' menu
...instead of putting it into the 'label' field during discovery.
1 parent 3cb8d74 commit 81c1bca

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

app/src/processing/app/Editor.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,9 @@ class BoardPortJCheckBoxMenuItem extends JCheckBoxMenuItem {
10651065
private BoardPort port;
10661066

10671067
public BoardPortJCheckBoxMenuItem(BoardPort port) {
1068-
super(port.getLabel());
1068+
super();
1069+
this.port = port;
1070+
setText(toString());
10691071
addActionListener(e -> {
10701072
selectSerialPort(port.getAddress(), port.getBoardId());
10711073
if (port.getBoardId() != null && PreferencesData.getBoolean("editor.autoselectboard")) {
@@ -1076,13 +1078,16 @@ public BoardPortJCheckBoxMenuItem(BoardPort port) {
10761078
}
10771079
base.onBoardOrPortChange();
10781080
});
1079-
this.port = port;
10801081
}
10811082

10821083
@Override
10831084
public String toString() {
10841085
// This is required for serialPrompt()
1085-
return port.getLabel();
1086+
String label = port.getLabel();
1087+
if (port.getBoardName() != null && !port.getBoardName().isEmpty()) {
1088+
label += " (" + port.getBoardName() + ")";
1089+
}
1090+
return label;
10861091
}
10871092
}
10881093

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

Lines changed: 0 additions & 3 deletions
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
boardPort.setBoardId(board.getId());
204201
}

0 commit comments

Comments
 (0)