EditorTextField (Project project, final boolean shouldHaveBorder, final @Nullable Consumer<? super Editor> editorConstructionCallback) { return new EditorTextField(createDocument(project, ""), project, PlainTextLanguage.INSTANCE.getAssociatedFileType()) { @Override protected boolean shouldHaveBorder() { return shouldHaveBorder; } @Override protected void updateBorder(@NotNull EditorEx editor) { if (shouldHaveBorder) { super.updateBorder(editor); } else { editor.setBorder(null); } } @Override protected @NotNull EditorEx createEditor() { EditorEx result = super.createEditor(); if (editorConstructionCallback != null) { editorConstructionCallback.consume(result); } return result; } }; }