Search in sources :

Example 11 with ICommand

use of org.eclipse.core.resources.ICommand in project XobotOS by xamarin.

the class SharpenNature method newBuilderCommand.

private ICommand newBuilderCommand(IProjectDescription desc) {
    ICommand command = desc.newCommand();
    command.setBuilderName(SharpenBuilder.BUILDER_ID);
    return command;
}
Also used : ICommand(org.eclipse.core.resources.ICommand)

Example 12 with ICommand

use of org.eclipse.core.resources.ICommand in project XobotOS by xamarin.

the class SharpenNature 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(SharpenBuilder.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;
        }
    }
}
Also used : ICommand(org.eclipse.core.resources.ICommand) IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Example 13 with ICommand

use of org.eclipse.core.resources.ICommand in project XobotOS by xamarin.

the class SharpenNature method configure.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.resources.IProjectNature#configure()
	 */
public void configure() throws CoreException {
    IProjectDescription desc = _project.getDescription();
    ICommand[] commands = desc.getBuildSpec();
    if (containsBuilderCommand(commands))
        return;
    desc.setBuildSpec(append(commands, newBuilderCommand(desc)));
    _project.setDescription(desc, null);
}
Also used : ICommand(org.eclipse.core.resources.ICommand) IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Example 14 with ICommand

use of org.eclipse.core.resources.ICommand in project linuxtools by eclipse.

the class RpmlintNature method configure.

@Override
public void configure() throws CoreException {
    IProjectDescription desc = project.getDescription();
    ICommand[] commands = desc.getBuildSpec();
    for (ICommand command : commands) {
        if (command.getBuilderName().equals(RpmlintBuilder.BUILDER_ID)) {
            return;
        }
    }
    ICommand[] newCommands = new ICommand[commands.length + 1];
    System.arraycopy(commands, 0, newCommands, 0, commands.length);
    ICommand command = desc.newCommand();
    command.setBuilderName(RpmlintBuilder.BUILDER_ID);
    newCommands[newCommands.length - 1] = command;
    desc.setBuildSpec(newCommands);
    project.setDescription(desc, null);
}
Also used : ICommand(org.eclipse.core.resources.ICommand) IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Example 15 with ICommand

use of org.eclipse.core.resources.ICommand in project eclipse-pmd by acanda.

the class PMDNature method deconfigure.

@Override
public void deconfigure() throws CoreException {
    final IProjectDescription description = getProject().getDescription();
    final ICommand[] commands = description.getBuildSpec();
    for (int i = 0; i < commands.length; ++i) {
        if (commands[i].getBuilderName().equals(PMDBuilder.ID)) {
            final 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;
        }
    }
}
Also used : ICommand(org.eclipse.core.resources.ICommand) IProjectDescription(org.eclipse.core.resources.IProjectDescription)

Aggregations

ICommand (org.eclipse.core.resources.ICommand)15 IProjectDescription (org.eclipse.core.resources.IProjectDescription)12 ArrayList (java.util.ArrayList)2 IProject (org.eclipse.core.resources.IProject)2 IPath (org.eclipse.core.runtime.IPath)2 URI (java.net.URI)1 List (java.util.List)1 RegisteredProject (org.eclipse.che.api.project.server.RegisteredProject)1 IBuildConfiguration (org.eclipse.core.resources.IBuildConfiguration)1 IWorkspace (org.eclipse.core.resources.IWorkspace)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Path (org.eclipse.core.runtime.Path)1 Status (org.eclipse.core.runtime.Status)1 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)1 IJavaProject (org.eclipse.jdt.core.IJavaProject)1 JavaModelException (org.eclipse.jdt.core.JavaModelException)1