com.intellij.ui.TreeSpeedSearch Java Examples

The following examples show how to use com.intellij.ui.TreeSpeedSearch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChangesListView.java    From consulo with Apache License 2.0 6 votes vote down vote up
public ChangesListView(@Nonnull Project project) {
  myProject = project;

  setModel(TreeModelBuilder.buildEmpty(project));

  setShowsRootHandles(true);
  setRootVisible(false);
  setDragEnabled(true);

  myCopyProvider = new ChangesBrowserNodeCopyProvider(this);

  ChangesBrowserNodeRenderer renderer = new ChangesBrowserNodeRenderer(project, () -> myShowFlatten, true);
  setCellRenderer(renderer);

  new TreeSpeedSearch(this, TO_TEXT_CONVERTER);
  SmartExpander.installOn(this);
  new TreeLinkMouseListener(renderer).installOn(this);
}
 
Example #2
Source File: ContentEntryTreeEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
public ContentEntryTreeEditor(Project project, ModuleConfigurationState state) {
  myProject = project;
  myState = state;
  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);
}
 
Example #3
Source File: FileTemplateTabAsTree.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected FileTemplateTabAsTree(String title) {
  super(title);
  myRoot = initModel();
  myTreeModel = new MyTreeModel(myRoot);
  myTree = new Tree(myTreeModel);
  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(e -> onTemplateSelected());
  new TreeSpeedSearch(myTree);
}
 
Example #4
Source File: ScopeChooserConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void initTree() {
  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      final TreePath path = e.getOldLeadSelectionPath();
      if (path != null) {
        final MyNode node = (MyNode)path.getLastPathComponent();
        final NamedConfigurable namedConfigurable = node.getConfigurable();
        if (namedConfigurable instanceof ScopeConfigurable) {
          ((ScopeConfigurable)namedConfigurable).cancelCurrentProgress();
        }
      }
    }
  });
  super.initTree();
  myTree.setShowsRootHandles(false);
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath treePath) {
      return ((MyNode)treePath.getLastPathComponent()).getDisplayName();
    }
  }, true);

  myTree.getEmptyText().setText(IdeBundle.message("scopes.no.scoped"));
}
 
Example #5
Source File: DirectoryChooserModuleTreeView.java    From consulo with Apache License 2.0 6 votes vote down vote up
public DirectoryChooserModuleTreeView(@Nonnull 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);
}
 
Example #6
Source File: TfsTreeForm.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
public TfsTreeForm() {
    DataManager.registerDataProvider(tree, this);
    new TreeSpeedSearch(tree);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            selectedItem = doGetSelectedItem();
            pathField.setText(selectedItem != null ? selectedItem.path : null);
            eventDispatcher.getMulticaster().selectionChanged();
        }
    });
    PopupHandler.installPopupHandler(tree, POPUP_ACTION_GROUP, ActionPlaces.REMOTE_HOST_DIALOG_POPUP);
    setMessage(null, false);
}
 
Example #7
Source File: BaseStructureConfigurableNoDaemon.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void initTree() {
  if (myWasTreeInitialized) return;
  myWasTreeInitialized = true;

  super.initTree();
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath treePath) {
      return ((MyNode)treePath.getLastPathComponent()).getDisplayName();
    }
  }, true);
  ToolTipManager.sharedInstance().registerComponent(myTree);
  myTree.setCellRenderer(new ProjectStructureElementRenderer(null));
}
 
Example #8
Source File: InspectionTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
public InspectionTree(@Nonnull Project project, @Nonnull GlobalInspectionContextImpl context) {
  super(new InspectionRootNode(project));
  myContext = context;

  setCellRenderer(new CellRenderer());
  setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(this);
  addTreeWillExpandListener(new ExpandListener());

  myExpandedUserObjects = new HashSet<Object>();
  myExpandedUserObjects.add(project);

  TreeUtil.installActions(this);
  new TreeSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      return InspectionsConfigTreeComparator.getDisplayTextToSort(o.getLastPathComponent().toString());
    }
  });

  addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      TreePath newSelection = e.getNewLeadSelectionPath();
      if (newSelection != null) {
        mySelectionPath = new SelectionPath(newSelection);
      }
    }
  });
}
 
Example #9
Source File: ColorOptionsTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ColorOptionsTree(@Nonnull String categoryName) {
  super(createTreeModel());
  myTreeModel = (DefaultTreeModel)getModel();
  setRootVisible(false);
  getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myCategoryName = categoryName;
  new TreeSpeedSearch(this, TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING, true);
}
 
Example #10
Source File: BaseStructureConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void initTree() {
  if (myWasTreeInitialized) return;
  myWasTreeInitialized = true;

  super.initTree();
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath treePath) {
      return ((MyNode)treePath.getLastPathComponent()).getDisplayName();
    }
  }, true);
  ToolTipManager.sharedInstance().registerComponent(myTree);
  myTree.setCellRenderer(new ProjectStructureElementRenderer(myContext));
}
 
Example #11
Source File: LayoutTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void configureUiHelper(TreeUIHelper helper) {
  final Convertor<TreePath, String> convertor = new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath path) {
      final SimpleNode node = getNodeFor(path);
      if (node instanceof PackagingElementNode) {
        return ((PackagingElementNode<?>)node).getElementPresentation().getSearchName();
      }
      return "";
    }
  };
  new TreeSpeedSearch(this, convertor, true);
}
 
Example #12
Source File: SdksConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void initTree() {
  super.initTree();
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath treePath) {
      return ((MyNode)treePath.getLastPathComponent()).getDisplayName();
    }
  }, true);

  myTree.setRootVisible(false);
}
 
Example #13
Source File: HierarchyBrowserBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void configureTree(@Nonnull Tree tree) {
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  tree.setToggleClickCount(-1);
  tree.setCellRenderer(new HierarchyNodeRenderer());
  UIUtil.setLineStyleAngled(tree);
  new TreeSpeedSearch(tree);
  TreeUtil.installActions(tree);
  myAutoScrollToSourceHandler.install(tree);
}