本文整理汇总了Java中com.intellij.ui.treeStructure.Tree.setShowsRootHandles方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.setShowsRootHandles方法的具体用法?Java Tree.setShowsRootHandles怎么用?Java Tree.setShowsRootHandles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.treeStructure.Tree
的用法示例。
在下文中一共展示了Tree.setShowsRootHandles方法的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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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() {
});
}
示例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());
}
示例12: 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);
}
示例13: 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;
}
示例14: createTree
import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected JTree createTree() {
Tree internalTree = createInternalTree();
myFileSystemTree = new FileSystemTreeImpl(myProject, myChooserDescriptor, internalTree, null, null, null);
internalTree.setRootVisible(myChooserDescriptor.isTreeRootVisible());
internalTree.setShowsRootHandles(true);
Disposer.register(myDisposable, myFileSystemTree);
myFileSystemTree.addOkAction(new Runnable() {
public void run() {
doOKAction();
}
});
JTree tree = myFileSystemTree.getTree();
tree.setCellRenderer(new NodeRenderer());
tree.getSelectionModel().addTreeSelectionListener(new FileTreeSelectionListener());
tree.addTreeExpansionListener(new FileTreeExpansionListener());
setOKActionEnabled(false);
myFileSystemTree.addListener(new FileSystemTree.Listener() {
public void selectionChanged(final List<VirtualFile> selection) {
updatePathFromTree(selection, false);
}
}, myDisposable);
new FileDrop(tree, new FileDrop.Target() {
public FileChooserDescriptor getDescriptor() {
return myChooserDescriptor;
}
public boolean isHiddenShown() {
return myFileSystemTree.areHiddensShown();
}
public void dropFiles(final List<VirtualFile> files) {
if (!myChooserDescriptor.isChooseMultiple() && files.size() > 0) {
selectInTree(new VirtualFile[]{files.get(0)}, true);
}
else {
selectInTree(VfsUtilCore.toVirtualFileArray(files), true);
}
}
});
return tree;
}
示例15: NewErrorTreeViewPanel
import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public NewErrorTreeViewPanel(Project project, String helpId, boolean createExitAction, boolean createToolbar, @Nullable Runnable rerunAction) {
myProject = project;
myHelpId = helpId;
myCreateExitAction = createExitAction;
myConfiguration = ErrorTreeViewConfiguration.getInstance(project);
setLayout(new BorderLayout());
myAutoScrollToSourceHandler = new AutoScrollToSourceHandler() {
@Override
protected boolean isAutoScrollMode() {
return myConfiguration.isAutoscrollToSource();
}
@Override
protected void setAutoScrollMode(boolean state) {
myConfiguration.setAutoscrollToSource(state);
}
};
myMessagePanel = new JPanel(new BorderLayout());
myErrorViewStructure = new ErrorViewStructure(project, canHideWarnings());
DefaultMutableTreeNode root = new DefaultMutableTreeNode();
root.setUserObject(myErrorViewStructure.createDescriptor(myErrorViewStructure.getRootElement(), null));
final DefaultTreeModel treeModel = new DefaultTreeModel(root);
myTree = new Tree(treeModel) {
@Override
public void setRowHeight(int i) {
super.setRowHeight(0);
// this is needed in order to make UI calculate the height for each particular row
}
};
myBuilder = new ErrorViewTreeBuilder(myTree, treeModel, myErrorViewStructure);
myExporterToTextFile = new ErrorViewTextExporter(myErrorViewStructure);
myOccurrenceNavigatorSupport = new MyOccurrenceNavigatorSupport(myTree);
myAutoScrollToSourceHandler.install(myTree);
TreeUtil.installActions(myTree);
UIUtil.setLineStyleAngled(myTree);
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.setLargeModel(true);
JScrollPane scrollPane = NewErrorTreeRenderer.install(myTree);
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
myMessagePanel.add(scrollPane, BorderLayout.CENTER);
if (createToolbar) {
add(createToolbarPanel(rerunAction), BorderLayout.WEST);
}
add(myMessagePanel, BorderLayout.CENTER);
myTree.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
navigateToSource(false);
}
}
});
myTree.addMouseListener(new PopupHandler() {
@Override
public void invokePopup(Component comp, int x, int y) {
popupInvoked(comp, x, y);
}
});
EditSourceOnDoubleClickHandler.install(myTree);
}