11
11
import java .util .TreeMap ;
12
12
import java .util .TreeSet ;
13
13
14
- import org .eclipse .core .runtime .CoreException ;
15
14
import org .eclipse .core .runtime .IPath ;
16
15
import org .eclipse .core .runtime .IProgressMonitor ;
17
16
import org .eclipse .core .runtime .IStatus ;
@@ -53,10 +52,10 @@ public static String getUpdateJasonFilesKey() {
53
52
}
54
53
55
54
/**
56
- * Gets the board id based on the information provided. If
57
- * jsonFileName="local" the board is assumend not to be installed by the
55
+ * Gets the board descriptor based on the information provided. If
56
+ * jsonFileName="local" the board is assumed not to be installed by the
58
57
* boards manager. Otherwise the boardsmanager is queried to find the board
59
- * ID . In this case the latest installed board will be returned
58
+ * descriptor . In this case the latest installed board will be returned
60
59
*
61
60
* @param jsonFileName
62
61
* equals to "local" or the name of the json file used by the
@@ -75,7 +74,7 @@ public static String getUpdateJasonFilesKey() {
75
74
* boards.txt file)
76
75
* @return The class BoardDescriptor or null
77
76
*/
78
- static public BoardDescriptor getBoardID (String jsonFileName , String packageName , String platformName ,
77
+ static public BoardDescriptor getBoardDescriptor (String jsonFileName , String packageName , String platformName ,
79
78
String boardID , Map <String , String > options ) {
80
79
if (jsonFileName .equals ("local" )) { //$NON-NLS-1$
81
80
return BoardDescriptor .makeBoardDescriptor (new File (packageName ), boardID , options );
@@ -87,22 +86,18 @@ static private BoardDescriptor getNewestBoardIDFromBoardsManager(String jsonFile
87
86
String platformName , String boardID , Map <String , String > options ) {
88
87
89
88
List <Board > boards = null ;
90
- try {
91
- Package thePackage = Manager .getPackage (jsonFileName , packageName );
92
- if (thePackage == null ) {
93
- // fail("failed to find package:" + this.mPackageName);
94
- return null ;
95
- }
96
- ArduinoPlatform platform = thePackage .getLatestPlatform (platformName );
97
- if (platform == null ) {
98
- // fail("failed to find platform " + this.mPlatform + " in
99
- // package:" + this.mPackageName);
100
- return null ;
101
- }
102
- boards = platform .getBoards ();
103
- } catch (CoreException e1 ) {
104
- e1 .printStackTrace ();
89
+ Package thePackage = Manager .getPackage (jsonFileName , packageName );
90
+ if (thePackage == null ) {
91
+ // fail("failed to find package:" + this.mPackageName);
92
+ return null ;
105
93
}
94
+ ArduinoPlatform platform = thePackage .getLatestPlatform (platformName );
95
+ if (platform == null ) {
96
+ // fail("failed to find platform " + this.mPlatform + " in
97
+ // package:" + this.mPackageName);
98
+ return null ;
99
+ }
100
+ boards = platform .getBoards ();
106
101
if (boards == null ) {
107
102
// fail("No boards found");
108
103
return null ;
@@ -161,8 +156,8 @@ public static void setBoardsPackageURL(String[] newBoardJsonUrls) {
161
156
Manager .setBoardsPackageURL (newBoardJsonUrls );
162
157
}
163
158
164
- public static String getBoardsPackageURLs () {
165
- return Manager .getBoardsPackageURLs ();
159
+ public static String getDefaultBoardsPackageURLs () {
160
+ return Manager .getDefaultBoardsPackageURLs ();
166
161
}
167
162
168
163
public static boolean isReady () {
@@ -694,7 +689,7 @@ public static String getPrivateHardwarePathsString() {
694
689
*
695
690
* @return
696
691
*/
697
- public static Set <String > getAllManuNames () {
692
+ public static Set <String > getAllMenuNames () {
698
693
Set <String > ret = new TreeSet <>(String .CASE_INSENSITIVE_ORDER );
699
694
String [] boardFiles = getAllBoardsFiles ();
700
695
for (String curBoardFile : boardFiles ) {
@@ -714,4 +709,12 @@ public static TreeMap<String, String> getAllmenus() {
714
709
return ret ;
715
710
}
716
711
712
+ /**
713
+ * Remove all packages that have a more recent version
714
+ */
715
+ public static void onlyKeepLatestPlatforms () {
716
+ Manager .onlyKeepLatestPlatforms ();
717
+
718
+ }
719
+
717
720
}
0 commit comments