Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.compare.patch
Class PatchBuilder

java.lang.Object
  extended by 
org.eclipse.compare.patch.PatchBuilder

public class PatchBuilder
extends Object

Builder for creating IFilePatch2 and IHunk objects as well as building relationship between them.

Since:
org.eclipse.compare.core 3.5
Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.

Field Summary
static char ADDITION_PREFIX
          Line prefix used to mark an added lines.
static char CONTEXT_PREFIX
          Line prefix used to mark context lines.
static char REMOVAL_PREFIX
          Line prefix used to mark an removed lines.
 
Constructor Summary
PatchBuilder ()
           
 
Method Summary
static  IFilePatch2 addHunks ( IFilePatch2 filePatch, IHunk[] toAdd)
          Adds IHunks to a given IFilePatch2 and performs recalculation of all hunks' after positions.
static  IFilePatch2 createFilePatch ( IPath oldPath, long oldDate, IPath newPath, long newDate, IHunk[] hunks)
          Creates an IFilePatch2 instance and performs recalculation of all hunks' after positions.
static  IHunk createHunk (int start, String[] lines)
          Creates an IHunk instance.
static  IFilePatch2 removeHunks ( IFilePatch2 filePatch, IHunk[] toRemove)
          Removes IHunks from a given IFilePatch2 and performs recalculation of all hunks' after positions.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_PREFIX

public static final char CONTEXT_PREFIX
Line prefix used to mark context lines.

See Also:
Constant Field Values

ADDITION_PREFIX

public static final char ADDITION_PREFIX
Line prefix used to mark an added lines.

See Also:
Constant Field Values

REMOVAL_PREFIX

public static final char REMOVAL_PREFIX
Line prefix used to mark an removed lines.

See Also:
Constant Field Values
Constructor Detail

PatchBuilder

public PatchBuilder()
Method Detail

createHunk

public static 
IHunk createHunk(int start,
                               
String[] lines)
Creates an IHunk instance.

Parameters:
start - the start position in the before file
lines - content of the hunk. Each line starts with a control character. Their meaning is as follows:
  • '+': add the line
  • '-': delete the line
  • ' ': no change, context line
Returns:
IHunk instance

createFilePatch

public static 
IFilePatch2 createFilePatch(
IPath oldPath,
                                          long oldDate,
                                          
IPath newPath,
                                          long newDate,
                                          
IHunk[] hunks)
Creates an IFilePatch2 instance and performs recalculation of all hunks' after positions. Hunk's after position is position in the file state after applying a patch. It is affected by all the hunks that are to be applied before a given one. This recalculation is necessary to keep IFilePatch2's state coherent.

Parameters:
oldPath - the path of the before state of the file
oldDate - the timestamp of the before state of the file, see also IFilePatch2.DATE_UNKNOWN
newPath - the path of the after state of the file
newDate - the timestamp of the after state of the file, see also IFilePatch2.DATE_UNKNOWN
hunks - a set of hunks to insert into IFilePatch2
Returns:
IFilePatch2 instance

addHunks

public static 
IFilePatch2 addHunks(
IFilePatch2 filePatch,
                                   
IHunk[] toAdd)
Adds IHunks to a given IFilePatch2 and performs recalculation of all hunks' after positions. Hunk's after position is position in the file state after applying a patch. It is affected by all the hunks that are to be applied before a given one. This recalculation is necessary to keep IFilePatch2's state coherent.

Parameters:
filePatch - a file patch to add hunks to
toAdd - a set of IHunks to add
Returns:
newly created file patch with added hunks

removeHunks

public static 
IFilePatch2 removeHunks(
IFilePatch2 filePatch,
                                      
IHunk[] toRemove)
Removes IHunks from a given IFilePatch2 and performs recalculation of all hunks' after positions. Hunk's after position is position in the file state after applying a patch. It is affected by all the hunks that are to be applied before a given one. This recalculation is necessary to keep IFilePatch2's state coherent.

Parameters:
filePatch - a file patch to add hunks to
toRemove - a set of IHunks to add
Returns:
newly created file patch with removed hunks

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire