Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.compare
Class HistoryItem

    java.lang.Object
      org.eclipse.compare.HistoryItem

All Implemented Interfaces:
  IEncodedStreamContentAccessor, IModificationDate, IStreamContentAccessor, ITypedElement

public class HistoryItem
extends Object
implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate

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.

Field Summary

Fields inherited from interface org.eclipse.compare.ITypedElement
`FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE`

Constructor Summary
`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`.

Method Summary
`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.
`String` | `getType()` Returns the type of this object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HistoryItem

    public 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`.

Parameters:
  `base` - the implementation of the `ITypedElement` interface delegates to this base `ITypedElement`
  `fileState` - the `IFileState` from which the streamable contents and the modification time is derived from

Method Detail

### getName

    public String 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 interface `ITypedElement`
  Returns:
    the name of this object

### getImage

    public Image 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 interface `ITypedElement`
  Returns:
    the image of this object or `null` if this type of input has no image

### getType

    public String 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 constant `FOLDER_TYPE`. The type is used for determining a suitable viewer for this object.

  Specified by:
    `getType` in interface `ITypedElement`
  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 interface `IModificationDate`
  Returns:
    the time of last modification, in milliseconds since January 1, 1970, 00:00:00 GMT

### getContents

    public InputStream getContents()
                            throws CoreException

  Description copied from interface: `IStreamContentAccessor`
  Returns an open `InputStream` 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.

  Specified by:
    `getContents` in interface `IStreamContentAccessor`
  Returns:
    an input stream containing the contents of this object
  Throws:
    `CoreException` - if the contents of this object could not be accessed

### getCharset

    public String getCharset()
                      throws CoreException

  Description copied from interface: `IEncodedStreamContentAccessor`
  Returns the name of a charset encoding to be used when decoding this stream accessor's contents into characters. Returns `null` 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 interface `IEncodedStreamContentAccessor`
  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:
    `IStreamContentAccessor.getContents()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

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