public static void setCancelationChecker(Runnable checker) {
    cancelationChecker = checker;
  }
Sets the logic for checking cancelation. To cancel decompilation, call {@linkplain #cancel()} inside the checker.
src/org/jetbrains/java/decompiler/main/decompiler/CancelationManager.java