de.fxworld.generationgap.ui.commands.RemoveBuilderHandler.java Source code

Java tutorial

Introduction

Here is the source code for de.fxworld.generationgap.ui.commands.RemoveBuilderHandler.java

Source

package de.fxworld.generationgap.ui.commands;

/*
 * #%L
 * de.fxworld.generationgap.ui
 * %%
 * Copyright (C) 2016 fx-world Softwareentwicklung
 * %%
 * This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 * #L%
 *
 * Contributors:
 *    fx-world Softwareentwicklung - initial implementation
 */

import java.util.List;

import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;

import de.fxworld.generationgap.Activator;

public class RemoveBuilderHandler extends AbstractJavaProjectHandler implements IHandler {

    public RemoveBuilderHandler() {
        super("Removing Builder");
    }

    @Override
    protected void executeOnJavaProjects(List<IJavaProject> javaProjects, IProgressMonitor monitor) {

        monitor.beginTask("Removeing Builder", javaProjects.size());

        for (IJavaProject javaProject : javaProjects) {
            try {
                BuilderHelper.removeBuilder(javaProject.getProject(), Activator.BUILDER_ID);
                monitor.worked(1);

            } catch (CoreException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        monitor.done();
    }

}