Search in sources :

Example 1 with InvokerSupplier

use of com.intellij.util.concurrency.InvokerSupplier in project consulo by consulo.

the class AbstractProjectViewPane method createTreeExpander.

@Nonnull
protected TreeExpander createTreeExpander() {
    return new DefaultTreeExpander(this::getTree) {

        private boolean isExpandAllAllowed() {
            JTree tree = getTree();
            TreeModel model = tree == null ? null : tree.getModel();
            return model == null || model instanceof AsyncTreeModel || model instanceof InvokerSupplier;
        }

        @Override
        public boolean isExpandAllVisible() {
            // && Registry.is("ide.project.view.expand.all.action.visible", true);
            return isExpandAllAllowed();
        }

        @Override
        public boolean canExpand() {
            return isExpandAllAllowed() && super.canExpand();
        }

        @Override
        protected void collapseAll(@Nonnull JTree tree, boolean strict, int keepSelectionLevel) {
            super.collapseAll(tree, false, keepSelectionLevel);
        }
    };
}
Also used : TreeModel(javax.swing.tree.TreeModel) AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) Nonnull(javax.annotation.Nonnull) AsyncTreeModel(com.intellij.ui.tree.AsyncTreeModel) InvokerSupplier(com.intellij.util.concurrency.InvokerSupplier) Nonnull(javax.annotation.Nonnull)

Aggregations

AsyncTreeModel (com.intellij.ui.tree.AsyncTreeModel)1 InvokerSupplier (com.intellij.util.concurrency.InvokerSupplier)1 Nonnull (javax.annotation.Nonnull)1 TreeModel (javax.swing.tree.TreeModel)1