void (final Document document) { document.addDocumentListener(new DocumentListener() { @Override public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) { doApply(); } }); }