use of org.rstudio.core.client.MapUtil.ForEachCommand in project rstudio by rstudio.
the class AceEditorBackgroundLinkHighlighter method onDocumentChanged.
@Override
public void onDocumentChanged(DocumentChangedEvent event) {
// clear markers within the delete range
clearMarkers(event.getEvent().getRange());
// prepare highlighter
int row = event.getEvent().getRange().getStart().getRow();
nextHighlightStart_ = Math.min(nextHighlightStart_, row);
timer_.schedule(700);
// update marker positions (deferred so that anchors update)
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
final SafeMap<Integer, List<MarkerRegistration>> newMarkers = new SafeMap<Integer, List<MarkerRegistration>>();
MapUtil.forEach(activeMarkers_, new ForEachCommand<Integer, List<MarkerRegistration>>() {
@Override
public void execute(Integer oldRow, List<MarkerRegistration> markers) {
if (markers == null || markers.isEmpty())
return;
// all markers here should have same row
int newRow = markers.get(0).getRange().getStart().getRow();
newMarkers.put(newRow, markers);
}
});
activeMarkers_.clear();
activeMarkers_ = newMarkers;
}
});
}
Aggregations