|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.internal.resources.SaveContext
public class SaveContext
Field Summary |
---|
Fields inherited from interface org.eclipse.core.resources.ISaveContext |
---|
FULL_SAVE, PROJECT_SAVE, SNAPSHOT |
Method Summary | |
---|---|
void |
commit()
|
org.eclipse.core.runtime.IPath[] |
getFiles()
Returns current files mapped with the ISaveContext.map
facility or an empty array if there are no mapped files. |
int |
getKind()
Returns the type of this save. |
org.eclipse.core.runtime.Plugin |
getPlugin()
|
int |
getPreviousSaveNumber()
Returns the number for the previous save in which the plug-in actively participated, or 0
if the plug-in has never actively participated in a save before. |
IProject |
getProject()
If the current save is a project save, this method returns the project being saved. |
int |
getSaveNumber()
Returns the number for this save. |
boolean |
isDeltaNeeded()
|
org.eclipse.core.runtime.IPath |
lookup(org.eclipse.core.runtime.IPath file)
Returns the current location for the given file or null if none. |
void |
map(org.eclipse.core.runtime.IPath file,
org.eclipse.core.runtime.IPath location)
Maps the given plug-in file to its real location. |
void |
needDelta()
Indicates that the saved workspace tree should be remembered so that a delta will be available in a subsequent session when the plug-in re-registers to participate in saves. |
void |
needSaveNumber()
Indicates that this participant has actively participated in this save. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void commit() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public org.eclipse.core.runtime.IPath[] getFiles()
ISaveContext
ISaveContext.map
facility or an empty array if there are no mapped files.
getFiles
in interface ISaveContext
ISaveContext
public int getKind()
ISaveContext
ISaveContext.FULL_SAVE
ISaveContext.SNAPSHOT
ISaveContext.PROJECT_SAVE
getKind
in interface ISaveContext
ISaveContext
public org.eclipse.core.runtime.Plugin getPlugin()
ISaveContext
public int getPreviousSaveNumber()
ISaveContext
0
if the plug-in has never actively participated in a save before.
In the event of an unsuccessful save, this is the value to
rollback
to.
getPreviousSaveNumber
in interface ISaveContext
0
if never saved beforeISaveContext
public IProject getProject()
ISaveContext
getProject
in interface ISaveContext
null
if this is not
project saveISaveContext
public int getSaveNumber()
ISaveContext
1
more than the
previous save number.
This is the value to use when, for example, creating files in which a participant will save its data.
getSaveNumber
in interface ISaveContext
ISaveContext
public boolean isDeltaNeeded()
public org.eclipse.core.runtime.IPath lookup(org.eclipse.core.runtime.IPath file)
ISaveContext
null
if none.
lookup
in interface ISaveContext
null
ISaveContext
public void map(org.eclipse.core.runtime.IPath file, org.eclipse.core.runtime.IPath location)
ISaveContext
ISaveContext.getSaveNumber()
to map plug-in configuration
file names to real locations.
For example, assume a plug-in has a configuration file named "config.properties". The map facility can be used to map that logical name onto a real name which is specific to a particular save (e.g., 10.config.properties, where 10 is the current save number). The paths specified here should always be relative to the plug-in state location for the plug-in saving the state.
Each save participant must manage the deletion of its old state files. Old state files
can be discovered using getPreviousSaveNumber
or by using
getFiles
to discover the current files and comparing that to the
list of files on disk.
map
in interface ISaveContext
file
- the logical name of the participant's data filelocation
- the real (i.e., filesystem) name by which the file should be known
for this save, or null
to remove the entryISaveContext
public void needDelta()
ISaveContext
Note that this is orthogonal to needSaveNumber
. That is,
one can ask for a delta regardless of whether or not one is an active participant.
Note that deltas are not guaranteed to be saved even if saving is requested. Deltas cannot be supplied where the previous state is too old or has become invalid.
This method is only valid for full saves. It is ignored during snapshots or project saves.
needDelta
in interface ISaveContext
ISaveContext
public void needSaveNumber()
ISaveContext
If this method is not called, the plug-in is not deemed to be an active participant in this save.
Note that this is orthogonal to needDelta
. That is,
one can be an active participant whether or not one asks for a delta.
needSaveNumber
in interface ISaveContext
ISaveContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |