use of com.intellij.ide.util.treeView.TreeState in project intellij-community by JetBrains.
the class MavenProjectsNavigator method scheduleStructureRequest.
private void scheduleStructureRequest(final Runnable r) {
if (isUnitTestMode()) {
if (myStructure != null) {
r.run();
}
return;
}
if (myToolWindow == null)
return;
MavenUtil.invokeLater(myProject, () -> {
if (!myToolWindow.isVisible())
return;
boolean shouldCreate = myStructure == null;
if (shouldCreate) {
initStructure();
}
r.run();
if (shouldCreate) {
if (myState.treeState != null) {
TreeState treeState = new TreeState();
try {
treeState.readExternal(myState.treeState);
treeState.applyTo(myTree);
} catch (InvalidDataException e) {
MavenLog.LOG.info(e);
}
}
}
});
}
use of com.intellij.ide.util.treeView.TreeState in project intellij-community by JetBrains.
the class ExternalProjectsViewImpl method restoreTreeState.
private void restoreTreeState() {
if (myState.treeState != null) {
TreeState treeState = new TreeState();
try {
treeState.readExternal(myState.treeState);
treeState.applyTo(myTree);
} catch (InvalidDataException e) {
LOG.info(e);
}
}
}
use of com.intellij.ide.util.treeView.TreeState in project intellij-community by JetBrains.
the class PostfixTemplatesCheckboxTree method setState.
public void setState(@NotNull final Map<String, Set<String>> langToDisabledTemplates) {
final TreeState treeState = TreeState.createOn(this, myRoot);
Consumer<PostfixTemplateCheckedTreeNode> consumer = template -> {
Set<String> disabledTemplates = langToDisabledTemplates.get(template.getLang());
String key = template.getTemplate().getKey();
if (disabledTemplates != null && disabledTemplates.contains(key)) {
template.setChecked(false);
return;
}
template.setChecked(true);
};
visit(consumer);
myModel.nodeStructureChanged(myRoot);
treeState.applyTo(this);
TreeUtil.expandAll(this);
}
use of com.intellij.ide.util.treeView.TreeState in project intellij-community by JetBrains.
the class CommittedChangesTreeBrowser method append.
public void append(final List<CommittedChangeList> list) {
final TreeState state = myChangeLists.isEmpty() && myState != null ? myState : TreeState.createOn(myChangesTree, (DefaultMutableTreeNode) myChangesTree.getModel().getRoot());
state.setScrollToSelection(false);
myChangeLists.addAll(list);
myFilteringStrategy.appendFilterBase(list);
myChangesTree.setModel(buildTreeModel(myFilteringStrategy.filterChangeLists(myChangeLists)));
state.applyTo(myChangesTree, (DefaultMutableTreeNode) myChangesTree.getModel().getRoot());
TreeUtil.expandAll(myChangesTree);
myProject.getMessageBus().syncPublisher(ITEMS_RELOADED).itemsReloaded();
}
use of com.intellij.ide.util.treeView.TreeState in project intellij-community by JetBrains.
the class SpecificFilesViewDialog method initData.
private void initData(@NotNull final List<VirtualFile> files) {
final TreeState state = TreeState.createOn(myView, (ChangesBrowserNode) myView.getModel().getRoot());
final DefaultTreeModel model = TreeModelBuilder.buildFromVirtualFiles(myProject, myView.isShowFlatten(), files);
myView.setModel(model);
myView.expandPath(new TreePath(((ChangesBrowserNode) model.getRoot()).getPath()));
state.applyTo(myView);
}
Aggregations