use of io.sloeber.core.api.Json.ArduinoPlatform in project arduino-eclipse-plugin by Sloeber.
the class BoardDescription method getArduinoPlatformPath.
/*
* get the latest installed arduino platform with the same architecture. This is
* the platform to use the programmers.txt if no other programmers.txt are
* found.
*/
public IPath getArduinoPlatformPath() {
updateWhenDirty();
ArduinoPlatform platform = BoardsManager.getPlatform(VendorArduino, getArchitecture());
if (platform == null) {
return null;
}
ArduinoPlatformVersion platformVersion = platform.getNewestInstalled();
if (platformVersion == null) {
return null;
}
return platformVersion.getInstallPath();
}
use of io.sloeber.core.api.Json.ArduinoPlatform in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method startup_Pluging.
/**
* Loads all stuff needed and if this is the first time downloads the avr boards
* and needed tools
*
* @param monitor
*/
public static synchronized void startup_Pluging(IProgressMonitor monitor) {
loadJsons(ConfigurationPreferences.getUpdateJasonFilesFlag());
if (!LibraryManager.libsAreInstalled()) {
LibraryManager.InstallDefaultLibraries(monitor);
}
IPath examplesPath = ConfigurationPreferences.getInstallationPathExamples();
if (!examplesPath.toFile().exists()) {
// examples are not installed
// Download arduino IDE example programs
Common.log(PackageManager.downloadAndInstall(Defaults.EXAMPLES_URL, Defaults.EXAMPLE_PACKAGE, examplesPath, false, monitor));
}
if (!areThereInstalledBoards()) {
IStatus status = null;
// if successfully installed the examples: add the boards
ArduinoPlatform platform = getPlatform(Defaults.DEFAULT_INSTALL_MAINTAINER, Defaults.DEFAULT_INSTALL_ARCHITECTURE);
// we failed to find arduino avr platform. Take the fiorst one
if (platform == null) {
try {
platform = getPlatforms().get(0);
} catch (@SuppressWarnings("unused") Exception e) {
// no need to do anything
}
}
if (platform == null) {
status = new Status(IStatus.ERROR, Activator.getId(), Messages.No_Platform_available);
} else {
status = install(platform.getNewestVersion(), monitor);
}
if (!status.isOK()) {
StatusManager stMan = StatusManager.getManager();
stMan.handle(status, StatusManager.LOG | StatusManager.SHOW | StatusManager.BLOCK);
}
}
myIsReady = true;
}
use of io.sloeber.core.api.Json.ArduinoPlatform in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method getNewestBoardIDFromBoardsManager.
private static BoardDescription getNewestBoardIDFromBoardsManager(String jsonFileName, String packageName, String architectureName, String boardID, Map<String, String> options) {
ArduinoPackage thePackage = getPackage(jsonFileName, packageName);
if (thePackage == null) {
// fail("failed to find package:" + this.mPackageName);
return null;
}
ArduinoPlatform platform = thePackage.getPlatform(architectureName);
if (platform == null) {
// package:" + this.mPackageName);
return null;
}
ArduinoPlatformVersion platformVersion = platform.getNewestVersion();
java.io.File boardsFile = platformVersion.getBoardsFile();
BoardDescription boardid = new BoardDescription(boardsFile, boardID, options);
return boardid;
}
use of io.sloeber.core.api.Json.ArduinoPlatform in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method installLatestPlatform.
public static void installLatestPlatform(String JasonName, String packageName, String architectureName) {
if (!isReady()) {
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, BoardsManagerIsBussy, new Exception()));
return;
}
envVarsNeedUpdating = true;
ArduinoPackage curPackage = getPackage(JasonName, packageName);
if (curPackage != null) {
ArduinoPlatform curPlatform = curPackage.getPlatform(architectureName);
if (curPlatform != null) {
ArduinoPlatformVersion curPlatformVersion = curPlatform.getNewestVersion();
if (curPlatformVersion != null) {
NullProgressMonitor monitor = new NullProgressMonitor();
install(curPlatformVersion, monitor);
return;
}
}
}
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"failed to find " + JasonName + " " + packageName + " " + architectureName));
}
use of io.sloeber.core.api.Json.ArduinoPlatform in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method installsubsetOfLatestPlatforms.
/**
* installs a subset of the latest platforms It skips the first <fromIndex>
* platforms And stops at <toIndex> platforms. To install the 5 first latest
* platforms installsubsetOfLatestPlatforms(0,5)
*
* @param fromIndex
* the platforms at the start to skip
* @param toIndex
* the platforms after this platform are skipped
*/
public static void installsubsetOfLatestPlatforms(int fromIndex, int toIndex) {
if (!isReady()) {
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, BoardsManagerIsBussy, new Exception()));
return;
}
envVarsNeedUpdating = true;
int currPlatformIndex = 1;
NullProgressMonitor monitor = new NullProgressMonitor();
List<ArduinoPackage> allPackages = getPackages();
for (ArduinoPackage curPackage : allPackages) {
Collection<ArduinoPlatform> latestPlatforms = curPackage.getPlatforms();
for (ArduinoPlatform curPlatform : latestPlatforms) {
if (currPlatformIndex > fromIndex) {
install(curPlatform.getNewestVersion(), monitor);
}
if (currPlatformIndex++ > toIndex)
return;
}
}
}
Aggregations