in projectional/src/main/java/jetbrains/jetpad/projectional/cell/ProjectionalObservableListSynchronizer.java [153:231]
private void keyPressedInChild(KeyEvent event) {
new CollectionEditor<SourceItemT, Cell>(mySource, getChildCells(), getForDeletion(), canCreateNewItem(),
replaceWithNewOnDelete(), myNumAllowedEmptyLines, mySplitJoinHandler) {
@Override
protected SourceItemT newItem() {
return ProjectionalObservableListSynchronizer.this.newItem();
}
@Override
protected boolean isEmpty(Cell item) {
return Cells.isEmpty(item);
}
@Override
protected boolean isHome(Cell item) {
return Positions.isHomePosition(item);
}
@Override
protected boolean isEnd(Cell item) {
return Positions.isEndPosition(item);
}
@Override
protected void selectOnCreation(int index) {
ProjectionalObservableListSynchronizer.this.selectOnCreation(index).run();
}
@Override
protected void selectHome(int index) {
CellActions.toFirstFocusable(getChildCells().get(index)).run();
}
@Override
protected void selectEnd(int index) {
CellActions.toLastFocusable(getChildCells().get(index)).run();
}
@Override
protected void selectPlaceholder() {
getOnLastItemDeleted().run();
}
@Override
protected boolean addAfterParent() {
Cell current = getTarget();
Cell nextVisible = nextCell(current);
while (current != null && nextCell(current) == nextVisible) {
final ItemHandler handler = current.get(ITEM_HANDLER);
if (handler != null) {
handler.addEmptyAfter().run();
return true;
}
current = current.getParent();
}
return false;
}
private boolean isIgnored(Cell cell) {
if (cell.get(ProjectionalSynchronizers.IGNORED_ON_BOUNDARY)) {
return true;
}
if (cell.getParent() != null) {
return isIgnored(cell.getParent());
}
return false;
}
private Cell nextCell(Cell root) {
for (Cell c : Composites.nextNavOrder(root)) {
if (Composites.isVisible(c) && !isIgnored(c)) return c;
}
return null;
}
}.handleKey(currentCell(), event);
}