Eclipse Platform
Release 3.3

org.eclipse.compare.patch
Interface IFilePatch


public interface IFilePatch

A representation of a file patch that can be applied to an input stream.

This interface is not intended to be implemented by clients. Clients can obtain file patches by calling ApplyPatchOperation.parsePatch(org.eclipse.core.resources.IStorage).

Since:
3.3
See Also:
ApplyPatchOperation.parsePatch(org.eclipse.core.resources.IStorage)

Method Summary
 IFilePatchResult apply(IStorage contents, PatchConfiguration configuration, IProgressMonitor monitor)
          Apply this patch to the given file contents.
 String getHeader()
          Return the header information of the patch or null if there was no header text.
 IPath getTargetPath(PatchConfiguration configuration)
          Return the target path for this patch.
 

Method Detail

getTargetPath

public IPath getTargetPath(PatchConfiguration configuration)
Return the target path for this patch. The target path may differ depending on whether the patch is being reversed or not.

Parameters:
configuration - the patch configuration
Returns:
the target path for this patch
See Also:
PatchConfiguration.isReversed()

apply

public IFilePatchResult apply(IStorage contents,
                              PatchConfiguration configuration,
                              IProgressMonitor monitor)
Apply this patch to the given file contents. The result provides the original and patch contents and also indicates whether some portions of the patch (called hunks) failed to apply.

Parameters:
contents - the file contents
configuration - the patch configuration
monitor - a progress monitor
Returns:
the result of the patch application

getHeader

public String getHeader()
Return the header information of the patch or null if there was no header text. The header may be multi-line.

Returns:
the header information of the patch or null

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.