Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
275,100
void (JViewport viewport) { viewport.addChangeListener(e -> { if (isShowRootNames()) { AbstractTableModel model = getModel(); Couple<Integer> visibleRows = ScrollingUtil.getVisibleRows(this); if (visibleRows.first >= 0) { TableModelEvent evt = new TableModelEvent(model, visibleRows.first, visibleRows.second, VcsLogColumnManager.getInstance().getModelIndex(Root.INSTANCE)); model.fireTableChanged(evt); } } mySelectionSnapshot = null; }); }
viewportSet
275,101
void (Cursor cursor) { super.setCursor(cursor); Component layeredPane = ComponentUtil.findParentByCondition(this, component -> component instanceof LoadingDecorator.CursorAware); if (layeredPane != null) { layeredPane.setCursor(cursor); } }
setCursor
275,102
GraphTableModel () { return (GraphTableModel)super.getModel(); }
getModel
275,103
void (@NotNull GraphAnswer<Integer> answer) { GraphCommitCellController controller = (GraphCommitCellController)Objects.requireNonNull(getController(Commit.INSTANCE)); Cursor cursor = controller.handleGraphAnswer(answer, true, null, null); myMouseAdapter.handleCursor(cursor); }
handleAnswer
275,104
void (int row, @NotNull VcsLogColumn<?> column) { if (column != Commit.INSTANCE) return; GraphCommitCellController controller = (GraphCommitCellController)Objects.requireNonNull(getController(column)); controller.showTooltip(row); }
showTooltip
275,105
VisibleGraph<Integer> () { return getModel().getVisiblePack().getVisibleGraph(); }
getVisibleGraph
275,106
TableCellEditor () { // this fixes selection problems by prohibiting selection when user clicks on graph (CellEditor does that) // what is fun about this code is that if you set cell editor in constructor with setCellEditor method it would not work return myDummyEditor; }
getCellEditor
275,107
int () { return myGraphCommitCellRenderer.getPreferredHeight(); }
getRowHeight
275,108
void (@NotNull Graphics g, int x, int y, int width, int height) { paintTopBottomBorder(g, x, y, width, height, false); }
paintFooter
275,109
void (@NotNull Graphics g, int x, int y, int width, int height, boolean isTopBorder) { int targetRow = isTopBorder ? 0 : getRowCount() - 1; if (targetRow >= 0 && targetRow < getRowCount()) { g.setColor(getStyle(targetRow, getColumnViewIndex(Commit.INSTANCE), hasFocus(), false, false).getBackground()); } else { g.setColor(getBaseStyle(targetRow, getColumnViewIndex(Commit.INSTANCE), hasFocus(), false).getBackground()); } g.fillRect(x, y, width, height); }
paintTopBottomBorder
275,110
Border (int top, int bottom) { return new MyTopBottomBorder(top, bottom); }
createTopBottomBorder
275,111
boolean () { return getCursor() == Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR); }
isResizingColumns
275,112
Color (@NotNull Color background) { int alpha = HOVERED_BACKGROUND.getAlpha(); if (alpha == 255) return HOVERED_BACKGROUND; if (alpha == 0) return background; return ColorUtil.mix(new Color(HOVERED_BACKGROUND.getRGB()), background, alpha / 255.0); }
getHoveredBackgroundColor
275,113
Font () { return UIManager.getFont("Table.font"); }
getTableFont
275,114
VcsCommitStyle (int row, int column, boolean hasFocus, boolean selected) { Component dummyRendererComponent = myDummyRenderer.getTableCellRendererComponent(myTable, "", selected, hasFocus, row, column); Color background = selected ? getSelectionBackground(myTable.hasFocus()) : getTableBackground(); return createStyle(dummyRendererComponent.getForeground(), background, VcsLogHighlighter.TextStyle.NORMAL); }
getBaseStyle
275,115
void (MouseEvent e) { if (myLinkListener.onClick(e, e.getClickCount())) { return; } int c = columnAtPoint(e.getPoint()); VcsLogColumn<?> column = getVcsLogColumn(c); if (column == null) return; if (e.getClickCount() == 2) { // when we reset column width, commit column eats all the remaining space // (or gives the required space) // so it is logical that we reset column width by right border if it is on the left of the commit column // and by the left border otherwise int commitColumnIndex = getColumnViewIndex(Commit.INSTANCE); boolean useLeftBorder = c > commitColumnIndex; if ((useLeftBorder ? isOnLeftBorder(e, c) : isOnRightBorder(e, c)) && column.isDynamic()) { resetColumnWidth(column); } else { // user may have clicked just outside of the border // in that case, c is not the column we are looking for int c2 = columnAtPoint(new Point(e.getPoint().x + (useLeftBorder ? 1 : -1) * JBUIScale.scale(BORDER_THICKNESS), e.getPoint().y)); VcsLogColumn<?> column2 = getVcsLogColumn(c2); if (column2 != null && (useLeftBorder ? isOnLeftBorder(e, c2) : isOnRightBorder(e, c2)) && column2.isDynamic()) { resetColumnWidth(column2); } } } int row = rowAtPoint(e.getPoint()); if ((row >= 0 && row < getRowCount()) && e.getClickCount() == 1) { VcsLogCellController controller = getController(column); if (controller != null) { Cursor cursor = controller.performMouseClick(row, e); handleCursor(cursor); } } }
mouseClicked
275,116
boolean (@NotNull MouseEvent e, int column) { return Math.abs(getCellRect(0, column, false).x - e.getPoint().x) <= JBUIScale.scale(BORDER_THICKNESS); }
isOnLeftBorder
275,117
boolean (@NotNull MouseEvent e, int column) { return Math.abs(getCellRect(0, column, false).x + getColumnModel().getColumn(column).getWidth() - e.getPoint().x) <= JBUIScale.scale(BORDER_THICKNESS); }
isOnRightBorder
275,118
void (MouseEvent e) { if (getRowCount() == 0) return; if (isResizingColumns()) return; getExpandableItemsHandler().setEnabled(true); if (myLinkListener.getTagAt(e) != null) { swapCursor(); return; } int row = rowAtPoint(e.getPoint()); if (row >= 0 && row < getRowCount()) { VcsLogColumn<?> column = getVcsLogColumn(columnAtPoint(e.getPoint())); if (column == null) return; VcsLogCellController controller = getController(column); if (controller != null) { Cursor cursor = controller.performMouseMove(row, e); handleCursor(cursor); return; } } restoreCursor(); }
mouseMoved
275,119
void (@Nullable Cursor cursor) { if (cursor != null) { if (cursor.getType() == Cursor.DEFAULT_CURSOR) { restoreCursor(); } else if (cursor.getType() == Cursor.HAND_CURSOR) { swapCursor(); } } }
handleCursor
275,120
void () { if (getCursor().getType() != Cursor.HAND_CURSOR && myLastCursor == null) { Cursor newCursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); myLastCursor = getCursor(); setCursor(newCursor); } }
swapCursor
275,121
void () { if (getCursor().getType() != Cursor.DEFAULT_CURSOR) { setCursor(UIUtil.cursorIfNotDefault(myLastCursor)); } myLastCursor = null; }
restoreCursor
275,122
void (MouseEvent e) { // Do nothing }
mouseEntered
275,123
void (MouseEvent e) { getExpandableItemsHandler().setEnabled(true); }
mouseExited
275,124
Component (JTable table, Object value, boolean isSelected, int row, int column) { return null; }
getTableCellEditorComponent
275,125
Object () { return null; }
getCellEditorValue
275,126
boolean (EventObject anEvent) { return false; }
isCellEditable
275,127
boolean (EventObject anEvent) { if (!(anEvent instanceof MouseEvent e)) return true; int row = rowAtPoint(e.getPoint()); if (row < 0 || row >= getRowCount()) return true; VcsLogColumn<?> column = getVcsLogColumn(columnAtPoint(e.getPoint())); if (column == null) return true; VcsLogCellController controller = getController(column); if (controller == null) return true; return controller.shouldSelectCell(row, e); }
shouldSelectCell
275,128
boolean () { return false; }
stopCellEditing
275,129
void () { }
cancelCellEditing
275,130
void (CellEditorListener l) { }
addCellEditorListener
275,131
void (CellEditorListener l) { }
removeCellEditorListener
275,132
void (@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { progressChanged(keys); }
progressStarted
275,133
void (@NotNull Collection<? extends VcsLogProgress.ProgressKey> keys) { if (VcsLogUiUtil.isProgressVisible(keys, myId)) { getEmptyText().setText(VcsLogBundle.message("vcs.log.loading.status")); } else { updateEmptyText(); } }
progressChanged
275,134
void () { updateEmptyText(); }
progressStopped
275,135
void (PropertyChangeEvent evt) { // for some reason if I just add a PropertyChangeListener to a column it's not called // and TableColumnModelListener.columnMarginChanged does not provide any information which column was changed if (getTableHeader().getResizingColumn() == null) return; if ("width".equals(evt.getPropertyName())) { for (VcsLogColumn<?> logColumn : VcsLogColumnManager.getInstance().getCurrentDynamicColumns()) { TableColumn column = getTableColumn(logColumn); if (evt.getSource().equals(column)) { setWidth(logColumn, myProperties, column.getWidth()); } } } super.propertyChange(evt); }
propertyChange
275,136
void (int columnIndex, int newIndex) { VcsLogColumn<?> column = getVcsLogColumn(columnIndex); if (column == null || column == Root.INSTANCE || getVcsLogColumn(newIndex) == Root.INSTANCE || !supportsColumnsReordering(myProperties)) { return; } super.moveColumn(columnIndex, newIndex); VcsLogColumnUtilKt.moveColumn(myProperties, column, newIndex); }
moveColumn
275,137
void (Component c, Graphics g, int x, int y, int width, int height) { if (myInsets.top > 0) paintTopBottomBorder(g, x, y, width, myInsets.top, true); if (myInsets.bottom > 0) paintTopBottomBorder(g, x, y + height - myInsets.bottom, width, myInsets.bottom, false); }
paintBorder
275,138
Insets (Component c) { return myInsets; }
getBorderInsets
275,139
boolean () { return true; }
isBorderOpaque
275,140
void (@NotNull VcsLogColumn<?> column) { onColumnOrderSettingChanged(); }
columnAdded
275,141
void (@NotNull VcsLogColumn<?> column) { myTableColumns.remove(column); myInitializedColumns.remove(column); onColumnOrderSettingChanged(); }
columnRemoved
275,142
Color () { return ExperimentalUI.isNewUI() ? JBUI.CurrentTheme.ToolWindow.background() : UIUtil.getListBackground(); }
getTableBackground
275,143
Color (boolean hasFocus) { return hasFocus ? SELECTION_BACKGROUND : SELECTION_BACKGROUND_INACTIVE; }
getSelectionBackground
275,144
Color (boolean hasFocus) { return hasFocus ? SELECTION_FOREGROUND : SELECTION_FOREGROUND_INACTIVE; }
getSelectionForeground
275,145
void (@Nullable ListSelectionEvent event) { if (event != null && event.getValueIsAdjusting()) return; myLastEvent = event; if (myLastRequest != null) myLastRequest.cancel(); myLastRequest = null; ApplicationManager.getApplication().invokeLater(this::processEvent, o -> myLastEvent != event); onLoadingScheduled(); }
valueChanged
275,146
void () { int rows = myGraphTable.getSelectedRowCount(); if (rows < 1) { onLoadingStopped(); onEmptySelection(); } else { int[] toLoad = onSelection(myGraphTable.getSelectedRows()); onLoadingStarted(); EmptyProgressIndicator indicator = new EmptyProgressIndicator(); myLastRequest = indicator; myCommitDetailsGetter.loadCommitsData(myGraphTable.getModel().createSelection(toLoad).getIds(), detailsList -> { if (myLastRequest == indicator && !(indicator.isCanceled())) { if (toLoad.length != detailsList.size()) { LOG.error("Loaded incorrect number of details " + detailsList + " for selection " + Arrays.toString(toLoad)); } myLastRequest = null; onDetailsLoaded(detailsList); onLoadingStopped(); } }, t -> { if (myLastRequest == indicator && !(indicator.isCanceled())) { myLastRequest = null; LOG.error("Error loading details for selection " + Arrays.toString(toLoad), t); onError(t); onLoadingStopped(); } }, indicator); } }
processEvent
275,147
void () { }
onLoadingScheduled
275,148
VcsCommitStyle (int commitId, @NotNull VcsShortCommitDetails details, int column, boolean isSelected) { if (isSelected || !Registry.is("vcs.log.highlight.not.indexed")) return VcsCommitStyle.DEFAULT; VcsLogIndex index = myLogData.getIndex(); if (!index.isIndexed(commitId)) { return VcsCommitStyleFactory.foreground(NOT_INDEXED_COMMIT_FOREGROUND); } return VcsCommitStyle.DEFAULT; }
getStyle
275,149
void (@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { }
update
275,150
VcsLogHighlighter (@NotNull VcsLogData logData, @NotNull VcsLogUi logUi) { return new IndexHighlighter(logData); }
createHighlighter
275,151
String () { return ID; }
getId
275,152
String () { return VcsLogBundle.message("vcs.log.action.highlight.indexed.commits"); }
getTitle
275,153
boolean () { return false; }
showMenuItem
275,154
VcsCommitStyle (int commitId, @NotNull VcsShortCommitDetails details, int column, boolean isSelected) { if (isSelected) return VcsCommitStyle.DEFAULT; if (details.getParents().size() >= 2) return VcsCommitStyleFactory.foreground(MERGE_COMMIT_FOREGROUND); return VcsCommitStyle.DEFAULT; }
getStyle
275,155
void (@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { }
update
275,156
VcsLogHighlighter (@NotNull VcsLogData logData, @NotNull VcsLogUi logUi) { return new MergeCommitsHighlighter(); }
createHighlighter
275,157
String () { return ID; }
getId
275,158
String () { return VcsLogBundle.message("vcs.log.action.highlight.merge.commits"); }
getTitle
275,159
boolean () { return true; }
showMenuItem
275,160
VcsCommitStyle (int commitId, @NotNull VcsShortCommitDetails details, int column, boolean isSelected) { if (details instanceof LoadingDetails) return VcsCommitStyle.DEFAULT; if (myShouldHighlightUser) { VcsUser currentUser = myLogData.getCurrentUser().get(details.getRoot()); if (currentUser != null && VcsUserUtil.isSamePerson(currentUser, details.getAuthor())) { if (ExperimentalUI.isNewUI() && isAuthorColumnVisible() && !isAuthorColumn(column)) { return VcsCommitStyle.DEFAULT; } return VcsCommitStyleFactory.bold(); } } return VcsCommitStyle.DEFAULT; }
getStyle
275,161
boolean () { if (myUi instanceof VcsLogUiEx ui) return ui.getTable().isColumnVisible(Author.INSTANCE); return true; }
isAuthorColumnVisible
275,162
boolean (int column) { return VcsLogColumnManager.getInstance().getModelIndex(Author.INSTANCE) == column; }
isAuthorColumn
275,163
void (@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { myShouldHighlightUser = !isSingleUser() && !isFilteredByCurrentUser(dataPack.getFilters()); }
update
275,164
boolean () { Set<VcsUser> users = new ObjectOpenCustomHashSet<>(myLogData.getCurrentUser().values(), new VcsUserUtil.VcsUserHashingStrategy()); return myLogData.getUserRegistry().all(user -> users.contains(user)); }
isSingleUser
275,165
boolean (@NotNull VcsLogFilterCollection filters) { VcsLogUserFilter userFilter = filters.get(VcsLogFilterCollection.USER_FILTER); if (userFilter == null) return false; if (Collections.singleton(VcsLogFilterObject.ME).containsAll(userFilter.getValuesAsText())) return true; return false; }
isFilteredByCurrentUser
275,166
VcsLogHighlighter (@NotNull VcsLogData logData, @NotNull VcsLogUi logUi) { return new MyCommitsHighlighter(logData, logUi); }
createHighlighter
275,167
String () { return ID; }
getId
275,168
String () { return VcsLogBundle.message("vcs.log.action.highlight.my.commits"); }
getTitle
275,169
boolean () { return true; }
showMenuItem
275,170
VcsCommitStyle (int commitId, @NotNull VcsShortCommitDetails details, int column, boolean isSelected) { if (isSelected) return VcsCommitStyle.DEFAULT; if (!myIsHighlighted.getOrDefault(details.getRoot(), false)) return VcsCommitStyle.DEFAULT; Predicate<Integer> condition = myLogData.getContainingBranchesGetter().getContainedInCurrentBranchCondition(details.getRoot()); if (condition.test(commitId)) { return VcsCommitStyleFactory.background(CURRENT_BRANCH_BG); } return VcsCommitStyle.DEFAULT; }
getStyle
275,171
void (@NotNull VcsLogDataPack dataPack, boolean refreshHappened) { String singleFilteredBranch = VcsLogUtil.getSingleFilteredBranch(dataPack.getFilters(), dataPack.getRefs()); myIsHighlighted.clear(); boolean isHeadFilter = VcsLogUtil.HEAD.equals(singleFilteredBranch); for (VirtualFile root : dataPack.getLogProviders().keySet()) { String currentBranch = dataPack.getLogProviders().get(root).getCurrentBranch(root); myIsHighlighted.put(root, !isHeadFilter && currentBranch != null && !(currentBranch.equals(singleFilteredBranch))); } }
update
275,172
VcsLogHighlighter (@NotNull VcsLogData logData, @NotNull VcsLogUi logUi) { return new CurrentBranchHighlighter(logData); }
createHighlighter
275,173
String () { return ID; }
getId
275,174
String () { return VcsLogBundle.message("vcs.log.action.highlight.current.branch"); }
getTitle
275,175
boolean () { return true; }
showMenuItem
275,176
boolean (@NotNull FrameDiffTool.ToolbarComponents toolbarComponents) { return !myIsInEditor || super.shouldAddToolbarBottomBorder(toolbarComponents); }
shouldAddToolbarBottomBorder
275,177
Iterable<Wrapper> () { return wrap(VcsTreeModelData.selected(myBrowser.getViewer())); }
iterateSelectedChanges
275,178
Iterable<Wrapper> () { return wrap(VcsTreeModelData.all(myBrowser.getViewer())); }
iterateAllChanges
275,179
Iterable<Wrapper> (@NotNull VcsTreeModelData modelData) { return wrap(myBrowser, modelData); }
wrap
275,180
Iterable<Wrapper> (@NotNull VcsLogChangesBrowser browser, @NotNull VcsTreeModelData modelData) { return modelData.iterateNodes() .filter(ChangesBrowserChangeNode.class) .map(n -> new MyChangeWrapper(browser, n.getUserObject(), browser.getTag(n.getUserObject()))); }
wrap
275,181
void (@NotNull Wrapper change) { myBrowser.selectChange(change.getUserObject(), change.getTag()); }
selectChange
275,182
void () { ApplicationManager.getApplication().invokeLater(() -> updatePreview(myIsInEditor || getComponent().isShowing())); }
updatePreviewLater
275,183
void (boolean state) { // We do not have local changes here, so it's OK to always use `fromModelRefresh == false` updatePreview(state, false); }
updatePreview
275,184
VcsTreeModelData (VcsLogChangesBrowser changesBrowser) { boolean hasSelection = changesBrowser.getViewer().getSelectionModel().getSelectionCount() != 0; return hasSelection ? VcsTreeModelData.selected(changesBrowser.getViewer()) : VcsTreeModelData.all(changesBrowser.getViewer()); }
getSelectedOrAll
275,185
Dimension (Container target) { Dimension baseSize = super.preferredLayoutSize(target); if (getAlignOnBaseline()) { return baseSize; } return getWrappedSize(target); }
preferredLayoutSize
275,186
Dimension (Container target) { Container parent = SwingUtilities.getUnwrappedParent(target); int maxWidth = parent.getWidth() - (parent.getInsets().left + parent.getInsets().right); return getDimension(target, maxWidth); }
getWrappedSize
275,187
Dimension (Container target, int maxWidth) { Insets insets = target.getInsets(); int height = insets.top + insets.bottom; int width = insets.left + insets.right; int rowHeight = 0; int rowWidth = insets.left + insets.right; boolean isVisible = false; boolean start = true; synchronized (target.getTreeLock()) { for (int i = 0; i < target.getComponentCount(); i++) { Component component = target.getComponent(i); if (component.isVisible()) { isVisible = true; Dimension size = component.getPreferredSize(); if (rowWidth + getHgap() + size.width > maxWidth && !start) { height += getVgap() + rowHeight; width = Math.max(width, rowWidth); rowWidth = insets.left + insets.right; rowHeight = 0; } rowWidth += getHgap() + size.width; rowHeight = Math.max(rowHeight, size.height); start = false; } } height += getVgap() + rowHeight; width = Math.max(width, rowWidth); if (!isVisible) { return super.preferredLayoutSize(target); } else { return new Dimension(width, height); } } }
getDimension
275,188
Dimension (Container target) { if (getAlignOnBaseline()) return super.minimumLayoutSize(target); return getWrappedSize(target); }
minimumLayoutSize
275,189
boolean (@NotNull HyperlinkEvent e) { return SHOW_HIDE_BRANCHES.equals(e.getDescription()); }
isShowHideBranches
275,190
boolean (@NotNull HyperlinkEvent e) { return e.getDescription().startsWith(GO_TO_HASH); }
isGoToHash
275,191
String (@NotNull VcsShortCommitDetails details) { String authorString = VcsUserUtil.getShortPresentation(details.getAuthor()); return authorString + (VcsUserUtil.isSamePerson(details.getAuthor(), details.getCommitter()) ? "" : "*"); }
getAuthorPresentation
275,192
boolean (@NotNull Project project) { return CommitMessageInspectionProfile.getInstance(project).isToolEnabled(SubjectLimitInspection.class); }
isSubjectMarginEnabled
275,193
String (@NotNull Project project, @NotNull @Nls String text, @NotNull Font font, int style, @NotNull Convertor<? super String, String> convertor) { return FontUtil.getHtmlWithFonts(escapeMultipleSpaces(formatTextWithLinks(project, text, convertor)), style, font); }
formatText
275,194
HtmlChunk (@Nullable VcsUser committer, @Nullable Long commitTime) { if (committer == null && commitTime == null) { return HtmlChunk.empty(); } String style = "color:#" + ColorUtil.toHex(JBColor.GRAY); HtmlChunk.Element graySpan = HtmlChunk.span(style); String committed; if (committer == null) { String date = DateFormatUtil.formatDate(commitTime); String time = DateFormatUtil.formatTime(commitTime); committed = VcsLogBundle.message("vcs.log.details.committer.info.date.time", date, time); } else { String by = VcsUserUtil.getShortPresentation(committer) + (!committer.getEmail().isEmpty() ? "</span> " + getEmailLink(committer) + "<span style=\"" + style + "\">" : ""); if (commitTime == null) { committed = VcsLogBundle.message("vcs.log.details.committer.info.user", by); } else { String date = DateFormatUtil.formatDate(commitTime); String time = DateFormatUtil.formatTime(commitTime); committed = VcsLogBundle.message("vcs.log.details.committer.info.user.date.time", by, date, time); } } return new HtmlBuilder().appendRaw(committed).wrapWith(graySpan); }
getCommitterHtml
275,195
CommitPresentation (@NotNull Project project, @NotNull VcsCommitMetadata commit, @NotNull Set<? super String> unresolvedHashes) { String rawMessage = commit.getFullMessage(); String hashAndAuthor = formatCommitHashAndAuthor(commit); Set<String> unresolvedHashesForCommit = findHashes(project, rawMessage); if (unresolvedHashesForCommit.isEmpty()) { return new CommitPresentation(project, commit.getRoot(), rawMessage, hashAndAuthor, MultiMap.empty()); } unresolvedHashes.addAll(unresolvedHashesForCommit); return new UnresolvedPresentation(project, commit.getRoot(), rawMessage, hashAndAuthor); }
buildPresentation
275,196
CommitPresentation (@NotNull MultiMap<String, CommitId> resolvedHashes) { return new CommitPresentation(myProject, myRoot, myRawMessage, myHashAndAuthor, resolvedHashes); }
resolve
275,197
boolean () { return false; }
isResolved
275,198
CommitPresentation (@NotNull MultiMap<String, CommitId> resolvedHashes) { return this; }
resolve
275,199
boolean () { return true; }
isResolved