Package org.eclipse.ui.navigator
Class SaveablesProvider
- java.lang.Object
-
- org.eclipse.ui.navigator.SaveablesProvider
-
- All Implemented Interfaces:
IDisposable
public abstract class SaveablesProvider extends Object implements IDisposable
ProvidesSaveable
objects to the common navigator, and allows to map between elements in the tree and models.This class is intended to be subclassed by clients.
Instances of subclasses will be returned from content extensions that implementIAdaptable
.- Since:
- 3.2
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SaveablesProvider()
Creates a new saveable model provider.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes of this saveables provider.protected void
doInit()
May be overridden by clients.protected void
fireSaveablesClosed(Saveable[] models)
Notifies the listener that the given models were closed in this model provider.protected boolean
fireSaveablesClosing(Saveable[] models, boolean force)
Notifies the listener that the given models are about to be closed in this model provider.protected void
fireSaveablesDirtyChanged(Saveable[] models)
Notifies the listener that the given models' dirty state has changed.protected void
fireSaveablesOpened(Saveable[] models)
Notifies the listener that the given models were opened in this model provider.abstract Object[]
getElements(Saveable saveable)
Returns the elements representing the given saveable.abstract Saveable
getSaveable(Object element)
Returns the saveable for the given element, or null if the element does not represent a saveable.abstract Saveable[]
getSaveables()
Returns the saveables reachable through this provider.void
init(ISaveablesLifecycleListener listener)
Initializes this SaveablesProvider with the given listener, and calls the hook method doInit().
-
-
-
Method Detail
-
init
public final void init(ISaveablesLifecycleListener listener)
Initializes this SaveablesProvider with the given listener, and calls the hook method doInit().- Parameters:
listener
- listener for lifecycle events
-
doInit
protected void doInit()
May be overridden by clients. The default implementation does nothing.
-
fireSaveablesOpened
protected final void fireSaveablesOpened(Saveable[] models)
Notifies the listener that the given models were opened in this model provider. This method must be called on the UI thread.- Parameters:
models
- the affected saveables
-
fireSaveablesClosing
protected final boolean fireSaveablesClosing(Saveable[] models, boolean force)
Notifies the listener that the given models are about to be closed in this model provider. This method must be called on the UI thread.- Parameters:
models
- the affected saveablesforce
- true if the closing may be canceled by the user- Returns:
- true if the listener vetoed the closing (may be ignored if force is true)
-
fireSaveablesClosed
protected final void fireSaveablesClosed(Saveable[] models)
Notifies the listener that the given models were closed in this model provider. This method must be called on the UI thread.- Parameters:
models
- the affected saveables
-
fireSaveablesDirtyChanged
protected final void fireSaveablesDirtyChanged(Saveable[] models)
Notifies the listener that the given models' dirty state has changed. This method must be called on the UI thread.- Parameters:
models
- the affected saveables
-
getSaveables
public abstract Saveable[] getSaveables()
Returns the saveables reachable through this provider. Changes to the list of saveables or to the saveables' dirty state must be announced using the appropriate fire* methods.- Returns:
- the saveables returned by this saveables provider.
-
getElements
public abstract Object[] getElements(Saveable saveable)
Returns the elements representing the given saveable. It is recommended that a saveable be represented by only one element.- Parameters:
saveable
- the savable- Returns:
- the elements representing the given saveable (array may be empty)
-
getSaveable
public abstract Saveable getSaveable(Object element)
Returns the saveable for the given element, or null if the element does not represent a saveable.- Parameters:
element
- the element- Returns:
- the saveable for the given element, or null
-
dispose
public void dispose()
Disposes of this saveables provider. Subclasses may extend, but must call the super implementation.- Specified by:
dispose
in interfaceIDisposable
-
-