use of com.intellij.ui.treeStructure.SimpleTreeBuilder in project intellij-community by JetBrains.
the class ChooseLibrariesDialogBase method createCenterPanel.
@Override
@Nullable
protected JComponent createCenterPanel() {
myBuilder = new SimpleTreeBuilder(myTree, new DefaultTreeModel(new DefaultMutableTreeNode()), new MyStructure(getProject()), WeightBasedComparator.FULL_INSTANCE);
myBuilder.initRootNode();
myTree.setDragEnabled(false);
myTree.setShowsRootHandles(true);
UIUtil.setLineStyleAngled(myTree);
myTree.setRootVisible(false);
myTree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(final TreeSelectionEvent e) {
updateOKAction();
}
});
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
if (isOKActionEnabled()) {
doOKAction();
return true;
}
return false;
}
}.installOn(myTree);
myTree.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "ENTER");
myTree.getActionMap().put("ENTER", getOKAction());
final JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);
pane.setPreferredSize(JBUI.size(500, 400));
return pane;
}
Aggregations