blob: c2351d85afc707aa14a7721d88cee31abad24b46 [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2010 Oracle
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* Konstantin Komissarchik - initial implementation and ongoing maintenance
******************************************************************************/
package org.eclipse.jst.common.project.facet.core.libprov.user;
import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.beginTask;
import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.done;
import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.worked;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jst.common.project.facet.core.internal.ClasspathUtil;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation;
import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
/**
* The uninstall operation corresponding to the user-library-provider that uses JDT user library facility
* for managing libraries. This class can be subclassed by those wishing to extend the base implementation
* supplied by the framework.
*
* @author <a href="mailto:konstantin.komissarchik@oracle.com">Konstantin Komissarchik</a>
* @since 1.4
*/
public class UserLibraryProviderUninstallOperation
extends LibraryProviderOperation
{
/**
* Runs the library provider operation. Subclasses can override.
*
* @param config the library provider operation config; will never be null
* @param monitor the progress monitor for status reporting and cancellation
* @throws CoreException if failed while executing the operation
*/
public void execute( final LibraryProviderOperationConfig config,
final IProgressMonitor monitor )
throws CoreException
{
beginTask( monitor, "", 1 ); //$NON-NLS-1$
try
{
final IProject project = config.getFacetedProject().getProject();
ClasspathUtil.removeClasspathEntries( project, config.getProjectFacet() );
worked( monitor, 1 );
}
finally
{
done( monitor );
}
}
}