de.uni_paderborn.fujaba.basic
Class FileHistory

java.lang.Object
  extended byde.uni_paderborn.fujaba.basic.FileHistory

public class FileHistory
extends java.lang.Object

FileHistory provides a recently opened file list and a mechanism to update special Actions (OpenRecentProjectAction) to open these files. These actions can be used to create a recent file list in menus or in Toolbars. To do so, create an Action entry and a corresponding Item that uses this entry like this:

 
   fileHistory0   Load recent
 project de/uni_paderborn/fujaba/app/images/openRecent.gif 
   
 
The Method updateAction updates these Actions identified by their name "fileHistory#" with index # to open the files in the recently opened file list. Index starts with 0.

Version:
$Revision: 1.12.2.1 $
Author:
$Author: zuendorf $

Constructor Summary
FileHistory()
          Constructor for class FileHistory
 
Method Summary
 boolean addToHistory(java.io.File file)
          Adds a file to the file History
 java.io.File firstOfHistory()
          No comment provided by developer, please add a comment to improve documentation.
static FileHistory get()
          Get singleton of class FileHistory.
 boolean isInHistory(java.io.File file)
          Check if the provided file is in history
 void loadHistoryFromProperties()
          Loads the file history from property file.
 void removeNotExistingFiles()
          Checks all files in history if they exist and removes non existing files from the history.
 void saveHistoryToProperties()
          Saves the file history to properties.
 void updateActions()
          Updates all fileHistory# Actions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileHistory

public FileHistory()
Constructor for class FileHistory

Method Detail

get

public static FileHistory get()
Get singleton of class FileHistory.

Returns:
Singleton object of FileHistory

addToHistory

public boolean addToHistory(java.io.File file)
Adds a file to the file History

Parameters:
file - File to add
Returns:
true if added (history changed), false if the file is still in history or not exists

isInHistory

public boolean isInHistory(java.io.File file)
Check if the provided file is in history

Parameters:
file - File to check
Returns:
true if file is in history, false otherwise

firstOfHistory

public java.io.File firstOfHistory()
No comment provided by developer, please add a comment to improve documentation.

Returns:
No description provided

loadHistoryFromProperties

public void loadHistoryFromProperties()
Loads the file history from property file. Called by constructor of FileHistory.


saveHistoryToProperties

public void saveHistoryToProperties()
Saves the file history to properties. Should be called by ExitAction


updateActions

public void updateActions()
Updates all fileHistory# Actions


removeNotExistingFiles

public void removeNotExistingFiles()
Checks all files in history if they exist and removes non existing files from the history. It's called by OpenRecentProjectAction when the corresponding file is not found. Calling this method might cause access to removable media like floppys, so it might take some time.