diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a8d4ed..16643d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ # easy-i18n Changelog ## [Unreleased] +### Fixed +- Key focus within tree or table view after translation change + ### Changed - update Qodana to latest version diff --git a/src/main/java/de/marhali/easyi18n/tabs/TableView.java b/src/main/java/de/marhali/easyi18n/tabs/TableView.java index 340d3a5..3ffd338 100644 --- a/src/main/java/de/marhali/easyi18n/tabs/TableView.java +++ b/src/main/java/de/marhali/easyi18n/tabs/TableView.java @@ -90,8 +90,8 @@ public class TableView implements BusListener { } if (row > -1) { // Matched @key - table.scrollRectToVisible( - new Rectangle(0, (row * table.getRowHeight()) + table.getHeight(), 0, 0)); + table.getSelectionModel().setSelectionInterval(row, row); + table.scrollRectToVisible(new Rectangle(table.getCellRect(row, 0, true))); } } diff --git a/src/main/java/de/marhali/easyi18n/tabs/TreeView.java b/src/main/java/de/marhali/easyi18n/tabs/TreeView.java index aeda7c1..b351ac8 100644 --- a/src/main/java/de/marhali/easyi18n/tabs/TreeView.java +++ b/src/main/java/de/marhali/easyi18n/tabs/TreeView.java @@ -88,6 +88,8 @@ public class TreeView implements BusListener { public void onFocusKey(@Nullable String key) { if(key != null && currentMapper != null) { TreePath path = currentMapper.findTreePath(key); + + this.tree.getSelectionModel().setSelectionPath(path); this.tree.scrollPathToVisible(path); if(this.tree.isCollapsed(path)) {