Package org.eclipse.team.ui.mapping
Class SaveableComparison
java.lang.Object
org.eclipse.ui.internal.InternalSaveable
org.eclipse.ui.Saveable
org.eclipse.team.ui.mapping.SaveableComparison
- All Implemented Interfaces:
IAdaptable
A saveable comparison is used to buffer changes made when comparing
or merging model elements. A buffer can be shared between multiple
typed elements within a comparison. The saveable is used by the comparison
container in order to determine when a save is required.
Clients may subclass this class.
- Since:
- 3.2
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyListener(IPropertyListener listener) Add a property change listener.voiddoRevert(IProgressMonitor monitor) Revert any changes in the buffer back to the last saved state.voiddoSave(IProgressMonitor monitor) Saves the contents of this saveable.protected voidfirePropertyChange(int property) Fire a property change event for this buffer.booleanisDirty()Returns whether the contents of this saveable have changed since the last save operation.protected abstract voidperformRevert(IProgressMonitor monitor) Method invoked fromdoRevert(IProgressMonitor)to discard the changes in the buffer.protected abstract voidperformSave(IProgressMonitor monitor) Method invoked fromdoSave(IProgressMonitor)to write out the buffer.voidremovePropertyListener(IPropertyListener listener) Remove a property change listener.protected voidsetDirty(boolean dirty) Set the dirty state of this buffer.Methods inherited from class org.eclipse.ui.Saveable
disableUI, doSave, enableUI, equals, getAdapter, getImageDescriptor, getName, getToolTipText, hashCode, show
-
Field Details
-
PROP_DIRTY
public static final int PROP_DIRTYThe property id forisDirty.- See Also:
-
-
Constructor Details
-
SaveableComparison
public SaveableComparison()
-
-
Method Details
-
isDirty
public boolean isDirty()Returns whether the contents of this saveable have changed since the last save operation.Note: this method is called frequently, for example by actions to determine their enabled status.
-
doSave
Saves the contents of this saveable.If the save is cancelled through user action, or for any other reason, the part should invoke
setCancelledon theIProgressMonitorto inform the caller.This method is long-running; progress and cancellation are provided by the given progress monitor.
- Specified by:
doSavein classSaveable- Parameters:
monitor- the progress monitor- Throws:
CoreException- if the save fails; it is the caller's responsibility to report the failure to the user
-
doRevert
Revert any changes in the buffer back to the last saved state.- Parameters:
monitor- a progress monitor onnullif progress feedback is not required
-
addPropertyListener
Add a property change listener. Adding a listener that is already registered has no effect.- Parameters:
listener- the listener
-
removePropertyListener
Remove a property change listener. Removing a listener that is not registered has no effect.- Parameters:
listener- the listener
-
setDirty
protected void setDirty(boolean dirty) Set the dirty state of this buffer. If the state has changed, a property change event will be fired.- Parameters:
dirty- the dirty state
-
firePropertyChange
protected void firePropertyChange(int property) Fire a property change event for this buffer.- Parameters:
property- the property that changed
-
performSave
Method invoked fromdoSave(IProgressMonitor)to write out the buffer. By default, this method invokesdoSaveon the buffers saveable model.- Parameters:
monitor- a progress monitor- Throws:
CoreException- if errors occur
-
performRevert
Method invoked fromdoRevert(IProgressMonitor)to discard the changes in the buffer.- Parameters:
monitor- a progress monitor
-