com.intellij.ui.dualView.TreeTableView Java Examples
The following examples show how to use
com.intellij.ui.dualView.TreeTableView.
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: CompareWithSelectedRevisionAction.java From consulo with Apache License 2.0 | 6 votes |
private static JPanel createCommentsPanel(final TreeTableView treeTable) { JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = createTextArea(); treeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { final int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { textArea.setText(""); } else { final VcsFileRevision revision = getRevisionAt(treeTable, index); if (revision != null) { textArea.setText(revision.getCommitMessage()); } else { textArea.setText(""); } } } }); final JScrollPane textScrollPane = ScrollPaneFactory.createScrollPane(textArea); panel.add(textScrollPane, BorderLayout.CENTER); textScrollPane.setBorder(IdeBorderFactory.createTitledBorder(VcsBundle.message("border.selected.revision.commit.message"), false )); return panel; }
Example #2
Source File: TableLinkMouseListener.java From consulo with Apache License 2.0 | 6 votes |
@javax.annotation.Nullable public Object getTagAt(final MouseEvent e) { // TODO[yole]: don't update renderer on every event, like it's done in TreeLinkMouseListener Object tag = null; JTable table = (JTable)e.getSource(); int row = table.rowAtPoint(e.getPoint()); int column = table.columnAtPoint(e.getPoint()); if (row == -1 || column == -1) return null; TableCellRenderer cellRenderer = table.getCellRenderer(row, column); if (cellRenderer instanceof DualView.TableCellRendererWrapper) { cellRenderer = ((DualView.TableCellRendererWrapper) cellRenderer).getRenderer(); } if (cellRenderer instanceof TreeTableView.CellRendererWrapper) { cellRenderer = ((TreeTableView.CellRendererWrapper) cellRenderer).getBaseRenderer(); } if (cellRenderer instanceof ColoredTableCellRenderer) { final ColoredTableCellRenderer renderer = (ColoredTableCellRenderer)cellRenderer; tag = forColoredRenderer(e, table, row, column, renderer); } else { tag = tryGetTag(e, table, row, column); } return tag; }
Example #3
Source File: QueryPlanPanel.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
public void initialize(Container container) { JTextArea queryLabel = new JTextArea(originalQuery); queryLabel.setRows(3); queryLabel.setEditable(false); GraphQueryPlan graphQueryPlan = result.getPlan() .orElseThrow(() -> new ShouldNeverHappenException("Sergey Ishchenko", "GraphQueryPanel is initialized when explain or profile queries are executed")); ListTreeTableModelOnColumns model = createModel(graphQueryPlan, result.isProfilePlan()); treeTable = new TreeTableView(model); treeTable.setAutoCreateColumnsFromModel(true); treeTable.setRootVisible(true); treeTable.setCellSelectionEnabled(false); treeTable.setRowSelectionAllowed(true); treeTable.setAutoResizeMode(TreeTableView.AUTO_RESIZE_OFF); treeTable.getTree().setShowsRootHandles(true); DefaultTreeExpander expander = new DefaultTreeExpander(treeTable.getTree()); expander.expandAll(); initTreeCellRenderer(model); JBLabel infoLabel = new JBLabel(getStatusText(result)); infoLabel.setHorizontalAlignment(SwingConstants.LEFT); container.add(new JBScrollPane(queryLabel), BorderLayout.NORTH); // scroll pane is needed to correctly fit all the tree content and to show table header container.add(new JBScrollPane(treeTable, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); container.add(infoLabel, BorderLayout.SOUTH); new ColumnResizer(treeTable).resize(); }
Example #4
Source File: CompareWithSelectedRevisionAction.java From consulo with Apache License 2.0 | 5 votes |
private static void showTreePopup(final List<TreeItem<VcsFileRevision>> roots, final VirtualFile file, final Project project, final DiffProvider diffProvider) { final TreeTableView treeTable = new TreeTableView(new ListTreeTableModelOnColumns(new TreeNodeAdapter(null, null, roots), new ColumnInfo[]{BRANCH_COLUMN, REVISION_COLUMN, DATE_COLUMN, AUTHOR_COLUMN})); Runnable runnable = new Runnable() { public void run() { int index = treeTable.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return; } VcsFileRevision revision = getRevisionAt(treeTable, index); if (revision != null) { DiffActionExecutor.showDiff(diffProvider, revision.getRevisionNumber(), file, project, VcsBackgroundableActions.COMPARE_WITH); } } }; treeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); new PopupChooserBuilder(treeTable). setTitle(VcsBundle.message("lookup.title.vcs.file.revisions")). setItemChoosenCallback(runnable). setSouthComponent(createCommentsPanel(treeTable)). setResizable(true). setDimensionServiceKey("Vcs.CompareWithSelectedRevision.Popup"). createPopup(). showCenteredInCurrentWindow(project); }
Example #5
Source File: CompareWithSelectedRevisionAction.java From consulo with Apache License 2.0 | 5 votes |
@javax.annotation.Nullable private static VcsFileRevision getRevisionAt(final TreeTableView treeTable, final int index) { final List items = treeTable.getItems(); if (items.size() <= index) { return null; } else { return ((TreeNodeAdapter)items.get(index)).getRevision(); } }