Java 类org.eclipse.core.resources.ICommand 实例源码

项目:n4js    文件:ExternalProject.java   
@Override
public ResourceInfo getResourceInfo(boolean phantom, boolean mutable) {
    ProjectDescription description = new ProjectDescription();
    description.setName(getName());
    description.setNatureIds(from(natureIds).toArray(String.class));
    ICommand[] buildSpecs = new ICommand[builderIds.size()];
    int i = 0;
    for (String builderId : builderIds) {
        ICommand command = description.newCommand();
        command.setBuilderName(builderId);
        buildSpecs[i++] = command;
    }
    description.setBuildSpec(buildSpecs);

    ProjectInfo info = new ProjectInfo();
    info.setModificationStamp(file.lastModified());
    info.setDescription(description);

    return info;
}
项目:EclipseMinifyBuilder    文件:MinifyNature.java   
@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(MinifyBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(MinifyBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:EclipseMinifyBuilder    文件:MinifyNature.java   
@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(MinifyBuilder.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;
        }
    }
}
项目:gemoc-studio-modeldebugging    文件:GemocSequentialLanguageNature.java   
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(GemocSequentialLanguageBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(GemocSequentialLanguageBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:neoscada    文件:CreateProjectOperation.java   
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 ();
}
项目:neoscada    文件:ClientTemplate.java   
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 ();
}
项目:Equella    文件:JPFManifestBuilder.java   
public static void removeBuilderFromProject(IProjectDescription description)
{
    // Look for builder.
    int index = -1;
    ICommand[] cmds = description.getBuildSpec();
    for( int j = 0; j < cmds.length; j++ )
    {
        if( cmds[j].getBuilderName().equals(BUILDER_ID) )
        {
            index = j;
            break;
        }
    }
    if( index == -1 )
        return;

    // Remove builder from project.
    List<ICommand> newCmds = new ArrayList<ICommand>();
    newCmds.addAll(Arrays.asList(cmds));
    newCmds.remove(index);
    description.setBuildSpec(newCmds.toArray(new ICommand[newCmds.size()]));
}
项目:gw4e.project    文件:ClasspathManager.java   
/**
 * Set the GW4E builder
 * 
 * @param project
 * @param monitor
 * @throws CoreException
 */
public static void setBuilder(IProject project, IProgressMonitor monitor) throws CoreException {
    IProjectDescription desc = project.getDescription();
    ICommand[] commands = desc.getBuildSpec();

    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(GW4EBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:gw4e.project    文件:ClasspathManager.java   
/**
 * Remove the GW4E builder
 * 
 * @param project
 * @param monitor
 * @throws CoreException
 */
public static void unsetBuilder(IProject project, IProgressMonitor monitor) throws CoreException {
    IProjectDescription description = project.getDescription();
    ICommand[] commands = description.getBuildSpec();
    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(GW4EBuilder.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);
            GW4EBuilder.removeProjectProblemMarker(project, monitor);
            return;
        }
    }
}
项目:gw4e.project    文件:ClasspathManagerTest.java   
@Test
public void testUnsetBuilder() throws Exception {
    IJavaProject p = ProjectHelper.getProject(PROJECT_NAME);
    ClasspathManager.setBuilder(p.getProject(), null);
    IProjectDescription desc = p.getProject().getDescription();
    ICommand[] commands = desc.getBuildSpec();
    boolean found = false;
    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
            found=true;
        }
    }
    assertTrue(found);
    ClasspathManager.unsetBuilder(p.getProject(), null);
    desc = p.getProject().getDescription();
    commands = desc.getBuildSpec();
    found = false;
    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
            found=true;
        }
    }
    assertFalse(found);
}
项目:pgcodekeeper    文件:AddBuilder.java   
public static void addBuilder(final IProject project) {
    try {
        // verify already registered builders
        if (hasBuilder(project)) {
            // already enabled
            return;
        }
        // add builder to project properties
        IProjectDescription description = project.getDescription();
        final ICommand buildCommand = description.newCommand();
        buildCommand.setBuilderName(BUILDER.ID);

        final List<ICommand> commands = new ArrayList<ICommand>();
        commands.addAll(Arrays.asList(description.getBuildSpec()));
        commands.add(buildCommand);

        description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
        project.setDescription(description, null);
    } catch (final CoreException e) {
        Log.log(Log.LOG_ERROR, "Cannot add builder", e); //$NON-NLS-1$
    }
}
项目:pgcodekeeper    文件:RemoveBuilder.java   
public static void removeBuilder(final IProject project) {
    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 (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) {
        Log.log(Log.LOG_ERROR, "Cannot remove builder", e); //$NON-NLS-1$
    }
}
项目:gemoc-studio    文件:AbstractProjectNature.java   
protected void addBuilder(String builderId) throws CoreException 
{
    IProjectDescription desc = _project.getDescription();
    ICommand[] commands = desc.getBuildSpec();

    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(builderId)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(builderId);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    _project.setDescription(desc, null);
}
项目:gemoc-studio    文件:AbstractProjectNature.java   
protected void removeBuilder(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);
            _project.setDescription(description, null);         
            return;
        }
    }
}
项目:visuflow-plugin    文件:VisuFlowNature.java   
@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(JimpleBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(JimpleBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:visuflow-plugin    文件:VisuFlowNature.java   
@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(JimpleBuilder.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;
        }
    }
}
项目:ClassCleaner    文件:ClassCleanerNature.java   
@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(ClassCleanerBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(ClassCleanerBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:ClassCleaner    文件:ClassCleanerNature.java   
@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(ClassCleanerBuilder.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;
        }
    }
}
项目:jason-eclipse-plugin    文件:JasonNature.java   
@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(JasonBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 1, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(JasonBuilder.BUILDER_ID);
    newCommands[0] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:jason-eclipse-plugin    文件:JasonNature.java   
@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(JasonBuilder.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;
        }
    }
}
项目:egradle    文件:VirtualRootProjectNature.java   
@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(VirtualRootNewFilesToRealRootProjectBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(VirtualRootNewFilesToRealRootProjectBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:egradle    文件:VirtualRootProjectNature.java   
@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(VirtualRootNewFilesToRealRootProjectBuilder.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;
        }
    }
}
项目:DarwinSPL    文件:HyexpressionNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:HymanifestNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:HymappingNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:HyconstraintsNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:HyvalidityformulaNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:HydatavalueNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:DarwinSPL    文件:DwprofileNature.java   
public void deconfigure() throws CoreException {
    IProjectDescription description = getProject().getDescription();
    ICommand[] commands = description.getBuildSpec();
    ICommand[] newCommands = commands;
    for (int j = 0; j < BUILDER_IDS.length; j++) {
        for (int i = 0; i < newCommands.length; ++i) {
            if (newCommands[i].getBuilderName().equals(BUILDER_IDS[j])) {
                ICommand[] tempCommands = new ICommand[newCommands.length - 1];
                System.arraycopy(newCommands, 0, tempCommands, 0, i);
                System.arraycopy(newCommands, i + 1, tempCommands, i, newCommands.length - i - 1);
                newCommands = tempCommands;
                break;
            }
        }
    }
    if (newCommands != commands) {
        description.setBuildSpec(newCommands);
    }
}
项目:google-cloud-eclipse    文件:AppEngineStandardFacetChangeListener.java   
/**
 * Add our {@code appengine-web.xml} builder that monitors for changes to the {@code <runtime>}
 * element.
 */
