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

## com.sun.javatest.tool
Class FileHistory

    java.lang.Object
      com.sun.javatest.tool.FileHistory

    public class FileHistory

extends java.lang.Object

A class to maintain a history of recently used files. The history is maintained in a specified file in a WorkDirectory, and can be dynamically added to a menu by means of a Listener class. The format of the file is one file per line, with most recently added entries appearing first. Lines beginning with `#` are ignored.

Nested Class Summary
`static class` | `FileHistory.Listener` A class that will dynamically add the latest entries for a FileHistory onto a menu.

Field Summary
`static java.lang.String` | `FILE` The name of the client property used to access the File that identifies which dynamically added menu entry has been selected.

Method Summary
`void` | `add(java.io.File file)` Add a new file to the history.
`static FileHistory` | `getFileHistory(java.io.File wdFile, java.lang.String name)` Get a shared FileHistory object for a specified file and path to work directory.
`static FileHistory` | `getFileHistory(WorkDirectory wd, java.lang.String name)` Get a shared FileHistory object for a specified file and work directory.
`java.io.File` | `getLatestEntry()` Get the latest valid entry from a file history object.
`java.io.File[]` | `getRecentEntries(int count)` Get the most recent entries from the history.
`java.io.File` | `getRelativeLatestEntry(java.lang.String newRoot, java.lang.String oldRoot)`

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

Field Detail

### FILE

    public static java.lang.String FILE

  The name of the client property used to access the File that identifies which dynamically added menu entry has been selected.

  See Also:
    `FileHistory.Listener`

Method Detail

### getFileHistory

    public static FileHistory getFileHistory(WorkDirectory wd,
                                             java.lang.String name)

  Get a shared FileHistory object for a specified file and work directory.

  Parameters:
    `wd` - The work directory in which the history file is maintained.
    `name` - The name of the file within the work direectory's jtData/ subdirectory.
  Returns:
    the specified FileHistory object

### getFileHistory

    public static FileHistory getFileHistory(java.io.File wdFile,
                                             java.lang.String name)

  Get a shared FileHistory object for a specified file and path to work directory.

  Parameters:
    `wdFile` - The path th work directory in which the history file is maintained.
    `name` - The name of the file within the work direectory's jtData/ subdirectory.
  Returns:
    the specified FileHistory object

### add

    public void add(java.io.File file)

  Add a new file to the history. The file in the work directory for this history will be updated.

  Parameters:
    `file` - the file to be added to the history

### getRecentEntries

    public java.io.File[] getRecentEntries(int count)

  Get the most recent entries from the history. Only entries for files that exist on this system are returned. Thus the history can accomodate files for different systems, which will likely not exist on all systems on which the history is used.

  Parameters:
    `count` - the number of most recent, existing files to be returned.
  Returns:
    an array of the most recent, existing entries

### getLatestEntry

    public java.io.File getLatestEntry()

  Get the latest valid entry from a file history object. An entry is valid if it identifies a file that exists on the current system.

  Returns:
    the latest valid entry from afile history object, or null if none found.

### getRelativeLatestEntry

    public java.io.File getRelativeLatestEntry(java.lang.String newRoot,
                                               java.lang.String oldRoot)

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

Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.