1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-01 21:52:12 +01:00

Boards Menu: add hint if core lives in sketchbook

This commit is contained in:
Martino Facchin 2020-04-07 10:14:35 +02:00 committed by Cristian Maglie
parent ca20093472
commit 8c91692845
3 changed files with 15 additions and 0 deletions

View File

@ -1494,6 +1494,10 @@ public class Base {
if (platformLabel == null)
platformLabel = targetPackage.getId() + "-" + targetPlatform.getId();
// add an hint that this core lives in sketchbook
if (targetPlatform.isInSketchbook())
platformLabel += " (in sketchbook)";
JMenu platformBoardsMenu = new JMenu(platformLabel);
MenuScroller.setScrollerFor(platformBoardsMenu);
platformMenus.add(platformBoardsMenu);

View File

@ -245,4 +245,9 @@ public class LegacyTargetPlatform implements TargetPlatform {
res += " " + boardId + " = " + boards.get(boardId) + "\n";
return res + "}";
}
@Override
public boolean isInSketchbook() {
return getFolder().getAbsolutePath().startsWith(BaseNoGui.getDefaultSketchbookFolder().getAbsolutePath());
}
}

View File

@ -94,4 +94,10 @@ public interface TargetPlatform {
*/
public TargetPackage getContainerPackage();
/**
* Returns true if the platform is installed in a subfolder of the sketchbook
*
* @return
*/
public boolean isInSketchbook();
}