public class HistoryItem extends Object implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate, IResourceProvider
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.
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE| Constructor and Description |
|---|
HistoryItem(ITypedElement base,
IFileState fileState)
Creates a
HistoryItem object which combines the given IFileState
and ITypedElement into an object
which is suitable as input for a compare viewer or ReplaceWithEditionDialog. |
| Modifier and Type | Method and Description |
|---|---|
String |
getCharset()
Returns the name of a charset encoding to be used when decoding this
stream accessor's contents into characters.
|
InputStream |
getContents()
Returns an open
InputStream for this object which can be used to retrieve the object's content. |
Image |
getImage()
Returns an image for this object.
|
long |
getModificationDate()
Returns the modification time of this object.
|
String |
getName()
Returns the name of this object.
|
IResource |
getResource()
Returns the corresponding resource for this object or
null. |
String |
getType()
Returns the type of this object.
|
public HistoryItem(ITypedElement base, IFileState fileState)
HistoryItem object which combines the given IFileState
and ITypedElement into an object
which is suitable as input for a compare viewer or ReplaceWithEditionDialog.base - the implementation of the ITypedElement interface delegates to this base ITypedElementfileState - the IFileState from which the streamable contents and the modification time is derived frompublic String getName()
ITypedElementgetName in interface ITypedElementpublic Image getImage()
ITypedElementgetImage in interface ITypedElementnull if this type of input has no imagepublic String getType()
ITypedElementFOLDER_TYPE.
The type is used for determining a suitable viewer for this object.getType in interface ITypedElementpublic long getModificationDate()
IModificationDateNote that this value should only be used to give the user a general idea of how old the object is.
getModificationDate in interface IModificationDatepublic InputStream getContents() throws CoreException
IStreamContentAccessorInputStream for this object which can be used to retrieve the object's content.
The client is responsible for closing the stream when finished.
Returns null if this object has no streamable contents.getContents in interface IStreamContentAccessorCoreException - if the contents of this object could not be accessedpublic String getCharset() throws CoreException
IEncodedStreamContentAccessornull 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.
getCharset in interface IEncodedStreamContentAccessornullCoreException - if an error happens while determining
the charset. See any refinements for more information.IStreamContentAccessor.getContents()public IResource getResource()
IResourceProvidernull.getResource in interface IResourceProvidernullGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.