Package org.eclipse.ui.navigator
Class SaveablesProvider
java.lang.Object
org.eclipse.ui.navigator.SaveablesProvider
- All Implemented Interfaces:
IDisposable
Provides
Saveable
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
ModifierConstructorDescriptionprotected
Creates a new saveable model provider. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of this saveables provider.protected void
doInit()
May be overridden by clients.protected final void
fireSaveablesClosed
(Saveable[] models) Notifies the listener that the given models were closed in this model provider.protected final boolean
fireSaveablesClosing
(Saveable[] models, boolean force) Notifies the listener that the given models are about to be closed in this model provider.protected final void
fireSaveablesDirtyChanged
(Saveable[] models) Notifies the listener that the given models' dirty state has changed.protected final 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[]
Returns the saveables reachable through this provider.final void
init
(ISaveablesLifecycleListener listener) Initializes this SaveablesProvider with the given listener, and calls the hook method doInit().
-
Constructor Details
-
SaveablesProvider
protected SaveablesProvider()Creates a new saveable model provider. May only be called by subclasses.
-
-
Method Details
-
init
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
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
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
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
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
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
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
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
-