public static void removeBuilders(IProject project, List builderids)
throws CoreException {
IProjectDescription desc = project.getDescription();
ICommand[] oldSpec = desc.getBuildSpec();
int oldLength = oldSpec.length;
if (oldLength == 0)
return;
int remaining = 0;
// null out all commands that match the builder to remove
for (int i = 0; i < oldSpec.length; i++) {
if (builderids.contains(oldSpec[i].getBuilderName()))
oldSpec[i] = null;
else
remaining++;
}
// check if any were actually removed
if (remaining == oldSpec.length)
return;
ICommand[] newSpec = new ICommand[remaining];
for (int i = 0, newIndex = 0; i < oldLength; i++) {
if (oldSpec[i] != null)
newSpec[newIndex++] = oldSpec[i];
}
desc.setBuildSpec(newSpec);
project.setDescription(desc, IResource.NONE, null);
}
移除Builders
最新推荐文章于 2018-07-07 17:14:00 发布