use of org.eclipse.core.resources.IBuildConfiguration in project che by eclipse.
the class Project method getDescription.
@Override
public IProjectDescription getDescription() throws CoreException {
return new IProjectDescription() {
@Override
public IBuildConfiguration[] getBuildConfigReferences(String s) {
return new IBuildConfiguration[0];
}
@Override
public ICommand[] getBuildSpec() {
return new ICommand[0];
}
@Override
public String getComment() {
return null;
}
@Override
public IProject[] getDynamicReferences() {
return new IProject[0];
}
@Override
public IPath getLocation() {
return null;
}
@Override
public URI getLocationURI() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public String[] getNatureIds() {
RegisteredProject project = workspace.getProjectRegistry().getProject(path.toString());
if (project == null) {
ResourcesPlugin.log(new Status(IStatus.ERROR, "resource", "Can't find project: " + path.toOSString()));
return new String[0];
}
Map<String, List<String>> attributes = project.getAttributes();
String language = "";
if (attributes.containsKey("language")) {
language = attributes.get("language").get(0);
}
return "java".equals(language) ? new String[] { "org.eclipse.jdt.core.javanature" } : new String[] { language };
}
@Override
public IProject[] getReferencedProjects() {
return new IProject[0];
}
@Override
public boolean hasNature(String s) {
String[] natureIds = getNatureIds();
for (String id : natureIds) {
if (s.equals(id)) {
return true;
}
}
return false;
}
@Override
public ICommand newCommand() {
return null;
}
@Override
public void setActiveBuildConfig(String s) {
}
@Override
public void setBuildConfigs(String[] strings) {
}
@Override
public void setBuildConfigReferences(String s, IBuildConfiguration[] iBuildConfigurations) {
}
@Override
public void setBuildSpec(ICommand[] iCommands) {
}
@Override
public void setComment(String s) {
}
@Override
public void setDynamicReferences(IProject[] iProjects) {
}
@Override
public void setLocation(IPath iPath) {
}
@Override
public void setLocationURI(URI uri) {
}
@Override
public void setName(String s) {
}
@Override
public void setNatureIds(String[] strings) {
}
@Override
public void setReferencedProjects(IProject[] iProjects) {
}
};
}
use of org.eclipse.core.resources.IBuildConfiguration in project n4js by eclipse.
the class RebuildWorkspaceProjectsScheduler method scheduleBuildIfNecessary.
/**
* Schedules a build with the given projects. Does nothing if the {@link Platform platform} is not running, or the
* iterable of projects is empty.
*
* @param toUpdate
* an iterable of projects to build.
*/
public void scheduleBuildIfNecessary(final Iterable<IProject> toUpdate) {
if (Platform.isRunning() && !Iterables.isEmpty(toUpdate)) {
final Workspace workspace = (Workspace) ResourcesPlugin.getWorkspace();
final IBuildConfiguration[] projectsToReBuild = from(asList(workspace.getBuildOrder())).filter(config -> Iterables.contains(toUpdate, config.getProject())).toArray(IBuildConfiguration.class);
if (!Arrays2.isEmpty(projectsToReBuild)) {
new RebuildWorkspaceProjectsJob(projectsToReBuild).schedule();
}
}
}
use of org.eclipse.core.resources.IBuildConfiguration in project ow by vtst.
the class ClosureBuilder method buildAll.
/**
* Force a build of all JavaScript projects in the workspace.
*/
public static void buildAll() {
// Get the list of projects having the Closure nature
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
final ArrayList<IBuildConfiguration> configs = new ArrayList<IBuildConfiguration>(projects.length);
for (IProject project : projects) {
try {
if (project.hasNature(ClosureNature.NATURE_ID)) {
configs.add(project.getActiveBuildConfig());
}
} catch (CoreException e) {
// This happens if the project is not open
}
}
// Build
Job buildAll = new Job(OwJsClosurePlugin.getDefault().getMessages().getString("build_all")) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
ResourcesPlugin.getWorkspace().build(configs.toArray(new IBuildConfiguration[0]), IncrementalProjectBuilder.FULL_BUILD, false, monitor);
return Status.OK_STATUS;
} catch (CoreException e) {
return e.getStatus();
}
}
};
buildAll.schedule();
}
use of org.eclipse.core.resources.IBuildConfiguration in project linuxtools by eclipse.
the class CProjectBuildHelpers method rebuildProject.
/**
* <h1>Trigger a re-build of the project.</h1>
*
* <p> Given a project, it finds the active configuration and rebuilds the project. </p>
*
* <p> This works with C/C++ Managed Builds as well as Autotools.</p>
*
* <p>Most useful for when you have added a flag to a project programmatically and want to rebuild
* the project so that the program is rebuild with that flag. The Rebuild triggers an update of the makefile
* automatically.</p>
*
* @param project to rebuild
*/
public static void rebuildProject(IProject project) {
// rebuild does not generate an analysis file (e.g gmon.out) But since -pg flag is added, profiling support is added to the binary.
try {
IBuildConfiguration buildConfiguration = project.getActiveBuildConfig();
// force a full rebuild which is usually needed for when you add profiling flags to the build options.
project.build(buildConfiguration, IncrementalProjectBuilder.FULL_BUILD, null);
} catch (CoreException e) {
// This is a very rare occurrence. Usually rebuilds don't fail if they worked the first time.
MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorRebuilding);
}
}
Aggregations