Element (final VirtualFile file, @Nullable final ErrorHandler handler) { Application app = ApplicationManager.getApplication(); if (app == null || app.isDisposed()) { return null; } String text = ReadAction.compute(() -> { if (!file.isValid()) return null; try { return VfsUtilCore.loadText(file); } catch (IOException e) { if (handler != null) handler.onReadError(e); return null; } }); return text == null ? null : doRead(text, handler); }