use of org.eclipse.core.resources.ICommand in project xtext-xtend by eclipse.
the class PerformanceTestProjectSetup method createJavaProject.
public static IJavaProject createJavaProject(final String projectName, String[] projectNatures) {
IProject project = null;
IJavaProject javaProject = null;
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
project = workspace.getRoot().getProject(projectName);
deleteProject(project);
javaProject = JavaCore.create(project);
IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(projectName);
project.create(projectDescription, null);
List<IClasspathEntry> classpathEntries = new ArrayList<IClasspathEntry>();
projectDescription.setNatureIds(projectNatures);
final ICommand java = projectDescription.newCommand();
java.setBuilderName(JavaCore.BUILDER_ID);
final ICommand manifest = projectDescription.newCommand();
manifest.setBuilderName("org.eclipse.pde.ManifestBuilder");
final ICommand schema = projectDescription.newCommand();
schema.setBuilderName("org.eclipse.pde.SchemaBuilder");
projectDescription.setBuildSpec(new ICommand[] { java, manifest, schema });
project.open(null);
project.setDescription(projectDescription, null);
classpathEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5")));
classpathEntries.add(JavaCore.newContainerEntry(new Path("org.eclipse.pde.core.requiredPlugins")));
javaProject.setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), null);
makeJava5Compliant(javaProject);
javaProject.setOutputLocation(new Path("/" + projectName + "/bin"), null);
createManifest(projectName, project);
// project.build(IncrementalProjectBuilder.FULL_BUILD, null);
refreshExternalArchives(javaProject);
refresh(javaProject);
} catch (final Exception exception) {
throw new RuntimeException(exception);
}
return javaProject;
}
use of org.eclipse.core.resources.ICommand in project linuxtools by eclipse.
the class RpmlintNature method deconfigure.
@Override
public void deconfigure() throws CoreException {
IProjectDescription description = getProject().getDescription();
ICommand[] commands = description.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
if (commands[i].getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) {
ICommand[] newCommands = new ICommand[commands.length - 1];
System.arraycopy(commands, 0, newCommands, 0, i);
System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
description.setBuildSpec(newCommands);
// Remove rpmlint marks on all specfiles into the project.
project.accept(new RpmlintMarkerRemoveVisitor());
return;
}
}
}
use of org.eclipse.core.resources.ICommand in project eclipse-pmd by acanda.
the class PMDNature method configure.
@Override
public void configure() throws CoreException {
final IProjectDescription desc = project.getDescription();
final ICommand[] commands = desc.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
if (commands[i].getBuilderName().equals(PMDBuilder.ID)) {
return;
}
}
final ICommand[] newCommands = new ICommand[commands.length + 1];
System.arraycopy(commands, 0, newCommands, 0, commands.length);
final ICommand command = desc.newCommand();
command.setBuilderName(PMDBuilder.ID);
newCommands[newCommands.length - 1] = command;
desc.setBuildSpec(newCommands);
project.setDescription(desc, null);
}
use of org.eclipse.core.resources.ICommand in project jop by jop-devel.
the class JOPNature method deconfigure.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.IProjectNature#deconfigure()
*/
public void deconfigure() throws CoreException {
IProjectDescription description = getProject().getDescription();
ICommand[] commands = description.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
if (commands[i].getBuilderName().equals(JOPizer.BUILDER_ID)) {
ICommand[] newCommands = new ICommand[commands.length - 1];
System.arraycopy(commands, 0, newCommands, 0, i);
System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
description.setBuildSpec(newCommands);
return;
}
}
}
use of org.eclipse.core.resources.ICommand in project jop by jop-devel.
the class JOPNature method configure.
/*
* (non-Javadoc)
*
* @see org.eclipse.core.resources.IProjectNature#configure()
*/
public void configure() throws CoreException {
IProjectDescription desc = project.getDescription();
ICommand[] commands = desc.getBuildSpec();
for (int i = 0; i < commands.length; ++i) {
if (commands[i].getBuilderName().equals(JOPizer.BUILDER_ID)) {
return;
}
}
ICommand[] newCommands = new ICommand[commands.length + 1];
System.arraycopy(commands, 0, newCommands, 0, commands.length);
ICommand command = desc.newCommand();
command.setBuilderName(JOPizer.BUILDER_ID);
newCommands[newCommands.length - 1] = command;
desc.setBuildSpec(newCommands);
project.setDescription(desc, null);
}
Aggregations