* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
GraphViewer viewer = getViewer();
if (selectedConnections != null) {
for (AbstractNode node : selectedConnections) {
viewer.unReveal(node);
}
selectedConnections = null;
}
ISelection selection = event.getSelection();
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
selectedConnections = new HashSet<AbstractNode>();
for (Object o : ((IStructuredSelection) selection).toList()) {
if (o instanceof AbstractNode) {
AbstractNode node = (AbstractNode) o;
viewer.reveal(node);
selectedConnections.add(node);
/*
AbstractNode output = (AbstractNode) o;
for (AbstractNode node : output.getOutputs()) {
viewer.reveal(node);
selectedConnections.add(node);
}
*/
}
}
}
Object[] connections = viewer.getConnectionElements();
for (int i = 0; i < connections.length; i++) {
viewer.update(connections[i], null);
}
}