Package org.eclipse.compare
Class HistoryItem
java.lang.Object
org.eclipse.compare.HistoryItem
- All Implemented Interfaces:
IEncodedStreamContentAccessor
,IModificationDate
,IResourceProvider
,IStreamContentAccessor
,ITypedElement
public class HistoryItem
extends Object
implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate, IResourceProvider
A combination
IFileState
and ITypedElement
that can be used as
an input to a compare viewer or other places where an IStreamContentAccessor
is needed.
Clients may instantiate this class; it is not intended to be subclassed.
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Fields inherited from interface org.eclipse.compare.ITypedElement
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE
-
Constructor Summary
ConstructorDescriptionHistoryItem
(ITypedElement base, IFileState fileState) Creates aHistoryItem
object which combines the givenIFileState
andITypedElement
into an object which is suitable as input for a compare viewer orReplaceWithEditionDialog
. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of a charset encoding to be used when decoding this stream accessor's contents into characters.Returns an openInputStream
for this object which can be used to retrieve the object's content.getImage()
Returns an image for this object.long
Returns the modification time of this object.getName()
Returns the name of this object.Returns the corresponding resource for this object ornull
.getType()
Returns the type of this object.
-
Constructor Details
-
HistoryItem
Creates aHistoryItem
object which combines the givenIFileState
andITypedElement
into an object which is suitable as input for a compare viewer orReplaceWithEditionDialog
.- Parameters:
base
- the implementation of theITypedElement
interface delegates to this baseITypedElement
fileState
- theIFileState
from which the streamable contents and the modification time is derived from
-
-
Method Details
-
getName
Description copied from interface:ITypedElement
Returns the name of this object. The name is used when displaying this object in the UI.- Specified by:
getName
in interfaceITypedElement
- Returns:
- the name of this object
-
getImage
Description copied from interface:ITypedElement
Returns an image for this object. This image is used when displaying this object in the UI.- Specified by:
getImage
in interfaceITypedElement
- Returns:
- the image of this object or
null
if this type of input has no image
-
getType
Description copied from interface:ITypedElement
Returns the type of this object. For objects with a file name this is typically the file extension. For folders its the constantFOLDER_TYPE
. The type is used for determining a suitable viewer for this object.- Specified by:
getType
in interfaceITypedElement
- Returns:
- the type of this object
-
getModificationDate
public long getModificationDate()Description copied from interface:IModificationDate
Returns the modification time of this object.Note that this value should only be used to give the user a general idea of how old the object is.
- Specified by:
getModificationDate
in interfaceIModificationDate
- Returns:
- the time of last modification, in milliseconds since January 1, 1970, 00:00:00 GMT
-
getContents
Description copied from interface:IStreamContentAccessor
Returns an openInputStream
for this object which can be used to retrieve the object's content. The client is responsible for closing the stream when finished. Returnsnull
if this object has no streamable contents.- Specified by:
getContents
in interfaceIStreamContentAccessor
- Returns:
- an input stream containing the contents of this object
- Throws:
CoreException
- if the contents of this object could not be accessed
-
getCharset
Description copied from interface:IEncodedStreamContentAccessor
Returns the name of a charset encoding to be used when decoding this stream accessor's contents into characters. Returnsnull
if a proper encoding cannot be determined.Note: this method does not check whether the result is a supported charset name. Callers should be prepared to handle
UnsupportedEncodingException
where this charset is used.- Specified by:
getCharset
in interfaceIEncodedStreamContentAccessor
- Returns:
- the name of a charset, or
null
- Throws:
CoreException
- if an error happens while determining the charset. See any refinements for more information.- See Also:
-
getResource
Description copied from interface:IResourceProvider
Returns the corresponding resource for this object ornull
.- Specified by:
getResource
in interfaceIResourceProvider
- Returns:
- the corresponding resource or
null
-