Eclipse Platform
Release 3.2

org.eclipse.team.ui.mapping
Class SaveableCompareModel

java.lang.Object
  extended byorg.eclipse.team.ui.mapping.SaveableCompareModel
All Implemented Interfaces:
ISaveableCompareModel, ISaveableModel

public abstract class SaveableCompareModel
extends Object
implements ISaveableCompareModel

A model buffer is used to buffer changes made when comparing or merging a model. A buffer can be shared between multiple typed elements within a comparison. The buffer is used by the comparison container in order to determine when a save is required.

Clients may subclass this class.

EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is a guarantee neither that this API will work nor that it will remain the same. Please do not use this API without consulting with the Platform/Team team.

Since:
3.2

Field Summary
 
Fields inherited from interface org.eclipse.team.ui.mapping.ISaveableCompareModel
PROP_DIRTY
 
Constructor Summary
SaveableCompareModel()
           
 
Method Summary
 void addPropertyListener(IPropertyListener listener)
          Add a property change listener.
 void doRevert(IProgressMonitor monitor)
          Revert any changes in the buffer back to the last saved state.
 void doSave(IProgressMonitor monitor)
          Saves the contents of this model.
protected  void firePropertyChange(int property)
          Fire a property change event for this buffer.
protected  void handleException(CoreException exception)
          Handle an exception that occurred during a save.
 boolean isDirty()
          Returns whether the contents of this model have changed since the last save operation.
protected abstract  void performRevert(IProgressMonitor monitor)
          Method invoked from doRevert(IProgressMonitor) to discard the changes in the buffer.
protected abstract  void performSave(IProgressMonitor monitor)
          Method invoked from doSave(IProgressMonitor) to write out the buffer.
 void removePropertyListener(IPropertyListener listener)
          Remove a property change listener.
protected  void setDirty(boolean dirty)
          Set the dirty state of this buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.ISaveableModel
getImageDescriptor, getName, getToolTipText
 

Constructor Detail

SaveableCompareModel

public SaveableCompareModel()
Method Detail

isDirty

public boolean isDirty()
Description copied from interface: ISaveableModel
Returns whether the contents of this model have changed since the last save operation.

Note: this method is called frequently, for example by actions to determine their enabled status.

Specified by:
isDirty in interface ISaveableModel
Returns:
true if the contents have been modified and need saving, and false if they have not changed since the last save

doSave

public void doSave(IProgressMonitor monitor)
Description copied from interface: ISaveableModel
Saves the contents of this model.

If the save is cancelled through user action, or for any other reason, the part should invoke setCancelled on the IProgressMonitor to inform the caller.

This method is long-running; progress and cancellation are provided by the given progress monitor.

Specified by:
doSave in interface ISaveableModel
Parameters:
monitor - the progress monitor

doRevert

public void doRevert(IProgressMonitor monitor)
Description copied from interface: ISaveableCompareModel
Revert any changes in the buffer back to the last saved state.

Specified by:
doRevert in interface ISaveableCompareModel
Parameters:
monitor - a progress monitor on null if progress feedback is not required

addPropertyListener

public void addPropertyListener(IPropertyListener listener)
Description copied from interface: ISaveableCompareModel
Add a property change listener. Adding a listener that is allready registered has no effect.

Specified by:
addPropertyListener in interface ISaveableCompareModel
Parameters:
listener - the listener

removePropertyListener

public void removePropertyListener(IPropertyListener listener)
Description copied from interface: ISaveableCompareModel
Remove a property change listener. Removing a listener that is not registered has no effect.

Specified by:
removePropertyListener in interface ISaveableCompareModel
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 from doSave(IProgressMonitor) to write out the buffer. By default, this method invokes doSave on the buffers savable model.

Parameters:
monitor - a progress monitor
Throws:
CoreException - if errors occur

performRevert

protected abstract void performRevert(IProgressMonitor monitor)
Method invoked from doRevert(IProgressMonitor) to discard the changes in the buffer.

Parameters:
monitor - a progress monitor

handleException

protected void handleException(CoreException exception)
Handle an exception that occurred during a save.

Parameters:
exception - the exception

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.