use of org.eclipse.cdt.core.settings.model.ICProjectDescription in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method rename_Configuration.
/**
* Does Sloeber still compile after a configuration renamen
*
* @throws Exception
*/
@Test
public void rename_Configuration() throws Exception {
BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
IProject theTestProject = null;
String projectName = "rename_Configuration";
CodeDescription codeDescriptor = CodeDescription.createDefaultIno();
NullProgressMonitor monitor = new NullProgressMonitor();
theTestProject = SloeberProject.createArduinoProject(projectName, null, unoBoardid, codeDescriptor, new CompileDescription(), new NullProgressMonitor());
// for the indexer
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project before config rename");
}
CCorePlugin cCorePlugin = CCorePlugin.getDefault();
ICProjectDescription prjCDesc = cCorePlugin.getProjectDescription(theTestProject);
ICConfigurationDescription activeConfig = prjCDesc.getActiveConfiguration();
activeConfig.setName("renamedConfig");
cCorePlugin.setProjectDescription(theTestProject, prjCDesc);
// for the indexer
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project after config rename");
}
}
use of org.eclipse.cdt.core.settings.model.ICProjectDescription in project arduino-eclipse-plugin by Sloeber.
the class Shared method hasBuildErrors.
public static boolean hasBuildErrors(IProject project) throws CoreException {
IMarker[] markers = project.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
return true;
}
}
CCorePlugin cCorePlugin = CCorePlugin.getDefault();
ICProjectDescription prjCDesc = cCorePlugin.getProjectDescription(project);
ICConfigurationDescription activeConfig = prjCDesc.getActiveConfiguration();
IPath resultPath = project.getLocation().append(activeConfig.getName());
String projName = project.getName();
String[] validOutputss = { projName + ".elf", projName + ".bin", projName + ".hex", projName + ".exe", "application.axf" };
for (String validOutput : validOutputss) {
File validFile = resultPath.append(validOutput).toFile();
if (validFile.exists()) {
return false;
}
}
return true;
}
use of org.eclipse.cdt.core.settings.model.ICProjectDescription in project arduino-eclipse-plugin by Sloeber.
the class Import_Libraries_Page method createSourceGroup.
@Override
protected void createSourceGroup(Composite parent) {
if (this.myProject == null)
return;
Composite composite = new Composite(parent, SWT.NONE);
GridLayout theGridLayout = new GridLayout();
theGridLayout.numColumns = 1;
composite.setLayout(theGridLayout);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
composite.setFont(parent.getFont());
GridData theGriddata;
this.myLibrarySelector = new Tree(composite, SWT.CHECK | SWT.BORDER);
theGriddata = new GridData(SWT.FILL, SWT.FILL, true, true);
theGriddata.horizontalSpan = 1;
this.myLibrarySelector.setLayoutData(theGriddata);
// find the items to add to the list
Map<String, IPath> allLibraries = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(myProject);
if (prjDesc != null) {
ICConfigurationDescription confDesc = prjDesc.getActiveConfiguration();
allLibraries = Sketch.getAllAvailableLibraries(confDesc);
}
// Get the data in the tree
Set<String> allLibrariesAlreadyUsed = Sketch.getAllImportedLibraries(this.myProject);
this.myLibrarySelector.setRedraw(false);
for (Entry<String, IPath> curlib : allLibraries.entrySet()) {
TreeItem child = new TreeItem(this.myLibrarySelector, SWT.NONE);
child.setText(curlib.getKey());
if (allLibrariesAlreadyUsed.contains(curlib.getKey()))
child.setChecked(true);
}
this.myLibrarySelector.setRedraw(true);
}
use of org.eclipse.cdt.core.settings.model.ICProjectDescription in project arduino-eclipse-plugin by Sloeber.
the class SloeberCpropertyTab method performOK.
@Override
protected void performOK() {
// Get the project description
ICConfigurationDescription confDesc = getConfdesc();
ICProjectDescription projDesc = confDesc.getProjectDescription();
// Copy local info to sloeber project and clean local info up
for (ICConfigurationDescription curConfDesc : projDesc.getConfigurations()) {
updateSloeber(curConfDesc);
clearSessionProperties(curConfDesc);
}
super.performOK();
}
use of org.eclipse.cdt.core.settings.model.ICProjectDescription in project linuxtools by eclipse.
the class CProjectHelper method addDefaultBinaryParser.
/**
* Add the default binary parser if no binary parser configured.
*
* @param project
* @throws CoreException
*/
private static boolean addDefaultBinaryParser(IProject project) throws CoreException {
ICConfigExtensionReference[] binaryParsers = CCorePlugin.getDefault().getDefaultBinaryParserExtensions(project);
if (binaryParsers == null || binaryParsers.length == 0) {
ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project);
if (desc == null) {
return false;
}
desc.getDefaultSettingConfiguration().create(CCorePlugin.BINARY_PARSER_UNIQ_ID, CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID);
CCorePlugin.getDefault().setProjectDescription(project, desc);
}
return true;
}
Aggregations