public static void flushWindows(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
   for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
     String name = entry.getKey();
     TaskFile taskFile = entry.getValue();
     VirtualFile virtualFile = taskDir.findChild(name);
     if (virtualFile == null) {
       continue;
     }
     EduUtils.flushWindows(taskFile, virtualFile);
   }
 }
 public void switchSubtask(@NotNull Document document, int fromSubtask, int toSubtask) {
   Set<Integer> indexes = mySubtaskInfos.keySet();
   int visibleLength = getVisibleLength(fromSubtask);
   if (indexes.contains(toSubtask)) {
     if (!myUseLength) {
       String replacementText = mySubtaskInfos.get(toSubtask).getPossibleAnswer();
       EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, replacementText);
       return;
     }
   }
   Integer minIndex = Collections.min(indexes);
   if (fromSubtask < toSubtask) {
     if (minIndex > fromSubtask && minIndex <= toSubtask) {
       Integer maxIndex =
           Collections.max(ContainerUtil.filter(indexes, integer -> integer <= toSubtask));
       AnswerPlaceholderSubtaskInfo maxInfo = mySubtaskInfos.get(maxIndex);
       String replacementText =
           myUseLength ? maxInfo.getPlaceholderText() : maxInfo.getPossibleAnswer();
       EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, replacementText);
       return;
     }
   }
   if (fromSubtask > toSubtask) {
     if (minIndex > toSubtask && minIndex <= fromSubtask) {
       AnswerPlaceholderSubtaskInfo minInfo = mySubtaskInfos.get(minIndex);
       if (minInfo.isNeedInsertText()) {
         EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, "");
       } else {
         String replacementText = minInfo.getPlaceholderText();
         EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, replacementText);
       }
       return;
     }
     if (indexes.contains(fromSubtask)) {
       List<Integer> filtered = ContainerUtil.filter(indexes, index -> index < fromSubtask);
       if (filtered.isEmpty()) {
         return;
       }
       Integer maxIndex = Collections.max(filtered);
       AnswerPlaceholderSubtaskInfo maxInfo = mySubtaskInfos.get(maxIndex);
       if (maxInfo.isNeedInsertText()) {
         EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, "");
       } else {
         String replacementText =
             myUseLength ? maxInfo.getPlaceholderText() : maxInfo.getPossibleAnswer();
         EduUtils.replaceAnswerPlaceholder(document, this, visibleLength, replacementText);
       }
     }
   }
 }