void (FocusEvent e) { Component opposite = e.getOppositeComponent(); if (e.isTemporary() || opposite != null && SwingUtilities.isDescendingFrom(opposite, getTopComponent())) { // Do nothing if focus moves inside top component hierarchy return; } // [vova] we need LaterInvocator here to prevent write-access assertions ApplicationManager.getApplication().invokeLater(() -> finishEditing(true), ModalityState.nonModal()); }