com.ibm.lab.soln.resources.markers
Class RecentEdits

java.lang.Object
  |
  +--com.ibm.lab.soln.resources.markers.RecentEdits

public class RecentEdits
extends java.lang.Object

Implements support for a set of revolving markers that identify the most recently edited files. A fixed maximum number of markers are created. Internally a HashMap is used to track the marker-resource relationship and a Vector to implement a FIFO list of recently edited files and backtrack to the marker when one is removed.


Constructor Summary
RecentEdits()
          Constructor for RecentEdits which loads all markers into the internal HashMap and Vector.
 
Method Summary
 void addReditMarker(org.eclipse.core.resources.IResource res)
          Adds a marker to the passed resource and keeps a reference to the resource in the internal HashMap and Vector.
 void checkReditMarker(org.eclipse.core.resources.IResource res, org.eclipse.core.resources.IResourceDelta delta)
          Determines if a marker that is being used to track recently edited files has been deleted, and if so, removes the corresponding entries from the internal HashMap and Vector.
 int getLimit()
          Returns a limit value.
 boolean recentEditsEnabled(org.eclipse.core.resources.IResource resource)
          Identifies if the resource is ok for recent edit tracking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecentEdits

public RecentEdits()
Constructor for RecentEdits which loads all markers into the internal HashMap and Vector. This class is instantiated by the RecentEditsRCL resource change listener.
Method Detail

addReditMarker

public void addReditMarker(org.eclipse.core.resources.IResource res)
                    throws org.eclipse.core.runtime.CoreException
Adds a marker to the passed resource and keeps a reference to the resource in the internal HashMap and Vector. If the limit for the number of markers has been hit, the oldest marker is removed before a new one is created. Markers are only added if they have not been added before, the resource is not derived, and the resource name does not start with a "." to indicate a system file. Derived resources are typically created by a builder, and not subject to direct user editing.

The marker is defined as a subtype of bookmark and problemmarker so the marker will be shown in the Bookmark and Tasks view.

Parameters:
res - Resource to which a marker will be added.

checkReditMarker

public void checkReditMarker(org.eclipse.core.resources.IResource res,
                             org.eclipse.core.resources.IResourceDelta delta)
Determines if a marker that is being used to track recently edited files has been deleted, and if so, removes the corresponding entries from the internal HashMap and Vector.
Parameters:
res -  
delta -  

getLimit

public int getLimit()
Returns a limit value. Is based on a call to the peference key in the com.ibm.lab.soln.dialogs plug-in if available, or a hardcoded value of 4.
Returns:
int

recentEditsEnabled

public boolean recentEditsEnabled(org.eclipse.core.resources.IResource resource)
Identifies if the resource is ok for recent edit tracking. Property value, when not defined or set to true, means no tracking.