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


Java Tree.setRootVisible方法代码示例

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


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

示例1: createTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private static Tree createTree(TreeModel treeModel) {
  final Tree tree = new Tree(treeModel);

  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.setDragEnabled(false);
  tree.setEditable(false);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);


  final TreeSpeedSearch speedSearch = new TreeSpeedSearch(
    tree,
    new Convertor<TreePath, String>() {
      public String convert(TreePath object) {
        final Object userObject = ((DefaultMutableTreeNode)object.getLastPathComponent()).getUserObject();
        return (userObject instanceof Configuration) ? ((Configuration)userObject).getName() : userObject.toString();
      }
    }
  );
  tree.setCellRenderer(new ExistingTemplatesTreeCellRenderer(speedSearch));

  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExistingTemplatesComponent.java

示例2: MyUI

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public MyUI() {
  myStructureTree = new Tree();
  myStructureTree.setRootVisible(false);
  myStructureTree.setShowsRootHandles(true);
  myStructureTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(final TreeSelectionEvent e) {
      final List<FilePath> filePaths = new ArrayList<FilePath>(mySelection);

      mySelection.clear();
      final TreePath[] selectionPaths = myStructureTree.getSelectionPaths();
      if (selectionPaths != null) {
        for (TreePath selectionPath : selectionPaths) {
          Collections.addAll(mySelection, ((ChangesBrowserNode)selectionPath.getLastPathComponent()).getFilePathsUnder());
        }
      }

      if (Comparing.haveEqualElements(filePaths, mySelection)) return;

      for (ChangeListener listener : myListeners) {
        listener.stateChanged(new ChangeEvent(this));
      }
    }
  });
  myScrollPane = ScrollPaneFactory.createScrollPane(myStructureTree);
  myBuilder = new TreeModelBuilder(myProject, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:StructureFilteringStrategy.java

示例3: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private static void initTree(Tree tree, boolean isRightTree) {
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.setCellRenderer(new MyTreeCellRenderer());
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(tree);

  TreeUtil.installActions(tree);
  new TreeSpeedSearch(tree, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      return o.getLastPathComponent().toString();
    }
  }, true);
  PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(isRightTree, tree), ActionManager.getInstance());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModulesDependenciesPanel.java

示例4: ContentEntryTreeEditor

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public ContentEntryTreeEditor(Project project, List<ModuleSourceRootEditHandler<?>> editHandlers) {
  myProject = project;
  myEditHandlers = editHandlers;
  myTree = new Tree();
  myTree.setRootVisible(true);
  myTree.setShowsRootHandles(true);

  myEditingActionsGroup = new DefaultActionGroup();

  TreeUtil.installActions(myTree);
  new TreeSpeedSearch(myTree);

  myTreePanel = new MyPanel(new BorderLayout());
  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
  myTreePanel.add(scrollPane, BorderLayout.CENTER);

  myTreePanel.setVisible(false);
  myDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor();
  myDescriptor.setShowFileSystemRoots(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ContentEntryTreeEditor.java

示例5: DisposerTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private DisposerTree(Disposable parent) {
  myModificationToFilter = -1;

  final DisposerStructure structure = new DisposerStructure(this);
  final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode());
  final Tree tree = new Tree(model);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myTreeBuilder = new FilteringTreeBuilder(tree, DisposerTree.this, structure, AlphaComparator.INSTANCE) {
    @Override
    public boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
      return structure.getRootElement() == getOriginalNode(nodeDescriptor);
    }
  };
  myTreeBuilder.setFilteringMerge(200, MergingUpdateQueue.ANY_COMPONENT);
  Disposer.register(this, myTreeBuilder);
  myTree = tree;

  setLayout(new BorderLayout());
  add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER);

  Disposer.getTree().addListener(this);

  Disposer.register(parent, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DisposerDebugger.java

示例6: FileTemplateTabAsTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected FileTemplateTabAsTree(String title) {
  super(title);
  myRoot = initModel();
  MyTreeModel treeModel = new MyTreeModel(myRoot);
  myTree = new Tree(treeModel);
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(myTree);

  myTree.expandPath(TreeUtil.getPathFromRoot(myRoot));
  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myTree.setCellRenderer(new MyTreeCellRenderer());
  myTree.expandRow(0);

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      onTemplateSelected();
    }
  });
  new TreeSpeedSearch(myTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FileTemplateTabAsTree.java

示例7: DirectoryChooserModuleTreeView

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public DirectoryChooserModuleTreeView(@NotNull Project project) {
  myRootNode = new DefaultMutableTreeNode();
  myTree = new Tree(myRootNode);
  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  myProject = project;
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  myTree.setCellRenderer(new MyTreeCellRenderer());
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath o) {
      final Object userObject = ((DefaultMutableTreeNode)o.getLastPathComponent()).getUserObject();
      if (userObject instanceof Module) {
        return ((Module)userObject).getName();
      }
      else {
        if (userObject == null) return "";
        return userObject.toString();
      }
    }
  }, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DirectoryChooserModuleTreeView.java

