1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.core.resources; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 16 /** 17 * A runnable which executes as a batch operation within the workspace. 18 * The <code>IWorkspaceRunnable</code> interface should be implemented 19 * by any class whose instances are intended to be run by 20 * <code>IWorkspace.run</code>. 21 * <p> 22 * Clients may implement this interface. 23 * </p> 24 * @see IWorkspace#run(IWorkspaceRunnable, IProgressMonitor) 25 */ 26 public interface IWorkspaceRunnable { 27 /** 28 * Runs the operation reporting progress to and accepting 29 * cancellation requests from the given progress monitor. 30 * <p> 31 * Implementors of this method should check the progress monitor 32 * for cancellation when it is safe and appropriate to do so. The cancellation 33 * request should be propagated to the caller by throwing 34 * <code>OperationCanceledException</code>. 35 * </p> 36 * 37 * @param monitor a progress monitor, or <code>null</code> if progress 38 * reporting and cancellation are not desired 39 * @exception CoreException if this operation fails. 40 */ 41 public void run(IProgressMonitor monitor) throws CoreException; 42 } 43