void (@NotNull AnActionEvent e) { String title = getTitle(); final ContentChooser<String> chooser = new ContentChooser<>(myConsole.getProject(), title, true, true) { { setOKButtonText(ActionsBundle.actionText(IdeActions.ACTION_EDITOR_PASTE)); setOKButtonMnemonic(P); setCancelButtonText(CommonBundle.getCloseButtonText()); setUseNumbering(false); } @Override protected void removeContentAt(String content) { getModel().removeFromHistory(content); } @Override protected String getStringRepresentationFor(String content) { return content; } @NotNull @Override protected List<String> getContents() { return getModel().getEntries(); } @Override protected Editor createIdeaEditor(String text) { PsiFile consoleFile = myConsole.getFile(); Language language = consoleFile.getLanguage(); Project project = consoleFile.getProject(); PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText( "a." + consoleFile.getFileType().getDefaultExtension(), language, StringUtil.convertLineSeparators(text), false, true); VirtualFile virtualFile = psiFile.getViewProvider().getVirtualFile(); if (virtualFile instanceof LightVirtualFile) ((LightVirtualFile)virtualFile).setWritable(false); Document document = Objects.requireNonNull(FileDocumentManager.getInstance().getDocument(virtualFile)); EditorFactory editorFactory = EditorFactory.getInstance(); EditorEx editor = (EditorEx)editorFactory.createViewer(document, project); editor.getSettings().setFoldingOutlineShown(false); editor.getSettings().setLineMarkerAreaShown(false); editor.getSettings().setIndentGuidesShown(false); SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(language, project, psiFile.getViewProvider().getVirtualFile()); editor.setHighlighter(new LexerEditorHighlighter(highlighter, editor.getColorsScheme())); return editor; } }; chooser.setContentIcon(null); chooser.setSplitterOrientation(false); chooser.setSelectedIndex(Math.max(0, getModel().getHistorySize() - 1)); if (chooser.showAndGet() && myConsole.getCurrentEditor().getComponent().isShowing()) { setConsoleText(new Entry(chooser.getSelectedText(), -1), false, true); } }