Collection<VirtualFile> () { Collection<VirtualFile> readOnlyFiles = new ArrayList<>(); for (UndoableAction action : myUndoableGroup.getActions()) { if (action instanceof MentionOnlyUndoableAction) continue; DocumentReference[] refs = action.getAffectedDocuments(); if (refs == null) continue; for (DocumentReference ref : refs) { VirtualFile file = ref.getFile(); if ((file != null) && file.isValid() && !file.isWritable()) { readOnlyFiles.add(file); } } } return readOnlyFiles; }