expand already expanded nodes after data update
This commit is contained in:
parent
fc107aa839
commit
752aecfeca
@ -10,6 +10,7 @@
|
|||||||
- Key delimiters (namespace / section) can be configured
|
- Key delimiters (namespace / section) can be configured
|
||||||
- Extract translation intention
|
- Extract translation intention
|
||||||
- Full language support for Java, Kotlin, JavaScript / TypeScript, Vue and PHP
|
- Full language support for Java, Kotlin, JavaScript / TypeScript, Vue and PHP
|
||||||
|
- Expand already expanded nodes after data update
|
||||||
- Individual icon for tool-window and lookup items
|
- Individual icon for tool-window and lookup items
|
||||||
- Dedicated configuration file (easy-i18n.xml) inside <kbd>.idea</kbd> folder
|
- Dedicated configuration file (easy-i18n.xml) inside <kbd>.idea</kbd> folder
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.tree.DefaultMutableTreeNode;
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,7 +86,21 @@ public class TreeView implements BusListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdateData(@NotNull TranslationData data) {
|
public void onUpdateData(@NotNull TranslationData data) {
|
||||||
|
List<Integer> expanded = getExpandedRows();
|
||||||
tree.setModel(this.currentMapper = new TreeModelMapper(data, ProjectSettingsService.get(project).getState()));
|
tree.setModel(this.currentMapper = new TreeModelMapper(data, ProjectSettingsService.get(project).getState()));
|
||||||
|
expanded.forEach(tree::expandRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Integer> getExpandedRows() {
|
||||||
|
List<Integer> expanded = new ArrayList<>();
|
||||||
|
|
||||||
|
for(int i = 0; i < tree.getRowCount(); i++) {
|
||||||
|
if(tree.isExpanded(i)) {
|
||||||
|
expanded.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user