Eclipse Platform
Release 3.2

org.eclipse.ui
Interface ISaveableModel

All Known Subinterfaces:
ISaveableCompareModel
All Known Implementing Classes:
SaveableCompareModel

public interface ISaveableModel

An ISaveableModel represents an editable subset of the domain model that may contain unsaved changes. Different workbench parts (editors and views) may present the same model(s) in different ways. This interface allows the workbench to provide more appropriate handling of operations such as saving and closing workbench parts. For example, if two editors sharing the same model with unsaved changes are closed simultaneously, the user is only prompted to save the changes once for the shared model, rather than once for each editor.

Workbench parts that work in terms of saveable models should implement ISaveableModelSource.

Since:
3.2
See Also:
ISaveableModelSource

Method Summary
 void doSave(IProgressMonitor monitor)
          Saves the contents of this model.
 ImageDescriptor getImageDescriptor()
          Returns the image descriptor for this model.
 String getName()
          Returns the name of this model for display purposes.
 String getToolTipText()
          Returns the tool tip text for this model.
 boolean isDirty()
          Returns whether the contents of this model have changed since the last save operation.
 

Method Detail

getName

public String getName()
Returns the name of this model for display purposes.

Returns:
the model's name; never null.

getToolTipText

public String getToolTipText()
Returns the tool tip text for this model. This text is used to differentiate between two inputs with the same name. For instance, MyClass.java in folder X and MyClass.java in folder Y. The format of the text varies between input types.

Returns:
the tool tip text; never null

getImageDescriptor

public ImageDescriptor getImageDescriptor()
Returns the image descriptor for this model.

Returns:
the image descriptor for this model; may be null if there is no image

doSave

public void doSave(IProgressMonitor monitor)
            throws CoreException
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.

Parameters:
monitor - the progress monitor
Throws:
CoreException - if the save fails; it is the caller's responsibility to report the failure to the user

isDirty

public boolean isDirty()
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.

Returns:
true if the contents have been modified and need saving, and false if they have not changed since the last save

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

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