private static void setCommands(IProjectDescription desc, List<ICommand> newCommands) { desc.setBuildSpec(newCommands.toArray(new ICommand[newCommands.size()])); }
private void setNewBuildCommands(IProject project, IProjectDescription description, List<ICommand> buildCommands, IProgressMonitor monitor) throws CoreException { description.setBuildSpec(buildCommands.toArray(new ICommand[buildCommands.size()])); project.setDescription(description, monitor); }
protected void setBuilder(final IProjectDescription projectDescription, final String[] builders) { List<ICommand> commands = Lists.newArrayList(); for (int i = 0; i < builders.length; i++) { ICommand command = projectDescription.newCommand(); command.setBuilderName(builders[i]); commands.add(command); } projectDescription.setBuildSpec(commands.toArray(new ICommand[commands.size()])); }
public void deconfigure() throws CoreException { // remove the WikiText validation builder IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); List<ICommand> newCommands = new ArrayList<ICommand>(commands.length); for (ICommand command : commands) { if (!command.getBuilderName().equals(ValidationProjectBuilder.ID)) { newCommands.add(command); } } if (newCommands.size() == commands.length - 1) { desc.setBuildSpec(newCommands.toArray(new ICommand[newCommands.size()])); project.setDescription(desc, null); } }
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(BndBuilder.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; } } }
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(BndBuilder.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; } } }
public static void removeBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] builderSpecs = description.getBuildSpec(); for (int i = 0; i < builderSpecs.length; ++i) { if (builderId.equals(builderSpecs[i].getBuilderName())) { // Remove the builder ICommand[] modifiedSpecs = new ICommand[builderSpecs.length - 1]; System.arraycopy(builderSpecs, 0, modifiedSpecs, 0, i); System.arraycopy(builderSpecs, i + 1, modifiedSpecs, i, builderSpecs.length - i - 1); description.setBuildSpec(modifiedSpecs); project.setDescription(description, null); return; } } }
/** * Removes the given builder from the build spec for the given project. */ protected void removeFromBuildSpec(String builderID) throws CoreException { IProjectDescription description = this.project.getDescription(); ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(builderID)) { 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); this.project.setDescription(description, null); return; } } }
protected void removeFromBuildSpec(String builderID) throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(builderID)) { 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; } } }
public static void removeBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] builderSpecs = description.getBuildSpec(); for (int i = 0; i < builderSpecs.length; ++i) { if (builderId.equals(builderSpecs[i].getBuilderName())) { // Remove the builder ICommand[] modifiedSpecs = new ICommand[builderSpecs.length - 1]; System.arraycopy(builderSpecs, 0, modifiedSpecs, 0, i); System.arraycopy(builderSpecs, i + 1, modifiedSpecs, i, builderSpecs.length - i - 1); description.setBuildSpec(modifiedSpecs); project.setDescription(description, null); return; } } }
protected void removeFromBuildSpec(String builderID) throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(builderID)) { 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); getProject().setDescription(description, null); return; } } }
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(XtextBuilder.BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 1, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(XtextBuilder.BUILDER_ID); newCommands[0] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); }
public static void update(IProject project, List<EclipseBuildCommand> buildCommands, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); Set<ICommand> current = ImmutableSet.copyOf(description.getBuildSpec()); Set<ICommand> model = toCommands(buildCommands, description); PersistentModel previousModel = persistentModel.getPrevious(); Set<ICommand> managed = previousModel.isPresent() ? Sets.newLinkedHashSet(previousModel.getManagedBuilders()) : Sets.<ICommand>newLinkedHashSet(); Result<ICommand> result = ManagedModelMergingStrategy.calculate(current, model, managed); description.setBuildSpec(result.getNextElements().toArray(new ICommand[0])); project.setDescription(description, monitor); persistentModel.managedBuilders(result.getNextManaged()); }
public static void addBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] specs = description.getBuildSpec(); ICommand command = description.newCommand(); command.setBuilderName(builderId); // Add the nature ICommand[] specsModified = new ICommand[specs.length + 1]; System.arraycopy(specs, 0, specsModified, 0, specs.length); specsModified[specs.length] = command; description.setBuildSpec(specsModified); project.setDescription(description, monitor()); }
public static void addBuilder(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] specs = description.getBuildSpec(); ICommand command = description.newCommand(); command.setBuilderName(builderId); // Add the nature ICommand[] specsModified = new ICommand[specs.length + 1]; System.arraycopy(specs, 0, specsModified, 0, specs.length); specsModified[specs.length] = command; description.setBuildSpec(specsModified); project.setDescription(description, monitor()); }
/** * Remove the old AspectJ Builder from the given project */ public static void removeOldBuilder(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] buildCommands = description.getBuildSpec(); if (contains(buildCommands, OLD_BUILDER)) { ICommand[] newBuildCommands = remove(buildCommands, OLD_BUILDER); description.setBuildSpec(newBuildCommands); project.setDescription(description, null); } }
public static void addMavenBuilder(IJavaProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand mavenCommand = description.newCommand(); mavenCommand.setBuilderName("org.eclipse.m2e.core.maven2Builder"); newCommands[commands.length] = mavenCommand; description.setBuildSpec(newCommands); project.getProject().setDescription(description, monitor); }
public static void addJavaBuilder(IJavaProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand javaCommand = description.newCommand(); javaCommand.setBuilderName("org.eclipse.jdt.core.javabuilder"); newCommands[commands.length] = javaCommand; description.setBuildSpec(newCommands); project.getProject().setDescription(description, monitor); }
public static void addBPMN2Builder(IJavaProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); ICommand[] newCommands = new ICommand[commands.length + 2]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand bpmn2BuilderCommand = description.newCommand(); bpmn2BuilderCommand.setBuilderName("org.eclipse.bpmn2.modeler.core.bpmn2Builder"); newCommands[commands.length] = bpmn2BuilderCommand; ICommand wstValidationCommand = description.newCommand(); wstValidationCommand.setBuilderName("org.eclipse.wst.validation.validationbuilder"); newCommands[commands.length+1] = wstValidationCommand; description.setBuildSpec(newCommands); project.getProject().setDescription(description, monitor); }
/** * Add the new AspectJ Builder to the given project */ public static void addNewBuilder(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] buildCommands = description.getBuildSpec(); if (!contains(buildCommands, AspectJPlugin.ID_BUILDER)) { ICommand command = description.newCommand(); command.setBuilderName(AspectJPlugin.ID_BUILDER); ICommand[] newBuildCommands = insert(buildCommands, command); description.setBuildSpec(newBuildCommands); project.setDescription(description, null); } }