private 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);
  }
}
项目:google-cloud-eclipse    文件:AppEngineStandardFacetChangeListener.java   
/**
 * Remove our {@code appengine-web.xml} builder that monitors for changes to the {@code <runtime>}
 * element.
 */
private void removeAppEngineWebBuilder(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())) {
        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);
        projectDescription.setBuildSpec(newCommands);
        project.setDescription(projectDescription, null);
        logger.finer(project + ": removed AppEngineWebBuilder");
        return;
      }
    }
  } catch (CoreException ex) {
    logger.log(Level.SEVERE, "Unable to remove builder for " + project, ex);
  }

}
项目:cheetah    文件:RemoveBuilder.java   
public static void removeBuilder(IProject project) {
    try {
        // Remove builder
        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 (Config.BUILDER_ID.equals(buildSpec.getBuilderName())) {
                commands.remove(buildSpec);
            }
        }
        description.setBuildSpec(commands.toArray(new ICommand[commands.size()]));
        project.setDescription(description, null);
    } catch (final CoreException e) {
    }
}
项目:uml2solidity    文件:RemoveBuilder.java   
@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;
}
项目:texlipse    文件:TexlipseNature.java   
/**
 * 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);
    }
}
项目:texlipse    文件:TexlipseNature.java   
/**
 * 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);
    }
}
项目:andmore2    文件:AndroidNature.java   
@Override
public void configure() throws CoreException {
    // Setup the builder
    IProjectDescription desc = project.getDescription();
    ICommand[] builders = desc.getBuildSpec();
    ICommand[] newBuilders = new ICommand[builders.length + 1];
    System.arraycopy(builders, 0, newBuilders, 0, builders.length);

    ICommand androidBuilder = desc.newCommand();
    androidBuilder.setBuilderName(AndroidBuilder.ID);
    // We don't autobuild.
    androidBuilder.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
    newBuilders[builders.length] = androidBuilder;
    desc.setBuildSpec(newBuilders);

    project.setDescription(desc, 0, new NullProgressMonitor());
}
项目:hybris-commerce-eclipse-plugin    文件:HybrisNature.java   
@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);
}
项目:hybris-commerce-eclipse-plugin    文件:HybrisNature.java   
@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;
        }
    }
}
项目:abaplint-eclipse    文件:AbaplintNature.java   
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(AbaplintBuilder.BUILDER_ID)) {
            return;
        }
    }

    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(AbaplintBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
项目:Sparrow    文件:OutcodeNature.java   
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(ModelExtractorBuilder.BUILDER_ID)) {
            return;
        }
    }
    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(ModelExtractorBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}