void () { if (myLastTask != null) { myLastTask.cancel(false); } if (myVcs.getProject().isDisposed()) { return; } myUpdateAlarm.cancelAllRequests(); if (myUpdateAlarm.isDisposed()) return; schedule(); if (!ApplicationManager.getApplication().isActive()) return; myLastTask = ourExecutor.submit(() -> { if (!myUpdateAlarm.isDisposed() && mySessionPartner.shouldBeRefreshed()) { ApplicationManager.getApplication().invokeLater(() -> refresh(true)); } }); }