Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
275,500
String () { return VCS_STRUCTURE_CHOOSER_KEY; }
getDimensionServiceKey
275,501
JComponent () { return myTree; }
getPreferredFocusedComponent
275,502
JComponent () { myTree = new Tree(); myTree.setBorder(BORDER); myTree.setShowsRootHandles(true); myTree.setRootVisible(false); myTree.setExpandableItemsEnabled(false); FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, true) { @Override public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) { if (!super.isFileVisible(file, showHiddenFiles)) return false; if (myRoots.contains(file)) return false; ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); return !changeListManager.isIgnoredFile(file) && !changeListManager.isUnversioned(file); } }; descriptor.withRoots(new ArrayList<>(myRoots)).withShowHiddenFiles(true).withHideIgnored(true); final MyCheckboxTreeCellRenderer cellRenderer = new MyCheckboxTreeCellRenderer(mySelectionManager, myModulesSet, myProject, myTree, myRoots); FileSystemTreeImpl fileSystemTree = new FileSystemTreeImpl(myProject, descriptor, myTree, cellRenderer, null, o -> { DefaultMutableTreeNode lastPathComponent = ((DefaultMutableTreeNode)o.getLastPathComponent()); Object uo = lastPathComponent.getUserObject(); if (uo instanceof FileNodeDescriptor) { VirtualFile file = ((FileNodeDescriptor)uo).getElement().getFile(); String module = myModulesSet.get(file); if (module != null) return module; return file == null ? "" : file.getName(); } return o.toString(); }) { @Override protected Comparator<? super NodeDescriptor<?>> getFileComparator() { return (o1, o2) -> { if (o1 instanceof FileNodeDescriptor && o2 instanceof FileNodeDescriptor) { VirtualFile f1 = ((FileNodeDescriptor)o1).getElement().getFile(); VirtualFile f2 = ((FileNodeDescriptor)o2).getElement().getFile(); boolean isDir1 = f1.isDirectory(); boolean isDir2 = f2.isDirectory(); if (isDir1 != isDir2) return isDir1 ? -1 : 1; return f1.getPath().compareToIgnoreCase(f2.getPath()); } return o1.getIndex() - o2.getIndex(); }; } }; new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { int row = myTree.getRowForLocation(e.getX(), e.getY()); if (row < 0) return false; Object o = myTree.getPathForRow(row).getLastPathComponent(); if (getTreeRoot() == o || getFile(o) == null) return false; Rectangle rowBounds = myTree.getRowBounds(row); cellRenderer.setBounds(rowBounds); Rectangle checkBounds = cellRenderer.myCheckbox.getBounds(); checkBounds.setLocation(rowBounds.getLocation()); if (checkBounds.height == 0) checkBounds.height = rowBounds.height; if (checkBounds.contains(e.getPoint())) { mySelectionManager.toggleSelection((DefaultMutableTreeNode)o); myTree.revalidate(); myTree.repaint(); } return true; } }.installOn(myTree); myTree.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) return; for (TreePath path : paths) { if (path == null) continue; Object o = path.getLastPathComponent(); if (getTreeRoot() == o || getFile(o) == null) return; mySelectionManager.toggleSelection((DefaultMutableTreeNode)o); } myTree.revalidate(); myTree.repaint(); e.consume(); } } }); JBPanel panel = new JBPanel(new BorderLayout()); panel.add(new JBScrollPane(fileSystemTree.getTree()), BorderLayout.CENTER); final JLabel selectedLabel = new JLabel(""); selectedLabel.setBorder(JBUI.Borders.empty(2, 0)); panel.add(selectedLabel, BorderLayout.SOUTH); mySelectionManager.setSelectionChangeListener(new PlusMinus<>() { @Override public void plus(VirtualFile virtualFile) { mySelectedFiles.add(virtualFile); recalculateErrorText(); } private void recalculateErrorText() { checkEmpty(); if (mySelectionManager.canAddSelection()) { selectedLabel.setText(""); } else { HtmlChunk.Element errorText = HtmlChunk.text("(" + VcsLogBundle.message("vcs.log.filters.structure.max.selected.error.message", MAX_FOLDERS) + ")") .wrapWith(HtmlChunk.tag("font").attr("color", "red")); selectedLabel.setText(new HtmlBuilder() .appendRaw((VcsLogBundle.message("vcs.log.filters.structure.label", errorText))) .wrapWith(HtmlChunk.html()) .toString()); } selectedLabel.revalidate(); } @Override public void minus(VirtualFile virtualFile) { mySelectedFiles.remove(virtualFile); recalculateErrorText(); } }); panel.setPreferredSize(JBUI.size(400, 300)); return panel; }
createCenterPanel
275,503
boolean (VirtualFile file, boolean showHiddenFiles) { if (!super.isFileVisible(file, showHiddenFiles)) return false; if (myRoots.contains(file)) return false; ChangeListManager changeListManager = ChangeListManager.getInstance(myProject); return !changeListManager.isIgnoredFile(file) && !changeListManager.isUnversioned(file); }
isFileVisible
275,504
boolean (@NotNull MouseEvent e, int clickCount) { int row = myTree.getRowForLocation(e.getX(), e.getY()); if (row < 0) return false; Object o = myTree.getPathForRow(row).getLastPathComponent(); if (getTreeRoot() == o || getFile(o) == null) return false; Rectangle rowBounds = myTree.getRowBounds(row); cellRenderer.setBounds(rowBounds); Rectangle checkBounds = cellRenderer.myCheckbox.getBounds(); checkBounds.setLocation(rowBounds.getLocation()); if (checkBounds.height == 0) checkBounds.height = rowBounds.height; if (checkBounds.contains(e.getPoint())) { mySelectionManager.toggleSelection((DefaultMutableTreeNode)o); myTree.revalidate(); myTree.repaint(); } return true; }
onClick
275,505
void (KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { TreePath[] paths = myTree.getSelectionPaths(); if (paths == null) return; for (TreePath path : paths) { if (path == null) continue; Object o = path.getLastPathComponent(); if (getTreeRoot() == o || getFile(o) == null) return; mySelectionManager.toggleSelection((DefaultMutableTreeNode)o); } myTree.revalidate(); myTree.repaint(); e.consume(); } }
keyPressed
275,506
void (VirtualFile virtualFile) { mySelectedFiles.add(virtualFile); recalculateErrorText(); }
plus
275,507
void () { checkEmpty(); if (mySelectionManager.canAddSelection()) { selectedLabel.setText(""); } else { HtmlChunk.Element errorText = HtmlChunk.text("(" + VcsLogBundle.message("vcs.log.filters.structure.max.selected.error.message", MAX_FOLDERS) + ")") .wrapWith(HtmlChunk.tag("font").attr("color", "red")); selectedLabel.setText(new HtmlBuilder() .appendRaw((VcsLogBundle.message("vcs.log.filters.structure.label", errorText))) .wrapWith(HtmlChunk.html()) .toString()); } selectedLabel.revalidate(); }
recalculateErrorText
275,508
void (VirtualFile virtualFile) { mySelectedFiles.remove(virtualFile); recalculateErrorText(); }
minus
275,509
DefaultMutableTreeNode () { return (DefaultMutableTreeNode)myTree.getModel().getRoot(); }
getTreeRoot
275,510
void (@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { //noinspection HardCodedStringLiteral append(value.toString()); }
customizeCellRenderer
275,511
void (Object value, FilePath path, FilePath self) { if (myRoots.contains(self.getVirtualFile())) { super.putParentPath(value, path, self); } }
putParentPath
275,512
Component (JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { invalidate(); if (value == null) return myEmpty; VirtualFile file = getFile(value); DefaultMutableTreeNode node = (DefaultMutableTreeNode)value; if (file == null) { Object uo = node.getUserObject(); if (uo instanceof String) { myColoredRenderer.getTreeCellRendererComponent(tree, node, selected, expanded, leaf, row, hasFocus); return myColoredRenderer; } return myEmpty; } myCheckbox.setVisible(true); TreeNodeState state = mySelectionManager.getState(node); myCheckbox.setEnabled(TreeNodeState.CLEAR.equals(state) || TreeNodeState.SELECTED.equals(state)); myCheckbox.setSelected(!TreeNodeState.CLEAR.equals(state)); myCheckbox.setOpaque(false); myCheckbox.setBackground(null); setBackground(null); myTextRenderer.getListCellRendererComponent(myFictive, file, 0, selected, hasFocus); revalidate(); return this; }
getTreeCellRendererComponent
275,513
MyNodeConverter () { return ourInstance; }
getInstance
275,514
VirtualFile (DefaultMutableTreeNode o) { return ((FileNodeDescriptor)o.getUserObject()).getElement().getFile(); }
convert
275,515
String (@NotNull FilePath path) { String module = myModules.get(path.getVirtualFile()); if (module != null) { return module; } return super.getName(path); }
getName
275,516
void (@NotNull FilePath path) { String module = myModules.get(path.getVirtualFile()); if (module != null) { setIcon(PlatformIcons.CONTENT_ROOT_ICON_CLOSED); } else { if (path.isDirectory()) { setIcon(PlatformIcons.FOLDER_ICON); } else { setIcon(VcsUtil.getIcon(myProject, path)); } } }
renderIcon
275,517
void (@NotNull Object value, @NotNull String parentPath, @NotNull FilePath self) { append(self.getPath(), SimpleTextAttributes.GRAYED_ATTRIBUTES); }
putParentPathImpl
275,518
void (@NotNull AnActionEvent e) { unregisterCustomShortcutSet(popup.getContent()); popup.closeOk(e.getInputEvent()); }
actionPerformed
275,519
String (char[] separators) { StringBuilder s = new StringBuilder(); for (char c : separators) { String separator = c == '\n' ? VcsLogBundle.message("vcs.log.filter.popup.advertisement.text.new.lines") : Character.toString(c); if (s.isEmpty()) { s.append(separator); } else { s.append(" ").append(VcsLogBundle.message("vcs.log.filter.popup.advertisement.text.or.suffix", separator)); } } return s.toString(); }
getSeparatorsText
275,520
void (@NotNull EditorTextField textField) { textField.addSettingsProvider(editor -> SoftWrapsEditorCustomization.ENABLED.customize(editor)); textField.setBorder(new CompoundBorder(JBUI.Borders.empty(2), textField.getBorder())); }
setupTextField
275,521
ActionGroup () { List<AnAction> group = new ArrayList<>(); group.add(createSelectMultipleValuesAction()); if (!myLogData.getCurrentUser().isEmpty()) { group.add(new PredefinedValueAction(Collections.singletonList(VcsLogFilterObject.ME), () -> me(), true)); } group.addAll(createRecentItemsActionGroup()); return new DefaultActionGroup(group); }
createActionGroup
275,522
ActionGroup () { List<AnAction> group = new ArrayList<>(); group.add(new SpeedsearchPredefinedValueAction(VcsLogFilterObject.ME, () -> me())); group.add(Separator.getInstance()); for (String user : collectUsers(myLogData)) { group.add(new SpeedsearchPredefinedValueAction(user, () -> user)); } return new DefaultActionGroup(group); }
createSpeedSearchActionGroup
275,523
List<String> () { return ContainerUtil.concat(Collections.singletonList(me()), collectUsers(myLogData)); }
getAllValues
275,524
ListPopup () { ActionGroup actionGroup = createActionGroup(); ActionGroup speedsearchGroup = createSpeedSearchActionGroup(); return new UserLogSpeedSearchPopup(new DefaultActionGroup(actionGroup, speedsearchGroup), DataManager.getInstance().getDataContext(this)); }
createPopupMenu
275,525
List<String> (@NotNull VcsLogUserFilter filter) { return myFilterModel.getFilterValues(filter); }
getFilterValues
275,526
List<String> (@NotNull Collection<String> values) { return ContainerUtil.map(values, user -> user.equals(me()) ? VcsLogFilterObject.ME : user); }
parseLocalizedValues
275,527
List<String> (@NotNull Collection<String> values) { return ContainerUtil.map(values, user -> user.equals(VcsLogFilterObject.ME) ? me() : user); }
getLocalizedValues
275,528
String () { return VcsLogBundle.message("vcs.log.user.filter.me"); }
me
275,529
List<String> (@NotNull VcsLogData logData) { List<String> users = ContainerUtil.map(logData.getAllUsers(), user -> { String shortPresentation = VcsUserUtil.getShortPresentation(user); Couple<String> firstAndLastName = VcsUserUtil.getFirstAndLastName(shortPresentation); if (firstAndLastName == null) return shortPresentation; return VcsUserUtil.capitalizeName(firstAndLastName.first) + " " + VcsUserUtil.capitalizeName(firstAndLastName.second); }); TreeSet<String> sortedUniqueUsers = new TreeSet<>(users); return new ArrayList<>(sortedUniqueUsers); }
collectUsers
275,530
boolean (@NotNull AnAction action) { if (!super.shouldBeShowing(action)) return false; if (getSpeedSearch().isHoldingFilter()) { if (action instanceof MultipleValueFilterPopupComponent.PredefinedValueAction) { return action instanceof SpeedsearchAction || ((MultipleValueFilterPopupComponent.PredefinedValueAction)action).myValues.size() > 1; } return true; } else { return !isSpeedsearchAction(action); } }
shouldBeShowing
275,531
void () { FontMetrics metrics = myComponent.getFontMetrics(getReferenceFont()); myHeight = metrics.getHeight() + TOP_TEXT_PADDING.get() + BOTTOM_TEXT_PADDING.get(); }
updateHeight
275,532
void (@NotNull Color background, @NotNull Color foreground, boolean isSelected, int availableWidth, @NotNull List<? extends RefGroup> refGroups) { myBackground = background; myForeground = foreground; updateHeight(); FontMetrics metrics = myComponent.getFontMetrics(getReferenceFont()); myGreyBackground = ExperimentalUI.isNewUI() ? null : calculateGreyBackground(refGroups, background, isSelected, myCompact); Pair<List<Pair<String, LabelIcon>>, Integer> presentation = calculatePresentation(refGroups, metrics, myGreyBackground != null ? myGreyBackground : myBackground, availableWidth, myCompact); myLabels = presentation.first; myWidth = presentation.second; }
customizePainter
275,533
LabelIcon (int height, @NotNull Color background, @NotNull List<? extends Color> colors) { return myIconCache.getIcon(myComponent, height, background, colors); }
getIcon
275,534
List<Color> (@NotNull Collection<? extends RefGroup> groups) { LinkedHashMap<Color, Integer> usedColors = new LinkedHashMap<>(); for (RefGroup group : groups) { List<Color> colors = group.getColors(); for (Color color : colors) { Integer count = usedColors.get(color); if (count == null) count = 0; usedColors.put(color, count + 1); } } List<Color> result = new ArrayList<>(); for (Map.Entry<Color, Integer> entry : usedColors.entrySet()) { result.add(entry.getKey()); if (entry.getValue() > 1) { result.add(entry.getKey()); } } return result; }
getColors
275,535
String (@NotNull RefGroup group, @NotNull FontMetrics fontMetrics, int availableWidth) { if (!group.isExpanded()) { return shortenRefName(group.getName(), fontMetrics, availableWidth); } StringBuilder text = new StringBuilder(); String remainder = ", ..."; String separator = ", "; int remainderWidth = fontMetrics.stringWidth(remainder); int separatorWidth = fontMetrics.stringWidth(separator); for (int i = 0; i < group.getRefs().size(); i++) { boolean lastRef = i == group.getRefs().size() - 1; boolean firstRef = i == 0; int width = availableWidth - (lastRef ? 0 : remainderWidth) - (firstRef ? 0 : separatorWidth); String refName = shortenRefName(group.getRefs().get(i).getName(), fontMetrics, width); int refNameWidth = fontMetrics.stringWidth(refName); if (width - refNameWidth < 0 && !firstRef) { text.append(remainder); break; } else { text.append(firstRef ? "" : separator).append(refName); availableWidth -= (firstRef ? 0 : separatorWidth) + refNameWidth; } } return text.toString(); }
getGroupText
275,536
String (@NotNull @NlsSafe String refName, @NotNull FontMetrics fontMetrics, int availableWidth) { if (fontMetrics.stringWidth(refName) > availableWidth && refName.length() > MAX_LENGTH) { int separatorIndex = refName.indexOf(SEPARATOR); if (separatorIndex > TWO_DOTS.length()) { refName = TWO_DOTS + refName.substring(separatorIndex); } if (availableWidth > 0) { return VcsLogUiUtil.shortenTextToFit(refName, fontMetrics, availableWidth, MAX_LENGTH, StringUtil.ELLIPSIS); } return StringUtil.shortenTextWithEllipsis(refName, MAX_LENGTH, 0, StringUtil.ELLIPSIS); } return refName; }
shortenRefName
275,537
void (@NotNull Graphics2D g2, int x, int y, int height) { if (myLabels.isEmpty()) return; GraphicsConfig config = GraphicsUtil.setupAAPainting(g2) .setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, getFractionalMetricsValue()) .setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, getTextAntiAliasingValue()); g2.setFont(getReferenceFont()); g2.setStroke(new BasicStroke(1.5f)); FontMetrics fontMetrics = g2.getFontMetrics(); int baseLine = SimpleColoredComponent.getTextBaseLine(fontMetrics, height); g2.setColor(myBackground); g2.fillRect(x, y, myWidth, height); if (myGreyBackground != null && myCompact) { g2.setColor(myGreyBackground); g2.fillRect(x, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING.get(), myWidth, fontMetrics.getHeight() + TOP_TEXT_PADDING.get() + BOTTOM_TEXT_PADDING.get()); } x += LEFT_PADDING.get(); for (Pair<String, LabelIcon> label : myLabels) { LabelIcon icon = label.second; String text = label.first; if (myGreyBackground != null && !myCompact) { g2.setColor(myGreyBackground); g2.fill(new RoundRectangle2D.Double(x - MIDDLE_PADDING.get() / 3, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING.get(), icon.getIconWidth() + fontMetrics.stringWidth(text) + 2 * MIDDLE_PADDING.get() / 3, fontMetrics.getHeight() + TOP_TEXT_PADDING.get() + BOTTOM_TEXT_PADDING.get(), LABEL_ARC.get(), LABEL_ARC.get())); } icon.paintIcon(null, g2, x, y + (height - icon.getIconHeight()) / 2); x += icon.getIconWidth(); x += getIconTextPadding(); g2.setColor(myForeground); g2.drawString(text, x, y + baseLine); x += fontMetrics.stringWidth(text) + (myCompact ? COMPACT_MIDDLE_PADDING.get() : MIDDLE_PADDING.get()); } config.restore(); }
paint
275,538
int () { return ExperimentalUI.isNewUI() ? ICON_TEXT_PADDING.get() : 0; }
getIconTextPadding
275,539
Object () { return Objects.requireNonNullElse(myComponent.getClientProperty(RenderingHints.KEY_TEXT_ANTIALIASING), AntialiasingType.getKeyForCurrentScope(false)); }
getTextAntiAliasingValue
275,540
Object () { return Objects.requireNonNullElse(myComponent.getClientProperty(RenderingHints.KEY_FRACTIONALMETRICS), UISettings.Companion.getPreferredFractionalMetricsValue()); }
getFractionalMetricsValue
275,541
Dimension () { if (myLabels.isEmpty()) return new Dimension(); myUpdateScaleHelper.saveScaleAndRunIfChanged(this::updateHeight); return new Dimension(myWidth, myHeight); }
getSize
275,542
boolean () { return myLeftAligned; }
isLeftAligned
275,543
Font () { Font font = GraphCommitCellRenderer.getLabelFont(); return font.deriveFont(font.getSize() - 1f); }
getReferenceFont
275,544
boolean () { return myCompact; }
isCompact
275,545
void (boolean compact) { myCompact = compact; }
setCompact
275,546
void (boolean leftAligned) { myLeftAligned = leftAligned; }
setLeftAligned
275,547
SimpleColoredComponent (@NotNull JTable table, @NotNull GraphCommitCell value, boolean isSelected, boolean hasFocus, int row, int column) { myComponent.customize(value, isSelected, hasFocus, row, column); return myComponent; }
getTableCellRendererComponentImpl
275,548
int (int row) { GraphCommitCell cell = getValue(myGraphTable.getModel().getValueAt(row, Commit.INSTANCE)); if (cell.getRefsToThisCommit().isEmpty()) return getColumnWidth() / 2; prepareTemplateComponent(row, cell); int referencesWidth = myTemplateComponent.getReferencesWidth(); if (myTemplateComponent.getReferencePainter().isLeftAligned()) { return myTemplateComponent.getGraphWidth() + referencesWidth / 2; } return getColumnWidth() - referencesWidth / 2; }
getTooltipXCoordinate
275,549
void (int row, @NotNull GraphCommitCell cell) { myTemplateComponent.customize(cell, myGraphTable.isRowSelected(row), myGraphTable.hasFocus(), row, VcsLogColumnManager.getInstance().getModelIndex(Commit.INSTANCE)); }
prepareTemplateComponent
275,550
int () { return myGraphTable.getCommitColumn().getWidth(); }
getColumnWidth
275,551
int () { return myComponent.getPreferredHeight(); }
getPreferredHeight
275,552
void (boolean compact) { myComponent.getReferencePainter().setCompact(compact); myTemplateComponent.getReferencePainter().setCompact(compact); }
setCompactReferencesView
275,553
void (boolean showTagNames) { myComponent.getReferencePainter().setShowTagNames(showTagNames); myTemplateComponent.getReferencePainter().setShowTagNames(showTagNames); }
setShowTagsNames
275,554
void (boolean leftAligned) { myComponent.getReferencePainter().setLeftAligned(leftAligned); myTemplateComponent.getReferencePainter().setLeftAligned(leftAligned); }
setLeftAligned
275,555
GraphCommitCellController () { return new GraphCommitCellController(myLogData, myGraphTable, myComponent.myPainter) { @Override protected int getTooltipXCoordinate(int row) { return GraphCommitCellRenderer.this.getTooltipXCoordinate(row); } @Override protected @Nullable JComponent getTooltip(@NotNull Object value, @NotNull Point point, int row) { return GraphCommitCellRenderer.this.getTooltip(value, point, row); } }; }
getCellController
275,556
int (int row) { return GraphCommitCellRenderer.this.getTooltipXCoordinate(row); }
getTooltipXCoordinate
275,557
Font () { return StartupUiUtil.getLabelFont(); }
getLabelFont
275,558
Dimension () { Dimension preferredSize = super.getPreferredSize(); int referencesSize = myReferencePainter.isLeftAligned() ? 0 : myReferencePainter.getSize().width; return new Dimension(preferredSize.width + referencesSize, getPreferredHeight()); }
getPreferredSize
275,559
void (Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; if (!myReferencePainter.isLeftAligned()) { int start = Math.max(myGraphWidth, getWidth() - myReferencePainter.getSize().width); myReferencePainter.paint(g2d, start, 0, getHeight()); } else { myReferencePainter.paint(g2d, myGraphWidth, 0, getHeight()); } myPainter.draw(g2d, myPrintElements); }
paintComponent
275,560
void (@NotNull GraphCommitCell cell, boolean isSelected, boolean hasFocus, int row, int column) { clear(); setPaintFocusBorder(false); acquireState(myGraphTable, isSelected, hasFocus, row, column); getCellState().updateRenderer(this); myPrintElements = cell.getPrintElements(); myGraphWidth = getGraphWidth(myGraphTable, myPrintElements); SimpleTextAttributes style = myGraphTable.applyHighlighters(this, row, column, hasFocus, isSelected); Collection<VcsRef> refs = cell.getRefsToThisCommit(); Color labelForeground; if (ExperimentalUI.isNewUI()) { labelForeground = JBColor.namedColor("VersionControl.Log.Commit.Reference.foreground", CurrentBranchComponent.TEXT_COLOR); } else { labelForeground = isSelected ? Objects.requireNonNull(myGraphTable.getBaseStyle(row, column, hasFocus, isSelected).getForeground()) : CurrentBranchComponent.TEXT_COLOR; } append(""); // appendTextPadding wont work without this if (myReferencePainter.isLeftAligned()) { myReferencePainter.customizePainter(refs, getBackground(), labelForeground, isSelected, getAvailableWidth(column, myGraphWidth)); int referencesWidth = myReferencePainter.getSize().width; if (referencesWidth > 0) referencesWidth += LabelPainter.RIGHT_PADDING.get(); appendTextPadding(myGraphWidth + referencesWidth); appendText(cell, style, isSelected); } else { appendTextPadding(myGraphWidth); appendText(cell, style, isSelected); myReferencePainter.customizePainter(refs, getBackground(), labelForeground, isSelected, getAvailableWidth(column, myGraphWidth)); } }
customize
275,561
void (@NotNull GraphCommitCell cell, @NotNull SimpleTextAttributes style, boolean isSelected) { myIssueLinkRenderer.appendTextWithLinks(StringUtil.replace(cell.getText(), "\t", " ").trim(), style); SpeedSearchUtil.applySpeedSearchHighlighting(myGraphTable, this, false, isSelected); }
appendText
275,562
int (int column, int graphWidth) { int textAndLabelsWidth = myGraphTable.getColumnModel().getColumn(column).getWidth() - graphWidth; int freeSpace = textAndLabelsWidth - super.getPreferredSize().width; int allowedSpace; if (myReferencePainter.isCompact()) { allowedSpace = Math.min(freeSpace, textAndLabelsWidth / 3); } else { allowedSpace = Math.max(freeSpace, Math.max(textAndLabelsWidth / 2, textAndLabelsWidth - JBUIScale.scale(DISPLAYED_MESSAGE_PART))); } return Math.max(0, allowedSpace); }
getAvailableWidth
275,563
int () { int rowContentHeight = calculateRowContentHeight(); return ExperimentalUI.isNewUI() ? Math.max(rowContentHeight, JBUI.CurrentTheme.VersionControl.Log.rowHeight()) : rowContentHeight; }
calculateHeight
275,564
int () { return Math.max(myReferencePainter.getSize().height, getFontMetrics(myFont).getHeight() + JBUI.scale(JBUI.CurrentTheme.VersionControl.Log.verticalPadding())); }
calculateRowContentHeight
275,565
int () { Font font = getLabelFont(); GraphicsConfiguration configuration = myGraphTable.getGraphicsConfiguration(); if (myFont != font || (configuration != null && !Objects.equals(myAffineTransform, configuration.getDefaultTransform()))) { myFont = font; myAffineTransform = configuration != null ? configuration.getDefaultTransform() : null; myHeight = calculateHeight(); } return myHeight; }
getPreferredHeight
275,566
VcsLogLabelPainter () { return myReferencePainter; }
getReferencePainter
275,567
FontMetrics (Font font) { return myGraphTable.getFontMetrics(font); }
getFontMetrics
275,568
int () { return myGraphWidth; }
getGraphWidth
275,569
int () { return myReferencePainter.getSize().width; }
getReferencesWidth
275,570
int (@NotNull VcsLogGraphTable table, @NotNull Collection<? extends PrintElement> printElements) { if (printElements.isEmpty()) return 0; double maxIndex = 0; for (PrintElement printElement : printElements) { maxIndex = Math.max(maxIndex, printElement.getPositionInCurrentRow()); if (printElement instanceof EdgePrintElement) { maxIndex = Math.max(maxIndex, (printElement.getPositionInCurrentRow() + ((EdgePrintElement)printElement).getPositionInOtherRow()) / 2.0); } } maxIndex++; maxIndex = Math.max(maxIndex, Math.min(MAX_GRAPH_WIDTH, table.getVisibleGraph().getRecommendedWidth())); return (int)(maxIndex * PaintParameters.getNodeWidth(table.getRowHeight())); }
getGraphWidth
275,571
Color (JTable table, boolean isSelected) { if (!isSelected) return super.getSelectionForeground(table, isSelected); return VcsLogGraphTable.getSelectionForeground(RenderingUtil.isFocused(table)); }
getSelectionForeground
275,572
Object (@NotNull MouseEvent e, @NotNull JTable table, int row, int column, @NotNull TableCellRenderer cellRenderer) { Component component = cellRenderer.getTableCellRendererComponent(table, table.getValueAt(row, column), false, false, row, column); if (component instanceof SimpleColoredComponent) { Rectangle rc = table.getCellRect(row, column, false); int additionalOffset = ExperimentalUI.isNewUI() ? VcsLogNewUiTableCellRenderer.getAdditionalOffset(column) : 0; return ((SimpleColoredComponent)component).getFragmentTagAt(e.getX() - rc.x - additionalOffset); } return super.tryGetTag(e, table, row, column, cellRenderer); }
tryGetTag
275,573
BufferedImage (Component c, Graphics2D g) { BufferedImage image = c != null ? ImageUtil.createImage(c.getGraphicsConfiguration(), getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB) : ImageUtil.createImage(g, getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB); paintIcon(image.createGraphics()); return image; }
createImage
275,574
void (Component c, Graphics g, int x, int y) { if (ImageUtil.getImageScale(myImage) != JBUIScale.sysScale((Graphics2D)g)) { myImage = createImage(null, (Graphics2D)g); } StartupUiUtil.drawImage(g, myImage, x, y, null); }
paintIcon
275,575
void (@NotNull Graphics2D g2) { GraphicsConfig config = GraphicsUtil.setupAAPainting(g2); if (ExperimentalUI.isNewUI()) { paintTagsForNewUi(g2); } else { paintTagsForClassicUi(g2); } config.restore(); }
paintIcon
275,576
void (@NotNull Graphics2D g2) { float scale = mySize / SIZE; for (int i = myColors.size() - 1; i >= 0; i--) { if (i != myColors.size() - 1) { g2.setColor(myBgColor); paintTag(g2, scale, scale * 2 * i + 1, 0); } g2.setColor(myColors.get(i)); paintTag(g2, scale, scale * 2 * i, 0); } }
paintTagsForClassicUi
275,577
void (@NotNull Graphics2D g2) { float scale = mySize / SIZE; int tagCount = myColors.size(); for (int i = 0; i < tagCount; i++) { Color color = myColors.get(tagCount - 1 - i); TagPainter.paintTag(g2, scale * 2 * i, i == tagCount - 1, myBgColor, color, mySize); if (i != tagCount - 1) { float x0 = scale * 2 * i + 2 * scale - JBUIScale.scale((float)Math.sqrt(2.0)); TagPainter.paintTag(g2, x0, false, myBgColor, myBgColor, mySize); } } }
paintTagsForNewUi
275,578
void (Graphics2D g2, float scale, float x, float y) { Path2D.Float path = new Path2D.Float(); x += scale * 0.25; y += scale; path.moveTo(x, y); path.lineTo(x + 2 * scale, y); path.lineTo(x + 5 * scale, y + 3 * scale); path.lineTo(x + 3 * scale, y + 5 * scale); path.lineTo(x, y + 2 * scale); path.lineTo(x, y); path.closePath(); Ellipse2D hole = new Ellipse2D.Float(x + 1 * scale, y + 1 * scale, scale, scale); Area area = new Area(path); area.subtract(new Area(hole)); g2.fill(area); }
paintTag
275,579
int () { return getWidth(myColors.size()); }
getIconWidth
275,580
int (int labelsCount) { return getWidth(mySize, labelsCount); }
getWidth
275,581
int (int height, int labelsCount) { float scale = height / SIZE; return Math.round((SIZE + 2 * (labelsCount - 1)) * scale); }
getWidth
275,582
int () { return mySize; }
getIconHeight
275,583
void () { myHasGroupWithMultipleRefs = false; for (Map.Entry<VcsRefType, Collection<VcsRef>> typeAndRefs : myGroupedVisibleReferences.entrySet()) { if (typeAndRefs.getValue().size() > 1) { myHasGroupWithMultipleRefs = true; break; } } super.update(); }
update
275,584
Font () { return LabelPainter.getReferenceFont(); }
getLabelsFont
275,585
int () { return getWidth(myHasGroupWithMultipleRefs ? 2 : 1); }
getIconWidth
275,586
Icon (int height) { return EmptyIcon.create(LabelIcon.getWidth(height, 2), height); }
createEmptyIcon
275,587
JBLabel (@Nls @NotNull String text, @Nullable Icon icon) { JBLabel label = super.createLabel(text, icon); label.setForeground(UIUtil.getToolTipForeground()); return label; }
createLabel
275,588
JBLabel (int restSize) { String gray = ColorUtil.toHex(UIManager.getColor("Button.disabledText")); String labelText = VcsLogBundle.message("vcs.log.references.more.tooltip", restSize); String html = HtmlChunk.text(labelText).wrapWith("font").attr("color", "#" + gray).wrapWith(HtmlChunk.html()).toString(); return createLabel(html, createEmptyIcon(getIconHeight())); }
createRestLabel
275,589
Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return getTableCellRendererComponentImpl(table, getValue(Objects.requireNonNull(value)), isSelected, hasFocus, row, column); }
getTableCellRendererComponent
275,590
T (@NotNull Object value) { //noinspection unchecked return (T)value; }
getValue
275,591
Collection<VcsRef> () { return myRefsToThisCommit; }
getRefsToThisCommit
275,592
String () { return myText; }
toString
275,593
void (@NotNull List<VcsRef> references) { if (myReferences.equals(references)) return; myReferences = references; List<VcsRef> visibleReferences = (myRefsLimit > 0) ? ContainerUtil.getFirstItems(myReferences, myRefsLimit) : myReferences; myGroupedVisibleReferences = ContainerUtil.groupBy(visibleReferences, VcsRef::getType); update(); }
setReferences
275,594
void () { removeAll(); int height = getIconHeight(); JBLabel firstLabel = null; for (Map.Entry<VcsRefType, Collection<VcsRef>> typeAndRefs : myGroupedVisibleReferences.entrySet()) { VcsRefType type = typeAndRefs.getKey(); Collection<VcsRef> refs = typeAndRefs.getValue(); int refIndex = 0; for (VcsRef reference : refs) { Icon icon = createIcon(type, refs, refIndex, height); String ending = (refIndex != refs.size() - 1) ? "," : ""; String text = reference.getName() + ending; JBLabel label = createLabel(text, icon); if (firstLabel == null) { firstLabel = label; add(label); } else { addWrapped(label, firstLabel); } refIndex++; } } if (getHiddenReferencesSize() > 0) { JBLabel label = createRestLabel(getHiddenReferencesSize()); addWrapped(label, Objects.requireNonNull(firstLabel)); } setVisible(!myGroupedVisibleReferences.isEmpty()); revalidate(); repaint(); }
update
275,595
int () { return (myRefsLimit > 0) ? myReferences.size() - Math.min(myReferences.size(), myRefsLimit) : 0; }
getHiddenReferencesSize
275,596
int () { return getFontMetrics(getLabelsFont()).getHeight(); }
getIconHeight
275,597
JBLabel (int restSize) { return createLabel(VcsLogBundle.message("vcs.log.details.references.more.label", restSize), null); }
createRestLabel
275,598
void (@NotNull JBLabel label, @NotNull JBLabel referent) { Wrapper wrapper = new Wrapper(label); wrapper.setVerticalSizeReferent(referent); add(wrapper); }
addWrapped
275,599
JBLabel (@Nls @NotNull String text, @Nullable Icon icon) { JBLabel label = new JBLabel(text, icon, SwingConstants.LEFT); label.setFont(getLabelsFont()); label.setIconTextGap(0); label.setHorizontalAlignment(SwingConstants.LEFT); label.setVerticalTextPosition(SwingConstants.CENTER); label.setCopyable(true); return label; }
createLabel