DocumentsDlg.java 文件源码

java
阅读 24 收藏 0 点赞 0 评论 0

项目:incubator-netbeans 作者:
private void updateNodes() {
    //Create nodes for TopComponents, sort them using their own comparator
    List<TopComponent> tcList = getOpenedDocuments();
    TopComponent activeTC = TopComponent.getRegistry().getActivated();
    TopComponentNode[] tcNodes = new TopComponentNode[tcList.size()];
    TopComponentNode toSelect = null;
    for (int i = 0; i < tcNodes.length; i++) {
        TopComponent tc = tcList.get(i);
        tcNodes[i] = new TopComponentNode(tc);
        if( tc == activeTC ) {
            toSelect = tcNodes[i];
        }
    }
    if( radioOrderByName.isSelected() ) {
        Arrays.sort(tcNodes);
    }

    Children.Array nodeArray = new Children.Array();
    nodeArray.add(tcNodes);
    Node root = new AbstractNode(nodeArray);
    explorer.setRootContext(root);
    // set focus to documents list
    listView.requestFocus();
    // select the active editor tab or the first item if possible
    if (tcNodes.length > 0) {
        try {
            if( null == toSelect ) 
                toSelect = tcNodes[0];
            explorer.setSelectedNodes(new Node[] {toSelect} );
        } catch (PropertyVetoException exc) {
            // do nothing, what should I do?
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号