org.eclipse.core.internal.resources
Class ContentDescriptionManager

java.lang.Object
  extended by org.eclipse.core.internal.resources.ContentDescriptionManager
All Implemented Interfaces:
java.util.EventListener, ILifecycleListener, IManager, org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener, org.eclipse.core.runtime.IRegistryChangeListener

public class ContentDescriptionManager
extends java.lang.Object
implements IManager, org.eclipse.core.runtime.IRegistryChangeListener, org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener, ILifecycleListener

Keeps a cache of recently read content descriptions.

Since:
3.0
See Also:
IFile.getContentDescription()

Field Summary
static byte ABOUT_TO_FLUSH
           
static byte EMPTY_CACHE
           
static java.lang.String FAMILY_DESCRIPTION_CACHE_FLUSH
           
static byte FLUSHING_CACHE
           
static byte INVALID_CACHE
           
static byte USED_CACHE
           
 
Constructor Summary
ContentDescriptionManager()
           
 
Method Summary
 void contentTypeChanged(org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent event)
           
 byte getCacheState()
          Public so tests can examine it.
 long getCacheTimestamp()
           
 org.eclipse.core.runtime.content.IContentTypeMatcher getContentTypeMatcher(Project project)
           
 org.eclipse.core.runtime.content.IContentDescription getDescriptionFor(File file, ResourceInfo info)
           
 void handleEvent(LifecycleEvent event)
           
 void invalidateCache(boolean flush, IProject project)
          Marks the cache as invalid.
 void projectPreferencesChanged(IProject project)
           
 void registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent event)
           
 void shutdown(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void startup(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAMILY_DESCRIPTION_CACHE_FLUSH

public static final java.lang.String FAMILY_DESCRIPTION_CACHE_FLUSH
See Also:
Constant Field Values

EMPTY_CACHE

public static final byte EMPTY_CACHE
See Also:
Constant Field Values

USED_CACHE

public static final byte USED_CACHE
See Also:
Constant Field Values

INVALID_CACHE

public static final byte INVALID_CACHE
See Also:
Constant Field Values

FLUSHING_CACHE

public static final byte FLUSHING_CACHE
See Also:
Constant Field Values

ABOUT_TO_FLUSH

public static final byte ABOUT_TO_FLUSH
See Also:
Constant Field Values
Constructor Detail

ContentDescriptionManager

public ContentDescriptionManager()
Method Detail

contentTypeChanged

public void contentTypeChanged(org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent event)
Specified by:
contentTypeChanged in interface org.eclipse.core.runtime.content.IContentTypeManager.IContentTypeChangeListener
See Also:
IContentTypeManager.IContentTypeChangeListener#contentTypeChanged(IContentTypeManager.ContentTypeChangeEvent)

getCacheState

public byte getCacheState()
Public so tests can examine it.


getCacheTimestamp

public long getCacheTimestamp()
                       throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

getContentTypeMatcher

public org.eclipse.core.runtime.content.IContentTypeMatcher getContentTypeMatcher(Project project)
                                                                           throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

getDescriptionFor

public org.eclipse.core.runtime.content.IContentDescription getDescriptionFor(File file,
                                                                              ResourceInfo info)
                                                                       throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

invalidateCache

public void invalidateCache(boolean flush,
                            IProject project)
Marks the cache as invalid. Does not do anything if the cache is new. Optionally causes the cached information to be actually flushed.

Parameters:
flush - whether the cached information should be flushed
See Also:
doFlushCache(IProgressMonitor, IPath[])

registryChanged

public void registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent event)
Specified by:
registryChanged in interface org.eclipse.core.runtime.IRegistryChangeListener
See Also:
IRegistryChangeListener.registryChanged(IRegistryChangeEvent)

handleEvent

public void handleEvent(LifecycleEvent event)
Specified by:
handleEvent in interface ILifecycleListener
See Also:
ILifecycleListener.handleEvent(LifecycleEvent)

shutdown

public void shutdown(org.eclipse.core.runtime.IProgressMonitor monitor)
              throws org.eclipse.core.runtime.CoreException
Specified by:
shutdown in interface IManager
Throws:
org.eclipse.core.runtime.CoreException

startup

public void startup(org.eclipse.core.runtime.IProgressMonitor monitor)
             throws org.eclipse.core.runtime.CoreException
Specified by:
startup in interface IManager
Throws:
org.eclipse.core.runtime.CoreException

projectPreferencesChanged

public void projectPreferencesChanged(IProject project)