KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.eclipse.core.runtime.OperationCanceledException;
16
17 import org.eclipse.core.filebuffers.IFileBuffer;
18
19 /**
20  * A file buffer operation performs changes of the contents of a file buffer.
21  * <p>
22  * File buffer operations can be executed by a
23  * {@link org.eclipse.core.filebuffers.manipulation.FileBufferOperationRunner} or
24  * a {@link org.eclipse.core.filebuffers.manipulation.GenericFileBufferOperationRunner}.
25  * The operation runner takes care of all aspects that are common to file buffer
26  * manipulation such as creating file buffers, state validation, committing file
27  * buffers, etc. Thus, the purpose of <code>IFileBufferOperation</code> is
28  * constrained to buffer content manipulation.
29  *
30  * @see org.eclipse.core.filebuffers.manipulation.FileBufferOperationRunner
31  * @since 3.1
32  */

33 public interface IFileBufferOperation {
34
35     /**
36      * Returns the name of this file buffer operation. The operation name is
37      * used by the <code>FileBufferOperationRunner</code> while reporting
38      * progress.
39      *
40      * @return the operation name or <code>null</code>
41      */

42     String JavaDoc getOperationName();
43
44     /**
45      * Runs this operation, that is manipulates the content of the given file
46      * buffer.
47      *
48      * @param fileBuffer the file buffer
49      * @param monitor the progress monitor
50      * @throws CoreException in case the content manipulation failed
51      * @throws OperationCanceledException in case the monitor has been set to canceled
52      */

53     void run(IFileBuffer fileBuffer, IProgressMonitor monitor) throws CoreException, OperationCanceledException;
54 }
55
Popular Tags