void (Runnable handler) { JComponent component = getEditorComponent(); if (component instanceof EditorTextField) { ((EditorTextField)component).addSettingsProvider(editor -> { editor.getContentComponent().putClientProperty(Expandable.class, new Expandable() { @Override public void expand() { } @Override public void collapse() { handler.run(); } @Override public boolean isExpanded() { return true; } }); addCollapseButton(editor, handler); }); } }