Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.ui.util.ViewerUtils Class Reference

List of all members.

Static Public Member Functions

static void setInput (final Viewer viewer, final Object input)
static void add (final Viewer viewer, final Object parentElementOrTreePath, final Object childElement)
static void add (final Viewer viewer, final Object parentElementOrTreePath, final Object[] childElements)
static void remove (final Viewer viewer, final Object elementsOrTreePaths)
static void remove (final Viewer viewer, final Object[] elementsOrTreePaths)
static void update (final Viewer viewer, final Object element, final String[] properties)
static void update (final Viewer viewer, final Object[] elements, final String[] properties)
static void refresh (final Viewer viewer, final boolean updateLabels)
static void expandToLevel (final Viewer viewer, final int level)
static void expandAll (final Viewer viewer)

Detailed Description

Utility class for manipulation of Viewers.

Tries to call alternative methods if a special operation is not supported by the viewer. All calls are automatically done in the synchronous SWT thread.

Example 1:
If you try to update a specific element in a viewer and the viewer does not support updating single elements, the whole viewer will be refreshed.

Example 2:
One element of your model has been removed. For performance reasons you don't want to refresh the whole viewer but manually remove the element from the viewer in order to reflect the model. If your viewer supports this action the element is removed. Otherwise the viewer is advised to reload the model.

Author:
bkahlert

Member Function Documentation

static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.add ( final Viewer  viewer,
final Object  parentElementOrTreePath,
final Object  childElement 
) [static]

Add the a new element to a given element in a viewer and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support additions.

Parameters:
viewer
parentElementOrTreePath
childElement
See also:
StructuredViewer.refresh(boolean)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.add ( final Viewer  viewer,
final Object  parentElementOrTreePath,
final Object[]  childElements 
) [static]

Add the new elements to a given element in a viewer and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support additions.

Parameters:
viewer
parentElementOrTreePath
childElements
See also:
StructuredViewer.refresh(boolean)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.expandAll ( final Viewer  viewer) [static]

If supported by the viewer expands all elements and makes sure it runs in the SWT thread.

Parameters:
viewer
See also:
AbstractTreeViewer.expandAll()
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.expandToLevel ( final Viewer  viewer,
final int  level 
) [static]
See also:
AbstractTreeViewer.expandToLevel(int)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.refresh ( final Viewer  viewer,
final boolean  updateLabels 
) [static]

Refreshes a viewer's display and makes sure it runs in the SWT thread.

Parameters:
viewer
updateLabels
See also:
Viewer.refresh()
StructuredViewer.refresh(boolean)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.remove ( final Viewer  viewer,
final Object  elementsOrTreePaths 
) [static]

Removes an existing element from a viewer and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support removals.

Parameters:
viewer
elementsOrTreePaths
See also:
StructuredViewer.refresh(boolean)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.remove ( final Viewer  viewer,
final Object[]  elementsOrTreePaths 
) [static]

Removes existing elements from a viewer and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support removals.

Parameters:
viewer
elementsOrTreePaths
See also:
StructuredViewer.refresh(boolean)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.setInput ( final Viewer  viewer,
final Object  input 
) [static]

Sets a viewer's input and makes sure it runs in the SWT thread

Parameters:
viewer
input
See also:
Viewer.setInput(Object)
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.update ( final Viewer  viewer,
final Object[]  elements,
final String[]  properties 
) [static]

Updates a viewer's elements and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support updates.

Parameters:
viewer
elements
properties
See also:
StructuredViewer.update(Object[], String[])
static void de.fu_berlin.inf.dpp.ui.util.ViewerUtils.update ( final Viewer  viewer,
final Object  element,
final String[]  properties 
) [static]

Updates a viewer's element and makes sure it runs in the SWT thread. Runs a refresh in case the viewer does not support updates.

Parameters:
viewer
element
properties
See also:
StructuredViewer.update(Object, String[])
 All Classes Namespaces Files Functions Variables Enumerations