1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Fix status bar custom board preferences disappearing

This commit is contained in:
maged 2021-01-24 16:26:17 +02:00
parent f4e8a91f10
commit 5e7519473e
2 changed files with 11 additions and 12 deletions

View File

@ -2587,12 +2587,7 @@ public class Editor extends JFrame implements RunnerListener {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
protected void onBoardOrPortChange() {
TargetBoard board = BaseNoGui.getTargetBoard();
if (board != null)
lineStatus.setBoardName(board.getName());
else
lineStatus.setBoardName("-");
lineStatus.setPort(PreferencesData.get("serial.port"));
lineStatus.updateBoardAndPort();
lineStatus.repaint();
}

View File

@ -92,12 +92,7 @@ public class EditorLineStatus extends JComponent {
public void paintComponent(Graphics graphics) {
Graphics2D g = Theme.setupGraphics2D(graphics);
if (name.isEmpty() && port.isEmpty()) {
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
if (boardPreferences != null)
setBoardName(boardPreferences.get("name"));
else
setBoardName("-");
setPort(PreferencesData.get("serial.port"));
updateBoardAndPort();
}
g.setColor(background);
Dimension size = getSize();
@ -146,4 +141,13 @@ public class EditorLineStatus extends JComponent {
public Dimension getMaximumSize() {
return scale(new Dimension(3000, height));
}
public void updateBoardAndPort() {
PreferencesMap boardPreferences = BaseNoGui.getBoardPreferences();
if (boardPreferences != null)
setBoardName(boardPreferences.get("name"));
else
setBoardName("-");
setPort(PreferencesData.get("serial.port"));
}
}