OperationStatus (@NotNull Collection<? extends VirtualFile> originalFiles) { if (originalFiles.isEmpty()) { return new OperationStatusImpl(VirtualFile.EMPTY_ARRAY); } checkThreading(); Set<VirtualFile> realFiles = new HashSet<>(originalFiles.size()); for (VirtualFile file : originalFiles) { if (file instanceof LightVirtualFile) { VirtualFile originalFile = ((LightVirtualFile)file).getOriginalFile(); if (originalFile != null) { file = originalFile; } } if (file instanceof VirtualFileWindow) { file = ((VirtualFileWindow)file).getDelegate(); } if (file instanceof BackedVirtualFile) { file = ((BackedVirtualFile)file).getOriginFile(); } if (file != null) { realFiles.add(file); } } Collection<? extends VirtualFile> files = new ArrayList<>(realFiles); if (!myProject.isDefault()) { OperationStatusImpl status = WritingAccessProvider.EP.computeSafeIfAny(myProject, provider -> { Collection<VirtualFile> denied = ContainerUtil.filter(files, virtualFile -> !provider.isPotentiallyWritable(virtualFile)); if (denied.isEmpty()) { denied = provider.requestWriting(files); } if (!denied.isEmpty()) { return new OperationStatusImpl(VfsUtilCore.toVirtualFileArray(denied), provider.getReadOnlyMessage(), provider.getHyperlinkListener()); } return null; }); if (status != null) { return status; } } return ensureFilesWritable(originalFiles, files); }