示例8: createComponent

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void createComponent() {
  setLayout(new BorderLayout());
  myRepositoryTree = new Tree();
  myRepositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myRepositoryTree.setRootVisible(false);
  myRepositoryTree.setShowsRootHandles(true);
  JScrollPane scrollPane =
    ScrollPaneFactory.createScrollPane(myRepositoryTree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  add(scrollPane, BorderLayout.CENTER);
  myRepositoryTree.setCellRenderer(new SvnRepositoryTreeCellRenderer());
  TreeSpeedSearch search = new TreeSpeedSearch(myRepositoryTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      Object component = o.getLastPathComponent();
      if (component instanceof RepositoryTreeNode) {
        return ((RepositoryTreeNode)component).getURL().toDecodedString();
      }
      return null;
    }
  });
  search.setComparator(new SpeedSearchComparator(false, true));

  EditSourceOnDoubleClickHandler.install(myRepositoryTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryBrowserComponent.java

示例9: initUI

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void initUI() {
  myComponent = new JPanel(new BorderLayout());
  mySplitter = new JBSplitter("AssociationsEditor.dividerProportion", 0.3f);
  myComponent.add(mySplitter, BorderLayout.CENTER);

  JPanel leftPanel = new JPanel(new BorderLayout());
  leftPanel.setBorder(IdeBorderFactory.createTitledBorder("Project XSLT Files", false, new Insets(0, 0, 0, 0)));
  myTree = new Tree();
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(false);
  leftPanel.add(new JBScrollPane(myTree), BorderLayout.CENTER);
  mySplitter.setFirstComponent(leftPanel);

  myList = new JBList();
  myList.setCellRenderer(new MyCellRenderer());
  myList.setMinimumSize(new Dimension(120, 200));
  myList.getEmptyText().setText("No associated files");
  JPanel rightPanel = ToolbarDecorator.createDecorator(myList)
    .addExtraAction(AnActionButton.fromAction(new AddAssociationActionWrapper()))
    .addExtraAction(AnActionButton.fromAction(new RemoveAssociationAction()))
    .disableUpDownActions().disableAddAction().disableRemoveAction().createPanel();
  UIUtil.addBorder(rightPanel, IdeBorderFactory.createTitledBorder("Associated Files", false, new Insets(0, 0, 0, 0)));
  mySplitter.setSecondComponent(rightPanel);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AssociationsEditor.java

示例10: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected void initTree(Tree tree) {
    tree.setCellRenderer(new ContactTreeCellRenderer());
    tree.setShowsRootHandles(false);
    tree.setRootVisible(false);
    tree.addMouseListener(new IMContactDoubleClicker(getImPanel()));
    tree.setUI(new WideSelectionTreeUI() {

    });
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:10,代码来源:IMContactView.java

示例11: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void initTree(final Tree tree) {
  final MigrationRootsTreeCellRenderer rootsTreeCellRenderer = new MigrationRootsTreeCellRenderer();
  tree.setCellRenderer(rootsTreeCellRenderer);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(tree);

  TreeUtil.installActions(tree);
  TreeUtil.expandAll(tree);
  SmartExpander.installOn(tree);
  EditSourceOnDoubleClickHandler.install(tree);
  new TreeSpeedSearch(tree);
  PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(), ActionManager.getInstance());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MigrationPanel.java

示例12: createTreeComponent

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
/**
 * @return a created tree component (to be used as
 */
private JComponent createTreeComponent() {
  myExplanationTree = new Tree(new DefaultTreeModel(buildTree()));
  myExplanationTree.setRootVisible(false);
  myExplanationTree.setCellRenderer(new ExplanationTreeRenderer());
  DataManager.registerDataProvider(myExplanationTree, this);
  TreeUtil.expandAll(myExplanationTree);
  final NavigateAction navigateAction = new NavigateAction();
  navigateAction.registerCustomShortcutSet(new CustomShortcutSet(CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myExplanationTree);
  DefaultActionGroup group = new DefaultActionGroup();
  group.addAction(navigateAction);
  PopupHandler.installUnknownPopupHandler(myExplanationTree, group, ActionManager.getInstance());
  return new JBScrollPane(myExplanationTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AnalyzeDependenciesComponent.java

示例13: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public void initTree(@NotNull final Tree tree, JComponent mainComponent, CheckboxTreeBase.CheckboxTreeCellRendererBase cellRenderer) {
  tree.setCellRenderer(cellRenderer);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.setLineStyleAngled();
  TreeUtil.installActions(tree);

  setupKeyListener(tree, mainComponent);
  setupMouseListener(tree, mainComponent, cellRenderer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CheckboxTreeHelper.java

示例14: ImageDuplicateResultsDialog

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public ImageDuplicateResultsDialog(Project project, List<VirtualFile> images, Map<String, Set<VirtualFile>> duplicates) {
  super(project);
  myProject = project;
  myImages = images;
  PropertiesComponent.getInstance(myProject).loadFields(myResourceModules);
  myDuplicates = duplicates;
  setModal(false);
  myTree = new Tree(new MyRootNode());
  myTree.setRootVisible(true);
  myTree.setCellRenderer(new MyCellRenderer());
  init();
  TreeUtil.expandAll(myTree);
  setTitle("Image Duplicates");
  TreeUtil.selectFirstNode(myTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ImageDuplicateResultsDialog.java

示例15: createTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected Tree createTree() {
  final Tree tree = new Tree(new DefaultTreeModel(new DefaultMutableTreeNode()));

  tree.setCellRenderer(getTreeCellRenderer());
  UIUtil.setLineStyleAngled(tree);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.addKeyListener(new TreeKeyListener());
  tree.addTreeSelectionListener(new MyTreeSelectionListener());

  if (!myAllowMultiSelection) {
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  }

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
        doOKAction();
        return true;
      }
      return false;
    }
  }.installOn(tree);

  TreeUtil.installActions(tree);
  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MemberChooser.java


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