void (@NotNull Editor editor, DataContext dataContext, @Nullable Producer<? extends Transferable> producer) { final Transferable transferable = getContentsToPasteToEditor(producer); if (transferable == null) return; if (!EditorModificationUtil.checkModificationAllowed(editor)) return; if (!EditorModificationUtil.requestWriting(editor)) return; DataContext context = CustomizedDataContext.create(dataContext, dataId -> PasteAction.TRANSFERABLE_PROVIDER.is(dataId) ? (Producer<Transferable>)() -> transferable : null); final Project project = editor.getProject(); final Document document = editor.getDocument(); final PsiFile file = project == null ? null : PsiDocumentManager.getInstance(project).getPsiFile(document); if (file == null || editor.isColumnMode() || editor.getCaretModel().getCaretCount() > 1) { if (myOriginalHandler != null) { myOriginalHandler.execute(editor, null, context); } return; } DumbService.getInstance(project).runWithAlternativeResolveEnabled(() -> { document.startGuardedBlockChecking(); try { for (PasteProvider provider : EP_NAME.getExtensionList()) { if (provider.isPasteEnabled(context)) { provider.performPaste(context); return; } } doPaste(editor, project, file, document, transferable); } catch (ReadOnlyFragmentModificationException e) { EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(document).handle(e); } finally { document.stopGuardedBlockChecking(); } }); }