blob: 295796b2cc6173f9cb8b6c585ae1f684d60e41ec [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2009-2010 Thales Corporate Services S.A.S.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Thales Corporate Services S.A.S - initial API and implementation
*
* </copyright>
*/
package org.eclipse.egf.portfolio.eclipse.build;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.egf.core.producer.InvocationException;
import org.eclipse.egf.ftask.producer.context.ITaskProductionContext;
import org.eclipse.egf.ftask.producer.invocation.ITaskProduction;
/**
* @author Matthieu Helleboid
*
*/
public class BuildWorkspace implements ITaskProduction {
public void preExecute(ITaskProductionContext productionContext, IProgressMonitor monitor) throws InvocationException {
}
public void doExecute(ITaskProductionContext productionContext, IProgressMonitor monitor) throws InvocationException {
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot wsRoot = ws.getRoot();
IProgressMonitor progressMonitor = new NullProgressMonitor();
try {
wsRoot.refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);
ws.build(IncrementalProjectBuilder.CLEAN_BUILD, progressMonitor);
ws.build(IncrementalProjectBuilder.FULL_BUILD, progressMonitor);
} catch (CoreException e) {
e.printStackTrace();
}
}
public void postExecute(ITaskProductionContext productionContext, IProgressMonitor monitor) throws InvocationException {
}
}