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
public abstract class SaveableComparison extends Saveable
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 Modifier and Type Field Description static intPROP_DIRTYThe property id forisDirty.
-
Constructor Summary
Constructors Constructor Description SaveableComparison()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPropertyListener(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 Detail
-
PROP_DIRTY
public static final int PROP_DIRTY
The property id forisDirty.- See Also:
- Constant Field Values
-
-
Method Detail
-
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
public void doSave(IProgressMonitor monitor) throws CoreException
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
public void doRevert(IProgressMonitor monitor)
Revert any changes in the buffer back to the last saved state.- Parameters:
monitor- a progress monitor onnullif progress feedback is not required
-
addPropertyListener
public void addPropertyListener(IPropertyListener listener)
Add a property change listener. Adding a listener that is already registered has no effect.- Parameters:
listener- the listener
-
removePropertyListener
public void removePropertyListener(IPropertyListener listener)
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
protected abstract void performSave(IProgressMonitor monitor) throws CoreException
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
protected abstract void performRevert(IProgressMonitor monitor)
Method invoked fromdoRevert(IProgressMonitor)to discard the changes in the buffer.- Parameters:
monitor- a progress monitor
-
-