void (final Runnable listener) { from.getDocument().addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) { listener.run(); } }); }