KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > filebuffers > manipulation > FileBufferOperationRunner


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.filebuffers.manipulation;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import org.eclipse.core.resources.IWorkspace;
17 import org.eclipse.core.resources.IWorkspaceRunnable;
18 import org.eclipse.core.resources.ResourcesPlugin;
19
20 import org.eclipse.core.filebuffers.IFileBuffer;
21 import org.eclipse.core.filebuffers.IFileBufferManager;
22
23
24 /**
25  * A <code>FileBufferOperationRunner</code> executes
26  * {@link org.eclipse.core.filebuffers.manipulation.IFileBufferOperation}.
27  * The runner takes care of all aspects that are not operation specific.
28  * <p>
29  * This class is not intended to be subclassed. Clients instantiate this class.
30  * </p>
31  *
32  * @see org.eclipse.core.filebuffers.manipulation.IFileBufferOperation
33  * @since 3.1
34  */

35 public class FileBufferOperationRunner extends GenericFileBufferOperationRunner {
36
37     /**
38      * Creates a new file buffer operation runner.
39      *
40      * @param fileBufferManager the file buffer manager
41      * @param validationContext the validationContext
42      */

43     public FileBufferOperationRunner(IFileBufferManager fileBufferManager, Object JavaDoc validationContext) {
44         super(fileBufferManager, validationContext);
45     }
46
47     protected void commit(final IFileBuffer[] fileBuffers, final IProgressMonitor progressMonitor) throws CoreException {
48         IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
49             public void run(IProgressMonitor monitor) throws CoreException {
50                 doCommit(fileBuffers, progressMonitor);
51             }
52         };
53         ResourcesPlugin.getWorkspace().run(runnable, computeCommitRule(fileBuffers), IWorkspace.AVOID_UPDATE, progressMonitor);
54     }
55 }
56
Popular Tags