void (Update @NotNull [] updates) { final ReadTask task = new ReadTask() { final Set<EventWithType> myEvents = myEventQueue.getAndSet(ConcurrentCollectionFactory.createConcurrentSet()); @Nullable @Override public Continuation performInReadAction(@NotNull ProgressIndicator indicator) throws ProcessCanceledException { if (!myEditor.isValid()) return null; Runnable toDo = null; NotNullLazyValue<Set<VirtualFile>> resourceBundleAsSet = NotNullLazyValue.lazy(() -> { return myEditor.getResourceBundle().getPropertiesFiles().stream().map(PropertiesFile::getVirtualFile) .collect(Collectors.toSet()); }); for (EventWithType e : myEvents) { if (e.getType() == EventType.FILE_DELETED || (e.getType() == EventType.PROPERTY_CHANGED && e.getPropertyName().equals(VirtualFile.PROP_NAME))) { if (myEditor.getTranslationEditors().containsKey(e.getFile())) { int validFilesCount = 0; ResourceBundle bundle = myEditor.getResourceBundle(); if (bundle.isValid()) { for (PropertiesFile file : bundle.getPropertiesFiles()) { if (file.getContainingFile().isValid()) { validFilesCount ++; } if (validFilesCount == 2) { break; } } } if (validFilesCount > 1) { toDo = myEditor::recreateEditorsPanel; } else { toDo = () -> { FileEditorManager.getInstance(myProject).closeFile(myEditor.getFile()); }; } break; } else if (resourceBundleAsSet.getValue().contains(e.getFile())) { //new file in bundle toDo = myEditor::recreateEditorsPanel; break; } } else if (e.getType() == EventType.FILE_CREATED) { if (resourceBundleAsSet.getValue().contains(e.getFile())) { toDo = myEditor::recreateEditorsPanel; break; } } else if (e.getType() == EventType.PROPERTY_CHANGED && e.getPropertyName().equals(VirtualFile.PROP_WRITABLE)) { if (myEditor.getTranslationEditors().containsKey(e.getFile())) { if (toDo == null) { toDo = new SetViewerPropertyRunnable(); } if (toDo instanceof SetViewerPropertyRunnable) { ((SetViewerPropertyRunnable)toDo).addFile(e.getFile(), !(boolean)e.getPropertyNewValue()); } else { toDo = myEditor::recreateEditorsPanel; break; } } } else { if (myEditor.getTranslationEditors().containsKey(e.getFile())) { if ((toDo instanceof SetViewerPropertyRunnable)) { toDo = myEditor::recreateEditorsPanel; break; } else if (toDo == null) { toDo = () -> myEditor.updateEditorsFromProperties(true); } } } } if (toDo == null) { return null; } else { Runnable toDoCopy = toDo; return new Continuation(() -> { if (myEditor.isValid()) { toDoCopy.run(); } }, ModalityState.nonModal()); } } @Override public void onCanceled(@NotNull ProgressIndicator indicator) { myEventQueue.updateAndGet(s -> { s.addAll(myEvents); return s; }); myUpdateQueue.queue(FORCE_UPDATE); } }; ProgressIndicatorUtils.scheduleWithWriteActionPriority(task); }