Eclipse GEF 3.3

## org.eclipse.gef.ui.parts
Class SelectionSynchronizer

    java.lang.Object
      org.eclipse.gef.ui.parts.SelectionSynchronizer

All Implemented Interfaces:
  ISelectionChangedListener

public class SelectionSynchronizer
extends java.lang.Object
implements ISelectionChangedListener

A utility for synchronizing the selection of multiple EditPartViewers. This class performs selection synchronization by taking the selection from one viewer, and mapping it to the selection in another viewer. The mapping is performed by matching the models of the selected EditParts from one viewer to the EditParts with the same models in another. The can be customized by overriding the `convert(EditPartViewer, EditPart)` method.

Constructor Summary
`SelectionSynchronizer()`

Method Summary
`void` `addViewer(EditPartViewer viewer)` Adds a viewer to the set of synchronized viewers
`protected EditPart` `convert(EditPartViewer viewer, EditPart part)` Maps the given editpart from one viewer to an editpart in another viewer.
`void` `removeViewer(EditPartViewer viewer)` Removes the viewer from the set of synchronized viewers
`void` `selectionChanged(SelectionChangedEvent event)` Receives notification from one viewer, and maps selection to all other members.
`void` `setEnabled(boolean value)` Enables or disabled synchronization between viewers.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SelectionSynchronizer

    public SelectionSynchronizer()

Method Detail

### addViewer

    public void addViewer(EditPartViewer viewer)

  Adds a viewer to the set of synchronized viewers

  Parameters:
    `viewer` - the viewer

### convert

    protected EditPart convert(EditPartViewer viewer,
                               EditPart part)

  Maps the given editpart from one viewer to an editpart in another viewer. It returns `null` if there is no corresponding part. This method can be overridden to provide custom mapping.

  Parameters:
    `viewer` - the viewer being mapped to
    `part` - a part from another viewer
  Returns:
    `null` or a corresponding editpart

### removeViewer

    public void removeViewer(EditPartViewer viewer)

  Removes the viewer from the set of synchronized viewers

  Parameters:
    `viewer` - the viewer to remove

### selectionChanged

    public void selectionChanged(SelectionChangedEvent event)

  Receives notification from one viewer, and maps selection to all other members.

  Specified by:
    `selectionChanged` in interface `ISelectionChangedListener`
  Parameters:
    `event` - the selection event

### setEnabled

    public void setEnabled(boolean value)

  Enables or disabled synchronization between viewers.

  Parameters:
    `value` - `true` if synchronization should occur
  Since:
    3.1

Eclipse GEF 3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.