void () { String filter = getFilter(); if (filter != null && filter.length() > 0) { if (!myExpansionMonitor.isFreeze()) { myExpansionMonitor.freeze(); } } IntentionSettingsTree.this.filter(filterModel(filter, true)); if (myTree != null) { List<TreePath> expandedPaths = TreeUtil.collectExpandedPaths(myTree); ((DefaultTreeModel)myTree.getModel()).reload(); TreeUtil.restoreExpandedPaths(myTree, expandedPaths); } SwingUtilities.invokeLater(() -> { myTree.setSelectionRow(0); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(myTree, true)); }); TreeUtil.expandAll(myTree); if (filter == null || filter.length() == 0) { TreeUtil.collapseAll(myTree, 0); myExpansionMonitor.restore(); } }