KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > patch > IFilePatch


1 /*******************************************************************************
2  * Copyright (c) 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.compare.patch;
12
13 import org.eclipse.core.resources.IStorage;
14 import org.eclipse.core.runtime.IPath;
15 import org.eclipse.core.runtime.IProgressMonitor;
16
17 /**
18  * A representation of a file patch that can be applied to an input stream.
19  * <p>
20  * This interface is not intended to be implemented by clients. Clients can
21  * obtain file patches by calling
22  * {@link ApplyPatchOperation#parsePatch(org.eclipse.core.resources.IStorage)}.
23  * </p>
24  *
25  * @see ApplyPatchOperation#parsePatch(org.eclipse.core.resources.IStorage)
26  * @since 3.3
27  */

28 public interface IFilePatch {
29
30     /**
31      * Return the target path for this patch. The target path may differ
32      * depending on whether the patch is being reversed or not.
33      *
34      * @param configuration the patch configuration
35      * @return the target path for this patch
36      * @see PatchConfiguration#isReversed()
37      */

38     public IPath getTargetPath(PatchConfiguration configuration);
39
40     /**
41      * Apply this patch to the given file contents. The result provides the
42      * original and patch contents and also indicates whether some portions of
43      * the patch (called hunks) failed to apply.
44      *
45      * @param contents the file contents
46      * @param configuration the patch configuration
47      * @param monitor a progress monitor
48      * @return the result of the patch application
49      */

50     public IFilePatchResult apply(IStorage contents,
51             PatchConfiguration configuration, IProgressMonitor monitor);
52     
53     /**
54      * Return the header information of the patch or
55      * <code>null</code> if there was no header text.
56      * The header may be multi-line.
57      * @return the header information of the patch or
58      * <code>null</code>
59      */

60     public String JavaDoc getHeader();
61 }
62
Popular Tags