@Override public void propertyChanged(final VirtualFilePropertyEvent event) { if (VirtualFile.PROP_WRITABLE.equals(event.getPropertyName())) { final VirtualFile file = event.getFile(); final Document document = getCachedDocument(file); if (document == null) return; ApplicationManager.getApplication() .runWriteAction( new ExternalChangeAction() { @Override public void run() { document.setReadOnly(!event.getFile().isWritable()); } }); // myUnsavedDocuments.remove(document); //? } }