void () { super.checkCanceled(); // assume checkCanceled() would be called from the correct thread long now = System.currentTimeMillis(); if (now - myLastUpdatedButtonTimestamp > 10) { enableCancelButton(!ProgressManager.getInstance().isInNonCancelableSection()); myLastUpdatedButtonTimestamp = now; } }