void (ActionEvent e) { JTable table = (JTable)e.getSource(); if (!table.hasFocus()) { CellEditor cellEditor = table.getCellEditor(); if (cellEditor != null && !cellEditor.stopCellEditing()) { return; } IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(table, true)); return; } ListSelectionModel rsm = table.getSelectionModel(); int anchorRow = rsm.getAnchorSelectionIndex(); ListSelectionModel csm = table.getColumnModel().getSelectionModel(); int anchorColumn = csm.getAnchorSelectionIndex(); table.editCellAt(anchorRow, anchorColumn, e); Component editorComp = table.getEditorComponent(); if (editorComp != null) { editorComp.addKeyListener(myAdapter); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(editorComp, true)); } }