Skip to content

Commit 27f9c3e

Browse files
author
Wilhelm Wiens
committed
Merge branch 'master' of https://github.com/arduino/Arduino
2 parents f4acfcb + 156d5d8 commit 27f9c3e

File tree

5 files changed

+27
-26
lines changed

5 files changed

+27
-26
lines changed

app/src/processing/app/Base.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,11 +1486,16 @@ public void actionPerformed(ActionEvent actionevent) {
14861486

14871487
// Add a title for each platform
14881488
String platformLabel = targetPlatform.getPreferences().get("name");
1489-
if (platformLabel != null && !targetPlatform.getBoards().isEmpty()) {
1490-
JMenuItem menuLabel = new JMenuItem(tr(platformLabel));
1491-
menuLabel.setEnabled(false);
1492-
boardMenu.add(menuLabel);
1493-
}
1489+
if (platformLabel == null)
1490+
platformLabel = targetPackage.getId() + "-" + targetPlatform.getId();
1491+
1492+
// add an hint that this core lives in sketchbook
1493+
if (targetPlatform.isInSketchbook())
1494+
platformLabel += " (in sketchbook)";
1495+
1496+
JMenu platformBoardsMenu = new JMenu(platformLabel);
1497+
MenuScroller.setScrollerFor(platformBoardsMenu);
1498+
platformMenus.add(platformBoardsMenu);
14941499

14951500
// Cycle through all boards of this platform
14961501
for (TargetBoard board : targetPlatform.getBoards().values()) {

app/test/processing/app/debug/TargetPlatformStub.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,10 @@ public TargetBoard getBoard(String boardId) {
9999
public TargetPackage getContainerPackage() {
100100
return targetPackage;
101101
}
102+
103+
@Override
104+
public boolean isInSketchbook() {
105+
// TODO Auto-generated method stub
106+
return false;
107+
}
102108
}

arduino-core/src/processing/app/debug/LegacyTargetPlatform.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,9 @@ public String toString() {
245245
res += " " + boardId + " = " + boards.get(boardId) + "\n";
246246
return res + "}";
247247
}
248+
249+
@Override
250+
public boolean isInSketchbook() {
251+
return getFolder().getAbsolutePath().startsWith(BaseNoGui.getSketchbookHardwareFolder().getAbsolutePath());
252+
}
248253
}

arduino-core/src/processing/app/debug/TargetPlatform.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,10 @@ public interface TargetPlatform {
9494
*/
9595
public TargetPackage getContainerPackage();
9696

97+
/**
98+
* Returns true if the platform is installed in a subfolder of the sketchbook
99+
*
100+
* @return
101+
*/
102+
public boolean isInSketchbook();
97103
}

arduino-core/src/processing/app/legacy/PApplet.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@ public class PApplet {
1616
/** Path to sketch folder */
1717
public String sketchPath; //folder;
1818

19-
/**
20-
* Full name of the Java version (i.e. 1.5.0_11).
21-
* Prior to 0125, this was only the first three digits.
22-
*/
23-
public static final String javaVersionName =
24-
System.getProperty("java.version");
25-
26-
/**
27-
* Version of Java that's in use, whether 1.1 or 1.3 or whatever,
28-
* stored as a float.
29-
* <P>
30-
* Note that because this is stored as a float, the values may
31-
* not be <EM>exactly</EM> 1.3 or 1.4. Instead, make sure you're
32-
* comparing against 1.3f or 1.4f, which will have the same amount
33-
* of error (i.e. 1.40000001). This could just be a double, but
34-
* since Processing only uses floats, it's safer for this to be a float
35-
* because there's no good way to specify a double with the preproc.
36-
*/
37-
public static final float javaVersion =
38-
new Float(javaVersionName.substring(0, 3)).floatValue();
39-
4019
/**
4120
* Current platform in use, one of the
4221
* PConstants WINDOWS, MACOSX, MACOS9, LINUX or OTHER.

0 commit comments

Comments
 (0)