Search in sources :

Example 1 with Refresher

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();
}
Also used : Refresher(de.fhg.igd.mapviewer.Refresher) PseudoInstanceReference(eu.esdihumboldt.hale.common.instance.model.impl.PseudoInstanceReference) InstanceReference(eu.esdihumboldt.hale.common.instance.model.InstanceReference) InstanceSelection(eu.esdihumboldt.hale.ui.selection.InstanceSelection) DefaultInstanceSelection(eu.esdihumboldt.hale.ui.selection.impl.DefaultInstanceSelection) FastBlurFilter(org.jdesktop.swingx.image.FastBlurFilter) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

Refresher (de.fhg.igd.mapviewer.Refresher)1 InstanceReference (eu.esdihumboldt.hale.common.instance.model.InstanceReference)1 PseudoInstanceReference (eu.esdihumboldt.hale.common.instance.model.impl.PseudoInstanceReference)1 InstanceSelection (eu.esdihumboldt.hale.ui.selection.InstanceSelection)1 DefaultInstanceSelection (eu.esdihumboldt.hale.ui.selection.impl.DefaultInstanceSelection)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 FastBlurFilter (org.jdesktop.swingx.image.FastBlurFilter)1