Search in sources :

Example 1 with TreeBuilderBase

use of com.intellij.remoteServer.impl.runtime.ui.tree.TreeBuilderBase in project intellij-community by JetBrains.

the class ServersToolWindowContent method setupBuilder.

private void setupBuilder(@NotNull final Project project) {
    ServersTreeStructure structure = myContribution.createTreeStructure(project, this);
    myBuilder = new TreeBuilderBase(myTree, structure, myTreeModel) {

        @Override
        protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
            return (nodeDescriptor instanceof ServersTreeStructure.RemoteServerNode || nodeDescriptor instanceof ServersTreeStructure.DeploymentNodeImpl) && (!myCollapsedTreeNodeValues.contains(((AbstractTreeNode) nodeDescriptor).getValue()));
        }
    };
    Disposer.register(this, myBuilder);
    project.getMessageBus().connect().subscribe(ServerConnectionListener.TOPIC, new ServerConnectionListener() {

        @Override
        public void onConnectionCreated(@NotNull ServerConnection<?> connection) {
            getBuilder().queueUpdate();
        }

        @Override
        public void onConnectionStatusChanged(@NotNull ServerConnection<?> connection) {
            getBuilder().queueUpdate();
            updateSelectedServerDetails();
            if (connection.getStatus() == ConnectionStatus.CONNECTED) {
                pollDeployments(connection);
            }
        }

        @Override
        public void onDeploymentsChanged(@NotNull ServerConnection<?> connection) {
            getBuilder().queueUpdate();
            updateSelectedServerDetails();
        }
    });
}
Also used : ServersTreeStructure(com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeStructure) ServerConnectionListener(com.intellij.remoteServer.runtime.ServerConnectionListener) NodeDescriptor(com.intellij.ide.util.treeView.NodeDescriptor) TreeBuilderBase(com.intellij.remoteServer.impl.runtime.ui.tree.TreeBuilderBase)

Aggregations

NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)1 ServersTreeStructure (com.intellij.remoteServer.impl.runtime.ui.tree.ServersTreeStructure)1 TreeBuilderBase (com.intellij.remoteServer.impl.runtime.ui.tree.TreeBuilderBase)1 ServerConnectionListener (com.intellij.remoteServer.runtime.ServerConnectionListener)1