Content (@NotNull EditorTextField field, @NotNull Function<? super String, String> onShow) { EditorTextField popup = createPopupEditor(field, onShow.fun(field.getText())); Color background = field.getBackground(); popup.setBackground(background); popup.setOneLineMode(false); popup.setPreferredSize(new Dimension(field.getWidth(), 5 * field.getHeight())); popup.addSettingsProvider(editor -> { initPopupEditor(editor, background); copyCaretPosition(editor, field.getEditor(), onShow); }); return new Content() { @Override public @NotNull JComponent getContentComponent() { return popup; } @Override public JComponent getFocusableComponent() { return popup; } @Override public void cancel(@NotNull Function<? super String, String> onHide) { field.setText(onHide.fun(popup.getText())); Editor editor = field.getEditor(); if (editor != null) copyCaretPosition(editor, popup.getEditor(), onHide); if (editor instanceof EditorEx) updateFieldFolding((EditorEx)editor); } }; }