org.eclipse.core.internal.resources
Class SaveManager

java.lang.Object
  extended by org.eclipse.core.internal.resources.SaveManager
All Implemented Interfaces:
IManager, IStringPoolParticipant, IElementInfoFlattener

public class SaveManager
extends java.lang.Object
implements IElementInfoFlattener, IManager, IStringPoolParticipant


Constructor Summary
SaveManager(Workspace workspace)
           
 
Method Summary
 ISavedState addParticipant(org.eclipse.core.runtime.Plugin plugin, ISaveParticipant participant)
           
 void forgetSavedTree(java.lang.String pluginId)
           
 int getSaveNumber(java.lang.String pluginId)
           
 java.lang.Object readElement(org.eclipse.core.runtime.IPath path, java.io.DataInput input)
          Reads an element info from the given input stream.
 void removeParticipant(org.eclipse.core.runtime.Plugin plugin)
           
 void requestSnapshot()
           
 org.eclipse.core.runtime.IStatus save(int kind, boolean keepConsistencyWhenCanceled, Project project, org.eclipse.core.runtime.IProgressMonitor parentMonitor)
           
 org.eclipse.core.runtime.IStatus save(int kind, Project project, org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void shareStrings(StringPool pool)
          Instructs this participant to share its strings in the provided pool.
 void shutdown(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void snapshotIfNeeded(boolean hasTreeChanges)
          Performs a snapshot if one is deemed necessary.
 void startup(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void visitAndSave(IResource root)
          Visit the given resource (to depth infinite) and write out extra information like markers and sync info.
 void visitAndSnap(IResource root)
          Visit the given resource (to depth infinite) and write out extra information like markers and sync info.
 void writeElement(org.eclipse.core.runtime.IPath path, java.lang.Object element, java.io.DataOutput output)
          Writes the given element to the output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaveManager

public SaveManager(Workspace workspace)
Method Detail

addParticipant

public ISavedState addParticipant(org.eclipse.core.runtime.Plugin plugin,
                                  ISaveParticipant participant)
                           throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

forgetSavedTree

public void forgetSavedTree(java.lang.String pluginId)

getSaveNumber

public int getSaveNumber(java.lang.String pluginId)

readElement

public java.lang.Object readElement(org.eclipse.core.runtime.IPath path,
                                    java.io.DataInput input)
                             throws java.io.IOException
Description copied from interface: IElementInfoFlattener
Reads an element info from the given input stream.

Specified by:
readElement in interface IElementInfoFlattener
Parameters:
path - the path of the element to be read
input - the stream from which the element info should be read.
Returns:
the object associated with the given elementPath, which may be null.
Throws:
java.io.IOException
See Also:
IElementInfoFlattener.readElement(IPath, DataInput)

removeParticipant

public void removeParticipant(org.eclipse.core.runtime.Plugin plugin)

requestSnapshot

public void requestSnapshot()

save

public org.eclipse.core.runtime.IStatus save(int kind,
                                             Project project,
                                             org.eclipse.core.runtime.IProgressMonitor monitor)
                                      throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

save

public org.eclipse.core.runtime.IStatus save(int kind,
                                             boolean keepConsistencyWhenCanceled,
                                             Project project,
                                             org.eclipse.core.runtime.IProgressMonitor parentMonitor)
                                      throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

shareStrings

public void shareStrings(StringPool pool)
Description copied from interface: IStringPoolParticipant
Instructs this participant to share its strings in the provided pool.

Specified by:
shareStrings in interface IStringPoolParticipant

shutdown

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

snapshotIfNeeded

public void snapshotIfNeeded(boolean hasTreeChanges)
Performs a snapshot if one is deemed necessary. Encapsulates rules for determining when a snapshot is needed. This should be called at the end of every top level operation.


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

visitAndSave

public void visitAndSave(IResource root)
                  throws org.eclipse.core.runtime.CoreException
Visit the given resource (to depth infinite) and write out extra information like markers and sync info. To be called during a full save and project save. FIXME: This method is ugly. Fix it up and look at merging with #visitAndSnap

Throws:
org.eclipse.core.runtime.CoreException

visitAndSnap

public void visitAndSnap(IResource root)
                  throws org.eclipse.core.runtime.CoreException
Visit the given resource (to depth infinite) and write out extra information like markers and sync info. To be called during a snapshot FIXME: This method is ugly. Fix it up and look at merging with #visitAndSnap

Throws:
org.eclipse.core.runtime.CoreException

writeElement

public void writeElement(org.eclipse.core.runtime.IPath path,
                         java.lang.Object element,
                         java.io.DataOutput output)
                  throws java.io.IOException
Description copied from interface: IElementInfoFlattener
Writes the given element to the output stream.

N.B. The bytes written must be sufficient for the purposes of reading the object back in.

Specified by:
writeElement in interface IElementInfoFlattener
Parameters:
path - the element's path in the tree
element - the object associated with the given path, which may be null.
Throws:
java.io.IOException
See Also:
IElementInfoFlattener.writeElement(IPath, Object, DataOutput)