当前位置: 首页>>代码示例>>Java>>正文


Java AbstractProjectViewPane.getTree方法代码示例

本文整理汇总了Java中com.intellij.ide.projectView.impl.AbstractProjectViewPane.getTree方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractProjectViewPane.getTree方法的具体用法?Java AbstractProjectViewPane.getTree怎么用?Java AbstractProjectViewPane.getTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.projectView.impl.AbstractProjectViewPane的用法示例。


在下文中一共展示了AbstractProjectViewPane.getTree方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadContext

import com.intellij.ide.projectView.impl.AbstractProjectViewPane; //导入方法依赖的package包/类
public void loadContext(Element fromElement) throws InvalidDataException {
  for (AbstractProjectViewPane pane : myPanes) {
    Element paneElement = fromElement.getChild(pane.getId());
    if (paneElement != null) {
      pane.readExternal(paneElement);
      if (pane.getTree() != null) {
        pane.restoreExpandedPaths();
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ProjectViewContextProvider.java

示例2: clearContext

import com.intellij.ide.projectView.impl.AbstractProjectViewPane; //导入方法依赖的package包/类
public void clearContext() {
  for (AbstractProjectViewPane pane : myPanes) {
    JTree tree = pane.getTree();
    if (tree != null) {
      TreeUtil.collapseAll(tree, -1);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ProjectViewContextProvider.java

示例3: selectProjectSchemaInTree

import com.intellij.ide.projectView.impl.AbstractProjectViewPane; //导入方法依赖的package包/类
private void selectProjectSchemaInTree(@NotNull FileEditorManagerEvent event) {
    if(!isProjectSchemaFile(event.getNewFile())) {
        return;
    }
    try {
        JSGraphQLSchemaFileNode node = project.getUserData(JSGraphQLSchemaFileNode.GRAPHQL_SCHEMA_TREE_NODE);
        if(node != null) {
            final ProjectView projectView = ProjectView.getInstance(project);
            if(projectView.isAutoscrollFromSource(projectView.getCurrentViewId())) {
                final AbstractProjectViewPane projectViewPane = projectView.getCurrentProjectViewPane();
                if(projectViewPane != null) {
                    if(projectViewPane.getSelectedDescriptor() != node) {
                        final JTree tree = projectViewPane.getTree();
                        final TreeNode root = (TreeNode) tree.getModel().getRoot();
                        if(root != null) {
                            for(int c = 0; c < root.getChildCount(); c++) {
                                final TreeNode schemaDirectory = root.getChildAt(c);
                                if(schemaDirectory instanceof DefaultMutableTreeNode) {
                                    final Object userObject = ((DefaultMutableTreeNode) schemaDirectory).getUserObject();
                                    if(userObject instanceof JSGraphQLSchemaDirectoryNode) {
                                        if(schemaDirectory.getChildCount() == 1) {
                                            final TreeNode schemaNode = schemaDirectory.getChildAt(0);
                                            final TreePath treePath = new TreePath(
                                                    new Object[]{root, schemaDirectory, schemaNode}
                                            );
                                            TreeModelListener treeModelListener = project.getUserData(SCHEMA_TREE_MODEL_LISTENER);
                                            if(treeModelListener == null) {
                                                treeModelListener = new TreeModelListener() {
                                                    @Override
                                                    public void treeNodesInserted(TreeModelEvent treeModelEvent) {
                                                        // idea uses "Loading..." nodes, so listen for inserts
                                                        if(Boolean.TRUE.equals(project.getUserData(SCHEMA_TREE_SELECT_ON_INSERT))) {
                                                            if(treeModelEvent.getChildren() != null) {
                                                                Object child = treeModelEvent.getChildren()[0];
                                                                if(child instanceof DefaultMutableTreeNode) {
                                                                    final DefaultMutableTreeNode insertedNode = (DefaultMutableTreeNode) child;
                                                                    if(insertedNode.getUserObject() instanceof JSGraphQLSchemaFileNode) {
                                                                        final TreePath insertTreePath = new TreePath(insertedNode.getPath());
                                                                        tree.setSelectionPath(insertTreePath);
                                                                        tree.scrollPathToVisible(insertTreePath);
                                                                        project.putUserData(SCHEMA_TREE_SELECT_ON_INSERT, false);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    @Override
                                                    public void treeNodesChanged(TreeModelEvent treeModelEvent) {}
                                                    @Override
                                                    public void treeNodesRemoved(TreeModelEvent treeModelEvent) {}
                                                    @Override
                                                    public void treeStructureChanged(TreeModelEvent treeModelEvent) {}
                                                };
                                                tree.getModel().addTreeModelListener(treeModelListener);
                                                project.putUserData(SCHEMA_TREE_MODEL_LISTENER, treeModelListener);
                                            }
                                            tree.expandPath(treePath);
                                            tree.setSelectionPath(treePath);
                                            tree.scrollPathToVisible(treePath);
                                            project.putUserData(SCHEMA_TREE_SELECT_ON_INSERT, schemaNode instanceof LoadingNode);
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                    }
                }
            }
        }
    } catch (Exception e) {
        log.warn("Unable to select GraphQL schema node", e);
    }
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:76,代码来源:JSGraphQLSchemaLanguageProjectService.java


注:本文中的com.intellij.ide.projectView.impl.AbstractProjectViewPane.getTree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。