org.eclipse.core.resources.ICommand Java Examples
The following examples show how to use
org.eclipse.core.resources.ICommand.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GamlUtils.java From gama with GNU General Public License v3.0 | 6 votes |
public static void removeBuilder(final IProject project, final String builderId) throws CoreException { final IProjectDescription description = project.getDescription(); final ICommand[] builderSpecs = description.getBuildSpec(); for (int i = 0; i < builderSpecs.length; ++i) { if (builderId.equals(builderSpecs[i].getBuilderName())) { // Remove the builder final 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; } } }
Example #2
Source File: JavaProject.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * 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; } } }
Example #3
Source File: AppEngineStandardFacetChangeListener.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * Add our {@code appengine-web.xml} builder that monitors for changes to the {@code <runtime>} * element. */ private static void addAppEngineWebBuilder(IProject project) { try { IProjectDescription projectDescription = project.getDescription(); ICommand[] commands = projectDescription.getBuildSpec(); for (int i = 0; i < commands.length; i++) { if (AppEngineWebBuilder.BUILDER_ID.equals(commands[i].getBuilderName())) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; // Add it after other builders. System.arraycopy(commands, 0, newCommands, 0, commands.length); // add builder to project ICommand command = projectDescription.newCommand(); command.setBuilderName(AppEngineWebBuilder.BUILDER_ID); newCommands[commands.length] = command; projectDescription.setBuildSpec(newCommands); project.setDescription(projectDescription, null); logger.finer(project + ": added AppEngineWebBuilder"); } catch (CoreException ex) { logger.log(Level.SEVERE, "Unable to add builder for " + project, ex); } }
Example #4
Source File: XtextProjectHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.4 */ public static boolean hasBuilder(IProject project) { Preconditions.checkNotNull(project); if (project.isAccessible()) { try { for (ICommand command : project.getDescription().getBuildSpec()) { if (BUILDER_ID.equals(command.getBuilderName())) { return true; } } } catch (CoreException e) { log.error("Can't build due to an exception.", e); } } return false; }
Example #5
Source File: ProblemMarkerNature.java From CogniCrypt with Eclipse Public License 2.0 | 6 votes |
@Override public void configure() throws CoreException { final IProjectDescription desc = this.project.getDescription(); final ICommand[] commands = desc.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(Constants.BUILDER_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(Constants.BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); this.project.setDescription(desc, null); }
Example #6
Source File: ClientTemplate.java From neoscada with Eclipse Public License 1.0 | 6 votes |
private void createFeatureProject ( final IProject project, final Map<String, String> properties, final IProgressMonitor monitor ) throws CoreException { monitor.beginTask ( "Creating feature project", 6 ); final String name = this.pluginId + ".feature"; //$NON-NLS-1$ final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( name ); final ICommand featureBuilder = desc.newCommand (); featureBuilder.setBuilderName ( "org.eclipse.pde.FeatureBuilder" ); //$NON-NLS-1$ desc.setNatureIds ( new String[] { "org.eclipse.pde.FeatureNature" } ); //$NON-NLS-1$ desc.setBuildSpec ( new ICommand[] { featureBuilder } ); final IProject newProject = project.getWorkspace ().getRoot ().getProject ( name ); newProject.create ( desc, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 newProject.open ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 addFilteredResource ( newProject, "pom.xml", getResource ( "feature-pom.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 addFilteredResource ( newProject, "feature.xml", getResource ( "feature/feature.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 addFilteredResource ( newProject, "feature.properties", getResource ( "feature/feature.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 addFilteredResource ( newProject, "build.properties", getResource ( "feature/build.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1 monitor.done (); }
Example #7
Source File: CreateProjectOperation.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected void createProject ( final IProgressMonitor monitor ) throws CoreException { monitor.beginTask ( "Create project", 2 ); final IProject project = this.info.getProject (); final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( project.getName () ); desc.setLocation ( this.info.getProjectLocation () ); desc.setNatureIds ( new String[] { Constants.PROJECT_NATURE_CONFIGURATION, PROJECT_NATURE_JS } ); final ICommand jsCmd = desc.newCommand (); jsCmd.setBuilderName ( BUILDER_JS_VALIDATOR ); final ICommand localBuilder = desc.newCommand (); localBuilder.setBuilderName ( Constants.PROJECT_BUILDER ); desc.setBuildSpec ( new ICommand[] { jsCmd, localBuilder } ); if ( !project.exists () ) { project.create ( desc, new SubProgressMonitor ( monitor, 1 ) ); project.open ( new SubProgressMonitor ( monitor, 1 ) ); } monitor.done (); }
Example #8
Source File: RadlCreatorTest.java From RADL with Apache License 2.0 | 6 votes |
@Before public void init() throws CoreException { IProjectDescription description = mock(IProjectDescription.class); when(description.getBuildSpec()).thenReturn(new ICommand[0]); when(description.newCommand()).thenReturn(mock(ICommand.class)); when(description.getNatureIds()).thenReturn(natureIds.toArray(new String[natureIds.size()])); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocation) throws Throwable { natureIds.clear(); natureIds.addAll(Arrays.asList((String[])invocation.getArguments()[0])); return null; } }).when(description).setNatureIds(any(String[].class)); when(project.getDescription()).thenReturn(description); when(folder.getProject()).thenReturn(project); when(folder.exists()).thenReturn(true); when(folder.getFile(anyString())).thenReturn(file); when(root.getFolder(new Path(folderName))).thenReturn(folder); }
Example #9
Source File: Nature.java From cppcheclipse with Apache License 2.0 | 6 votes |
public void configure() throws CoreException { // add builder to list of proect builders IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(Builder.BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(Builder.BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); }
Example #10
Source File: RemoveDotnetBuilder.java From aCute with Eclipse Public License 2.0 | 6 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IProject project = AddDotnetBuilder.getProject(event); if (project != null) { try { final IProjectDescription description = project.getDescription(); final List<ICommand> commands = new ArrayList<>(); commands.addAll(Arrays.asList(description.getBuildSpec())); for (final ICommand buildSpec : description.getBuildSpec()) { if (IncrementalDotnetBuilder.BUILDER_ID.equals(buildSpec.getBuilderName())) { commands.remove(buildSpec); } } description.setBuildSpec(commands.toArray(new ICommand[commands.size()])); project.setDescription(description, null); } catch (final CoreException e) { } } return null; }
Example #11
Source File: CheckstyleNature.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Checks if the ordering of the builders of the given project is correct, more specifically if * the CheckstyleBuilder is set to run after the JavaBuilder. * * @param project * the project to check * @return <code>true</code> if the builder order for this project is correct, <code>false</code> * otherwise * @throws CoreException * error getting project description */ public static boolean hasCorrectBuilderOrder(IProject project) throws CoreException { IProjectDescription description = project.getDescription(); ICommand[] commands = description.getBuildSpec(); int javaBuilderIndex = -1; int checkstyleBuilderIndex = -1; for (int i = 0; i < commands.length; i++) { if (commands[i].getBuilderName().equals(CheckstyleBuilder.BUILDER_ID)) { checkstyleBuilderIndex = i; } else if (commands[i].getBuilderName().equals(JavaCore.BUILDER_ID)) { javaBuilderIndex = i; } } return javaBuilderIndex < checkstyleBuilderIndex; }
Example #12
Source File: SCTNature.java From statecharts with Eclipse Public License 1.0 | 6 votes |
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(SCTBuilder.BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(SCTBuilder.BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); }
Example #13
Source File: Nature.java From cppcheclipse with Apache License 2.0 | 6 votes |
public void deconfigure() throws CoreException { // remove builder from the list of builders IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(Builder.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); project.setDescription(description, null); return; } } }
Example #14
Source File: JReFrameworker.java From JReFrameworker with MIT License | 6 votes |
private static IJavaProject createProject(String projectName, IPath projectPath, IProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription projectDescription = project.getWorkspace().newProjectDescription(project.getName()); URI location = getProjectLocation(projectName, projectPath); projectDescription.setLocationURI(location); // make this a JReFrameworker project projectDescription.setNatureIds(new String[] { JReFrameworkerNature.NATURE_ID, JavaCore.NATURE_ID }); // build first with Java compiler then JReFramewoker bytecode operations BuildCommand javaBuildCommand = new BuildCommand(); javaBuildCommand.setBuilderName(JavaCore.BUILDER_ID); BuildCommand jrefBuildCommand = new BuildCommand(); jrefBuildCommand.setBuilderName(JReFrameworkerBuilder.BUILDER_ID); projectDescription.setBuildSpec(new ICommand[]{ javaBuildCommand, jrefBuildCommand}); // create and open the Eclipse project project.create(projectDescription, null); IJavaProject jProject = JavaCore.create(project); project.open(new NullProgressMonitor()); return jProject; }
Example #15
Source File: IResourcesSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
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; } } }
Example #16
Source File: TLANature.java From tlaplus with MIT License | 6 votes |
/** * remove TLA nature */ public void deconfigure() throws CoreException { IProjectDescription description = getProject().getDescription(); ICommand[] commands = description.getBuildSpec(); for (int i = 0; i < commands.length; ++i) { String builderName = commands[i].getBuilderName(); if (builderName.equals(TLAParsingBuilder.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); } } Activator.getDefault().logDebug("Nature removed"); }
Example #17
Source File: XtextNature.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@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(XtextBuilder.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); project.setDescription(description, null); project.deleteMarkers(MarkerTypes.ANY_VALIDATION, true, IResource.DEPTH_INFINITE); return; } } }
Example #18
Source File: BuildManagerAccess.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Obtain the configured Xtext builder for the given project, if any. */ public static XtextBuilder findBuilder(IProject project) { try { if (project.isAccessible()) { Project casted = (Project) project; IBuildConfiguration activeBuildConfig = casted.getActiveBuildConfig(); for (ICommand command : casted.internalGetDescription().getBuildSpec(false)) { if (XtextBuilder.BUILDER_ID.equals(command.getBuilderName())) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); if (workspace instanceof Workspace) { BuildManager buildManager = ((Workspace) workspace).getBuildManager(); XtextBuilder result = (XtextBuilder) getBuilder.invoke(buildManager, activeBuildConfig, command, -1, new MultiStatus(Activator.PLUGIN_ID, 0, null, null)); return result; } } } } return null; } catch (IllegalAccessException | InvocationTargetException | CoreException e) { throw new RuntimeException(e); } }
Example #19
Source File: IResourcesSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
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; } } }
Example #20
Source File: FindBugsNature.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Update the FindBugs command in the build spec (replace existing one if * present, add one first if none). */ private void setFindBugsCommand(IProjectDescription description, ICommand newCommand) throws CoreException { ICommand[] oldCommands = description.getBuildSpec(); ICommand oldFindBugsCommand = getFindBugsCommand(description); ICommand[] newCommands; if (oldFindBugsCommand == null) { // Add the FindBugs build spec AFTER all other builders newCommands = new ICommand[oldCommands.length + 1]; System.arraycopy(oldCommands, 0, newCommands, 0, oldCommands.length); newCommands[oldCommands.length] = newCommand; } else { for (int i = 0, max = oldCommands.length; i < max; i++) { if (oldCommands[i] == oldFindBugsCommand) { oldCommands[i] = newCommand; break; } } newCommands = oldCommands; } // Commit the spec change into the project description.setBuildSpec(newCommands); getProject().setDescription(description, null); }
Example #21
Source File: BuilderUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Removes a builder with the specified ID from the project if the project has * said builder. * * @param project project to remove the builder from * @param builderId id of the builder to remove * @throws CoreException */ public static void removeBuilderFromProject(IProject project, String builderId) throws CoreException { IProjectDescription description = project.getDescription(); List<ICommand> builders = new ArrayList<ICommand>( Arrays.asList(description.getBuildSpec())); Iterator<ICommand> iter = builders.iterator(); while (iter.hasNext()) { ICommand curBuilder = iter.next(); if (curBuilder.getBuilderName().equals(builderId)) { iter.remove(); } } description.setBuildSpec(builders.toArray(new ICommand[builders.size()])); project.setDescription(description, null); }
Example #22
Source File: RemoveBuilder.java From uml2solidity with Eclipse Public License 1.0 | 6 votes |
@Override public Object execute(final ExecutionEvent event) throws ExecutionException { final IProject project = AddBuilder.getProject(event); if (project != null) { try { final IProjectDescription description = project.getDescription(); final List<ICommand> commands = new ArrayList<ICommand>(); commands.addAll(Arrays.asList(description.getBuildSpec())); for (final ICommand buildSpec : description.getBuildSpec()) { if (SolidityBuilder.BUILDER_ID.equals(buildSpec.getBuilderName())) { // remove builder commands.remove(buildSpec); } } description.setBuildSpec(commands.toArray(new ICommand[commands.size()])); project.setDescription(description, null); } catch (final CoreException e) { Activator.logError("Error removing solc builder.", e); } } return null; }
Example #23
Source File: TexlipseNature.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * Add a builder to the project. * * @param id id of the builder to add * @throws CoreException */ private void addBuilder(String id) throws CoreException { IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); if (!hasBuilder(commands, id)) { ICommand command = desc.newCommand(); command.setBuilderName(id); ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 1, commands.length); newCommands[0] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); } }
Example #24
Source File: TexlipseNature.java From texlipse with Eclipse Public License 1.0 | 6 votes |
/** * Remove builder from the project. * * @param id id of the builder to remove * @throws CoreException */ private void removeBuilder(String id) throws CoreException { IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); if (hasBuilder(commands, id)) { ICommand[] newCommands = new ICommand[commands.length - 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length-1); desc.setBuildSpec(newCommands); project.setDescription(desc, null); } }
Example #25
Source File: JReFrameworkerProject.java From JReFrameworker with MIT License | 6 votes |
public void enableJavaBuilder() throws CoreException { IProjectDescription desc = project.getDescription(); ICommand[] commands = desc.getBuildSpec(); // if the command already exists, don't add it again for (int i = 0; i < commands.length; ++i) { if (commands[i].getBuilderName().equals(JavaCore.BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(JavaCore.BUILDER_ID); newCommands[newCommands.length - 1] = command; if(!command1PreceedsCommand2(JavaCore.BUILDER_ID, JReFrameworkerBuilder.BUILDER_ID, newCommands)){ swapBuildCommands(JavaCore.BUILDER_ID, JReFrameworkerBuilder.BUILDER_ID, newCommands); } desc.setBuildSpec(newCommands); project.setDescription(desc, null); }
Example #26
Source File: HybrisNature.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
@Override 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(StandardTsvBuilder.BUILDER_ID)) { return; } } ICommand[] newCommands = new ICommand[commands.length + 1]; System.arraycopy(commands, 0, newCommands, 0, commands.length); ICommand command = desc.newCommand(); command.setBuilderName(StandardTsvBuilder.BUILDER_ID); newCommands[newCommands.length - 1] = command; desc.setBuildSpec(newCommands); project.setDescription(desc, null); }
Example #27
Source File: HybrisNature.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
@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(StandardTsvBuilder.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); project.setDescription(description, null); return; } } }
Example #28
Source File: BuilderUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * Adds a builder with the specified ID to the project if the project does not * already have the builder. * * @param project project to add the builder to * @param builderId id of the builder to add * @throws CoreException */ public static void addBuilderToProject(IProject project, String builderId) throws CoreException { if (hasBuilder(project, builderId)) { return; } IProjectDescription description = project.getDescription(); List<ICommand> builders = new ArrayList<ICommand>( Arrays.asList(description.getBuildSpec())); ICommand newBuilder = description.newCommand(); newBuilder.setBuilderName(builderId); builders.add(newBuilder); description.setBuildSpec(builders.toArray(new ICommand[builders.size()])); project.setDescription(description, null); }
Example #29
Source File: JReFrameworkerProject.java From JReFrameworker with MIT License | 6 votes |
private boolean command1PreceedsCommand2(String command1, String command2, ICommand[] commands) { int command1Position = -1; int command2Position = -1; for (int i = 0; i < commands.length; ++i) { if(commands[i].getBuilderName().equals(command1)){ command1Position = i; } if(commands[i].getBuilderName().equals(command2)){ command2Position = i; } } if(command1Position != -1 && command2Position != -1 && command1Position != command2Position){ if(command1Position < command2Position){ return true; } else { return false; } } else { return false; } }
Example #30
Source File: FindBugsNature.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Removes the given builder from the build spec for the given project. */ protected void removeFromBuildSpec(String builderID) throws CoreException { MarkerUtil.removeMarkers(getProject()); 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; } } }