in src/org/jetbrains/r/run/visualize/RDataFrameRowSorter.kt [87:122]
fun update() {
if (updatesSuspended) return
currentUpdateTask?.let {
if (!it.isDone) it.cancel(true)
}
val toWait = currentUpdateTask
val currentFilter = rowFilter
val currentSortKeys = sortKeys
currentUpdateTask = ApplicationManager.getApplication().executeOnPooledThread<Unit> {
try {
toWait?.getWithCheckCanceled()
if (currentViewer != initialViewer) Disposer.dispose(currentViewer)
currentViewer = initialViewer
currentFilter?.let {
currentViewer = currentViewer.filter(it)
}
if (currentSortKeys.isNotEmpty()) {
val newViewer = currentViewer.sortBy(currentSortKeys)
if (currentViewer != initialViewer) Disposer.dispose(currentViewer)
currentViewer = newViewer
}
model.viewer = currentViewer
jTable.clearSelection()
model.fireTableDataChanged()
fireRowSorterChanged(null)
} catch (e: RDataFrameException) {
if (!errorWasReported) {
errorWasReported = true
Notification("RDataFrameViewer", RBundle.message("data.frame.viewer.error.title"), e.message.orEmpty(), NotificationType.ERROR)
.notify(initialViewer.project)
}
} catch (e: CancellationException) {
} catch (e: InterruptedException) {
}
}
}