Skip to content

Boards Menu: add hint if core lives in sketchbook #10007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/src/processing/app/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,10 @@ public void actionPerformed(ActionEvent actionevent) {
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);
Expand Down
6 changes: 6 additions & 0 deletions app/test/processing/app/debug/TargetPlatformStub.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,10 @@ public TargetBoard getBoard(String boardId) {
public TargetPackage getContainerPackage() {
return targetPackage;
}

@Override
public boolean isInSketchbook() {
// TODO Auto-generated method stub
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,9 @@ public String toString() {
res += " " + boardId + " = " + boards.get(boardId) + "\n";
return res + "}";
}

@Override
public boolean isInSketchbook() {
return getFolder().getAbsolutePath().startsWith(BaseNoGui.getSketchbookHardwareFolder().getAbsolutePath());
}
}
6 changes: 6 additions & 0 deletions arduino-core/src/processing/app/debug/TargetPlatform.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}