use of de.fhg.igd.mapviewer.Refresher in project hale by halestudio.
the class AbstractInstancePainter method selectionChanged.
/**
* @see ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
*/
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (!(selection instanceof InstanceSelection)) {
// only accept instance selections
return;
}
// called when the selection has changed, to update the state of the
// way-points
Refresher refresh = prepareRefresh(false);
refresh.setImageOp(new FastBlurFilter(2));
// collect instance references that are in the new selection
Set<InstanceReference> selected = collectReferences(selection);
Set<InstanceReference> toSelect = new HashSet<InstanceReference>();
toSelect.addAll(selected);
toSelect.removeAll(lastSelected);
// selection
for (InstanceReference selRef : toSelect) {
InstanceWaypoint wp = findWaypoint(selRef);
if (wp != null) {
wp.setSelected(true, refresh);
}
}
// unselect all that have previously been selected but are not in the
// new selection
lastSelected.removeAll(selected);
for (InstanceReference selRef : lastSelected) {
InstanceWaypoint wp = findWaypoint(selRef);
if (wp != null) {
wp.setSelected(false, refresh);
}
}
lastSelected = selected;
refresh.execute();
}
Aggregations