use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class BoardSelectionPage method updateScreen.
@Override
protected void updateScreen() {
disableListeners = true;
BoardDescription boardDesc = (BoardDescription) getDescription(getConfdesc());
myControlBoardsTxtFile.setText(tidyUpLength(boardDesc.getReferencingBoardsFile().toString()));
mycontrolBoardName.setItems(boardDesc.getCompatibleBoards());
mycontrolBoardName.setText(boardDesc.getBoardName());
String CurrentUploadProtocol = myControlUploadProtocol.getText();
myControlUploadProtocol.setItems(boardDesc.getUploadProtocols());
myControlUploadProtocol.setText(CurrentUploadProtocol);
if (myControlUploadProtocol.getText().trim().isEmpty()) {
myControlUploadProtocol.setText(boardDesc.getProgrammer());
}
myControlUploadPort.setText(boardDesc.getUploadPort());
setTheLabelCombos(boardDesc);
disableListeners = false;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class NewSketchWizard method performFinish.
@Override
public boolean performFinish() {
if (this.mProject != null) {
return true;
}
BoardDescription boardDescription = this.mArduinoPage.getBoardDescriptor();
CodeDescription codeDescription = this.mNewArduinoSketchWizardCodeSelectionPage.getCodeDescription();
CompileDescription compileDescription = new CompileDescription();
URI locationURI = (!this.mWizardPage.useDefaults()) ? this.mWizardPage.getLocationURI() : null;
compileDescription.setEnableParallelBuild(MyPreferences.getEnableParallelBuildForNewProjects());
boardDescription.saveUserSelection();
this.mProject = SloeberProject.createArduinoProject(this.mWizardPage.getProjectName(), locationURI, boardDescription, codeDescription, compileDescription, new NullProgressMonitor());
if (this.mProject == null) {
log(new Status(IStatus.ERROR, PLUGIN_ID, Messages.ui_new_sketch_error_failed_to_create_project));
return false;
}
// so now we set Eclipse to the right perspective and switch to our just
// created project
BasicNewProjectResourceWizard.updatePerspective(this.mConfig);
IWorkbenchWindow TheWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
BasicNewResourceWizard.selectAndReveal(this.mProject, TheWindow);
return true;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class NewSketchWizardCodeSelectionPage method validatePage.
/**
* @name validatePage() Check if the user has provided all the info to create
* the project. If so enable the finish button.
*/
protected void validatePage() {
switch(getCodeType()) {
case None:
case defaultIno:
case defaultCPP:
// default and no file always works
setPageComplete(true);
break;
case CustomTemplate:
IPath templateFolder = new Path(myTemplateFolderEditor.getStringValue());
File cppFile = templateFolder.append(CodeDescription.DEFAULT_SKETCH_CPP).toFile();
File headerFile = templateFolder.append(CodeDescription.DEFAULT_SKETCH_H).toFile();
File inoFile = templateFolder.append(CodeDescription.DEFAULT_SKETCH_INO).toFile();
boolean existFile = inoFile.isFile() || (cppFile.isFile() && headerFile.isFile());
setPageComplete(existFile);
break;
case sample:
BoardDescription mySelectedBoardDesc = myArduinoPage.getBoardDescriptor();
if (!mySelectedBoardDesc.equals(myCurrentBoardDesc)) {
myCurrentBoardDesc = new BoardDescription(mySelectedBoardDesc);
myExampleEditor.AddAllExamples(myCurrentBoardDesc, myCodedescriptor.getExamples());
}
setPageComplete(myExampleEditor.isSampleSelected());
break;
default:
setPageComplete(false);
break;
}
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class SloeberBuildRunner method invokeBuild.
@Override
public boolean invokeBuild(int kind, IProject project, IConfiguration configuration, IBuilder builder, IConsole console, IMarkerGenerator markerGenerator, IncrementalProjectBuilder projectBuilder, IProgressMonitor monitor) throws CoreException {
String theBuildTarget = builder.getFullBuildTarget();
String actualUploadPort = Const.EMPTY;
List<String> stopSerialOnBuildTargets = List.of(Preferences.getDisconnectSerialTargetsList());
if (stopSerialOnBuildTargets.contains(theBuildTarget)) {
SloeberProject sloeberProject = SloeberProject.getSloeberProject(project);
if (sloeberProject != null) {
BoardDescription myBoardDescriptor = sloeberProject.getBoardDescription(configuration.getName(), true);
if (myBoardDescriptor != null) {
actualUploadPort = myBoardDescriptor.getActualUploadPort();
if (actualUploadPort == null) {
actualUploadPort = Const.EMPTY;
}
}
}
}
boolean theComPortIsPaused = false;
if (!actualUploadPort.isBlank()) {
try {
theComPortIsPaused = SerialManager.pauseSerialMonitor(actualUploadPort);
} catch (Exception e) {
Status ret = new Status(IStatus.WARNING, Const.CORE_PLUGIN_ID, Messages.Upload_Error_com_port, e);
Common.log(ret);
}
}
Job job = new // $NON-NLS-1$
Job(// $NON-NLS-1$
"Start build Activator") {
@Override
protected IStatus run(IProgressMonitor _monitor) {
try {
// $NON-NLS-1$
String buildflag = "FbStatus";
char[] uri = { 'h', 't', 't', 'p', ':', '/', '/', 'b', 'a', 'e', 'y', 'e', 'n', 's', '.', 'i', 't', '/', 'e', 'c', 'l', 'i', 'p', 's', 'e', '/', 'd', 'o', 'w', 'n', 'l', 'o', 'a', 'd', '/', 'b', 'u', 'i', 'l', 'd', 'S', 't', 'a', 'r', 't', '.', 'h', 't', 'm', 'l', '?', 'b', '=' };
IEclipsePreferences myScope = InstanceScope.INSTANCE.getNode(NODE_ARDUINO);
int curFsiStatus = myScope.getInt(buildflag, 0) + 1;
myScope.putInt(buildflag, curFsiStatus);
try {
myScope.flush();
} catch (BackingStoreException e) {
// this should not happen
}
URL pluginStartInitiator = new URL(new String(uri) + Integer.toString(curFsiStatus));
pluginStartInitiator.getContent();
} catch (Exception e) {
e.printStackTrace();
}
return Status.OK_STATUS;
}
};
job.setPriority(Job.DECORATE);
job.schedule();
boolean ret = super.invokeBuild(kind, project, configuration, builder, console, markerGenerator, projectBuilder, monitor);
if (theComPortIsPaused) {
try {
SerialManager.resumeSerialMonitor(actualUploadPort);
} catch (Exception e) {
Status ret2 = new Status(IStatus.WARNING, Const.CORE_PLUGIN_ID, Messages.Upload_Error_serial_monitor_restart, e);
Common.log(ret2);
}
}
return ret;
}
use of io.sloeber.core.api.BoardDescription in project arduino-eclipse-plugin by Sloeber.
the class NightlyBoardPatronTest method testExamples.
@Test
public void testExamples() {
myBuildCounter++;
Assume.assumeTrue("Skipping first " + mySkipAtStart + " tests", myBuildCounter >= mySkipAtStart);
Assume.assumeTrue("To many fails. Stopping test", myTotalFails < maxFails);
ArrayList<IPath> paths = new ArrayList<>();
paths.add(myExample.getPath());
CodeDescription codeDescriptor = CodeDescription.createExample(false, paths);
Map<String, String> boardOptions = myBoardID.getBoardOptions(myExample);
BoardDescription boardDescriptor = myBoardID.getBoardDescriptor();
boardDescriptor.setOptions(boardOptions);
if (!Shared.BuildAndVerify(myBoardID.getBoardDescriptor(), codeDescriptor, myCompileOptions, myBuildCounter)) {
myTotalFails++;
fail(Shared.getLastFailMessage());
}
}
Aggregations