Jump to: navigation, search

CVS Hacks

Revision as of 10:01, 7 September 2007 by Michael Valenta.ca.ibm.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page contains descriptions of some of the things we did to make the CVS plug-ins work well.


CVS Label Decorations

The section contains a few items related to the CVS decorator

Decorator Enablement

When a user starts working with CVS, we wanted to have the CVS decorator on by default. However, we couldn;t just turn the decorator on by default in the plugin.xml as this would cause the CVS plug-ins to be loaded when Eclipse first started even if the user never intended to use CVS. To work around this, we wrote code in the CVS/UI plug-in startup that would enable the decorators the first time the plug-in started. After that time, the setting was never altered by the CVS/UI plug-in (i.e. if the user subsequently disabled the decorator, it would stay disabled even across restarts). One side effect of this is that choosing Restore Defaults in the preference page disables the CVS decorator.

Dirty State Determination

A dirty bit cache is used to cache the dirty sate of folders so that recomputation of the folder dirty state is only performed when the dirty state of a descendant of a folder changes. The cache operates by placing a bit in the session properties for each resource that indicates whether the resource is dirty, clean or needs to be recomputed. The session property key is SyncInfoCache.IS_DIRTY. It also uses the ISynchronizer to persist the bit for folders to improve dirty state computation on restart. The key used for the ISynchronizer is SessionPropertySyncInfoCache.FOLDER_DIRTY_STATE_KEY.

  1. On startup when a folder dirty state is queried, look in the synchronizer cache and, if the state is there, us it and put is in the session cache
  2. When a state changes, set the flag to recompute.
  3. when the state is queried, use the cached state unless it is "recompute" in which case the state needs to be recalculated.
  4. On shutdown, transfer the folder dirty state to the synchronizer cache since the session cache is not persisted across restarts.