public class SelectionSynchronizer extends java.lang.Object implements ISelectionChangedListener
convert(EditPartViewer, EditPart) method.| Constructor and Description |
|---|
SelectionSynchronizer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addViewer(EditPartViewer viewer)
Adds a viewer to the set of synchronized viewers
|
protected void |
applySelection(EditPartViewer viewer,
ISelection selection)
Applies the given EditPart selection from another viewer to the given
viewer.
|
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.
|
protected void |
syncSelection(EditPartViewer selectionSource,
ISelection selection)
Synchronizes the given selection to all registered viewers except the one
serving as selectionSource, by delegating to
applySelection(EditPartViewer, ISelection). |
public void addViewer(EditPartViewer viewer)
viewer - the viewerprotected EditPart convert(EditPartViewer viewer, EditPart part)
null if there is no corresponding part. This
method can be overridden to provide custom mapping.viewer - the viewer being mapped topart - a part from another viewernull or a corresponding editpartpublic void removeViewer(EditPartViewer viewer)
viewer - the viewer to removepublic void selectionChanged(SelectionChangedEvent event)
selectionChanged in interface ISelectionChangedListenerevent - the selection eventprotected void syncSelection(EditPartViewer selectionSource, ISelection selection)
applySelection(EditPartViewer, ISelection).selectionSource - The viewer from which the selection originated.selection - The selection to apply to the other viewers.public void setEnabled(boolean value)
value - true if synchronization should occurprotected void applySelection(EditPartViewer viewer, ISelection selection)
EditParts for
the given viewer by searching those that control the same model elements
as the EditParts in the given selection (via
convert(EditPartViewer, EditPart)), apply this new selection to
the given viewer, and reveal the last part in the new selection.viewer - The viewer to apply the given selection to.selection - The selection to apply, which has to be an
IStructuredSelection of EditParts of another
viewer.Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.