Package org.eclipse.emf.cdo.ui

## Class CDOTreeExpansionAgent

- java.lang.Object
- - org.eclipse.emf.cdo.ui.CDOTreeExpansionAgent

-     public class CDOTreeExpansionAgent
      extends java.lang.Object

  Automatically preserves a `tree viewer's` item expansion states across multiple `target changes` of the underlying `view`.

  When the `target` of the tree viewer's underlying `view` changes, for example during `branch` switches or `time travels`, viewer items can become unavailable and are, hence, removed from the tree viewer. These items can become available again during subsequent view target changes. This agent remembers the set of expanded tree items and reestablishes these expansion states when items become available again.

  Internally this is achieved by registering a `ITreeViewerListener` to the tree viewer and by listening to `CDOViewTargetChangedEvents` of the underlying `view`. This agent disposes of itself when the `tree viewer` is disposed or when the `view` is closed.

  Since:
    4.4
  Author:
    Eike Stepper

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CDOTreeExpansionAgent​(CDOView view, TreeViewer viewer)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `dispose()` |
    `CDOView` | `getView()` |
    `TreeViewer` | `getViewer()` |
    `void` | `setExpandedStates()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CDOTreeExpansionAgent

          public CDOTreeExpansionAgent​(CDOView view,
                                       TreeViewer viewer)

  - ### Method Detail

    - #### getView

          public final CDOView getView()

    - #### getViewer

          public final TreeViewer getViewer()

    - #### setExpandedStates

          public void setExpandedStates()

    - #### dispose

          public void dispose()