com.intellij.ui.treeStructure.SimpleTreeStructure Java Examples
The following examples show how to use
com.intellij.ui.treeStructure.SimpleTreeStructure.
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: CruciblePanel.java From Crucible4IDEA with MIT License | 4 votes |
public CruciblePanel(@NotNull final Project project) { super(false); myProject = project; final JBSplitter splitter = new JBSplitter(false, 0.2f); myReviewModel = new CrucibleReviewModel(project); myReviewTable = new JBTable(myReviewModel); myReviewTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myReviewTable.setStriped(true); myReviewTable.setExpandableItemsEnabled(false); final TableColumnModel columnModel = myReviewTable.getColumnModel(); columnModel.getColumn(1).setCellRenderer(new DescriptionCellRenderer()); setUpColumnWidths(myReviewTable); myReviewTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { final int viewRow = myReviewTable.getSelectedRow(); if (viewRow >= 0 && viewRow < myReviewTable.getRowCount()) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { final Review review = CrucibleManager.getInstance(myProject).getDetailsForReview((String)myReviewTable. getValueAt(viewRow, myReviewTable.getColumnModel().getColumnIndex(CrucibleBundle.message("crucible.id")))); if (review != null) { openDetailsToolWindow(review); myReviewTable.clearSelection(); } } }, ModalityState.stateForComponent(myReviewTable)); } } }}); final TableRowSorter<TableModel> rowSorter = new TableRowSorter<TableModel>(myReviewModel); rowSorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(4, SortOrder.ASCENDING))); rowSorter.sort(); myReviewTable.setRowSorter(rowSorter); final JScrollPane detailsScrollPane = ScrollPaneFactory.createScrollPane(myReviewTable); final SimpleTreeStructure reviewTreeStructure = createTreeStructure(); final DefaultTreeModel model = new CrucibleTreeModel(); final SimpleTree reviewTree = new SimpleTree(model); new AbstractTreeBuilder(reviewTree, model, reviewTreeStructure, null); reviewTree.invalidate(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(reviewTree); splitter.setFirstComponent(scrollPane); splitter.setSecondComponent(detailsScrollPane); setContent(splitter); }
Example #2
Source File: CruciblePanel.java From Crucible4IDEA with MIT License | 4 votes |
private SimpleTreeStructure createTreeStructure() { final CrucibleRootNode rootNode = new CrucibleRootNode(myReviewModel); return new CrucibleTreeStructure(rootNode); }