Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
282,000
SimpleTextAttributes () { return myStack.peek().second; }
peek
282,001
SimpleTextAttributes (javax.swing.text.html.HTML.Tag tag, MutableAttributeSet attr) { SimpleTextAttributes styleAttributes = parseStyleIfPossible(attr); if (tag == DIV || tag == SPAN) return styleAttributes; SimpleTextAttributes tagAttributes = null; if (tag == B) tagAttributes = REGULAR_ATTRIBUTES; if (tag == I) tagAt...
calcAttributes
282,002
SimpleTextAttributes (MutableAttributeSet attr) { Object attribute = attr.getAttribute(STYLE); if (attribute == null) return null; String styleStr = attribute.toString(); Map<String, String> styles = Arrays.stream(styleStr.split("\\s*;\\s*")) .map(s -> s.split("\\s*:\\s*")) .collect(Collectors.toMap(s -> s[0], s -> s[1...
parseStyleIfPossible
282,003
Color (String colorStr) { if (colorStr == null) return null; colorStr = StringUtil.trimStart(colorStr, "#"); if (colorStr.length() != 6) return null; return ColorUtil.fromHex(colorStr); }
parseColor
282,004
JScrollPane () { return new JBScrollPane(); }
createScrollPane
282,005
JScrollPane (Component view) { return new JBScrollPane(view); }
createScrollPane
282,006
JScrollPane (@JdkConstants.VerticalScrollBarPolicy int vsbPolicy, @JdkConstants.HorizontalScrollBarPolicy int hsbPolicy) { return new JBScrollPane(vsbPolicy, hsbPolicy); }
createScrollPane
282,007
JScrollPane (Component view, @JdkConstants.VerticalScrollBarPolicy int vsbPolicy, @JdkConstants.HorizontalScrollBarPolicy int hsbPolicy) { return new JBScrollPane(view, vsbPolicy, hsbPolicy); }
createScrollPane
282,008
JScrollPane (Component view, boolean withoutBorder) { JBScrollPane scrollPane = new JBScrollPane(view); if (withoutBorder) { scrollPane.setBorder(JBUI.Borders.empty()); // set empty border, because setting null doesn't always take effect scrollPane.setViewportBorder(JBUI.Borders.empty()); } return scrollPane; }
createScrollPane
282,009
boolean () { return ExperimentalUI.isNewUI(); }
isEnabled
282,010
void () { GraphicsUtil.setAntialiasingType(this, AntialiasingType.getAAHintForSwingComponent()); Object value = UIManager.getDefaults().get(RenderingHints.KEY_FRACTIONALMETRICS); if (value == null) value = RenderingHints.VALUE_FRACTIONALMETRICS_OFF; putClientProperty(RenderingHints.KEY_FRACTIONALMETRICS, value); }
updateUI
282,011
ColoredIterator () { return new MyIterator(); }
iterator
282,012
ColoredIterator (int fromIndex) { MyIterator iterator = new MyIterator(); iterator.myIndex = fromIndex - 1; return iterator; }
iterator
282,013
boolean () { return myIconOnTheRight; }
isIconOnTheRight
282,014
void (boolean iconOnTheRight) { myIconOnTheRight = iconOnTheRight; }
setIconOnTheRight
282,015
SimpleColoredComponent (@NotNull @Nls String fragment) { append(fragment, SimpleTextAttributes.REGULAR_ATTRIBUTES); return this; }
append
282,016
SimpleColoredComponent (@NotNull @Nls String fragment, @Nullable FragmentTextClipper clipper) { return appendWithClipping(fragment, SimpleTextAttributes.REGULAR_ATTRIBUTES, clipper); }
appendWithClipping
282,017
SimpleColoredComponent (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, @Nullable FragmentTextClipper clipper) { _append(fragment, attributes, clipper, myMainTextLastIndex < 0); revalidateAndRepaint(); return this; }
appendWithClipping
282,018
void (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes) { append(fragment, attributes, myMainTextLastIndex < 0); }
append
282,019
void (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, int padding, @JdkConstants.HorizontalAlignment int align) { append(fragment, attributes, myMainTextLastIndex < 0); appendTextPadding(padding, align); }
append
282,020
void (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, boolean isMainText) { _append(fragment, attributes, null, isMainText); revalidateAndRepaint(); }
append
282,021
void (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, @Nullable FragmentTextClipper clipper, boolean isMainText) { synchronized (myFragments) { myCurrentFragment = new ColoredFragment(fragment, attributes, this, clipper); myFragments.add(myCurrentFragment); if (isMainText) { myMainTextLas...
_append
282,022
void () { firePropertyChange("state", null, this); if (myAutoInvalidate) { revalidate(); } repaint(); }
revalidateAndRepaint
282,023
void (@NotNull @Nls String fragment, final @NotNull SimpleTextAttributes attributes, Object tag) { _append(fragment, attributes, tag); revalidateAndRepaint(); }
append
282,024
void (@Nls String fragment, SimpleTextAttributes attributes, Object tag) { synchronized (myFragments) { append(fragment, attributes); if (tag != null) myCurrentFragment.tag = tag; } }
_append
282,025
void (int padding) { appendTextPadding(padding, SwingConstants.LEFT); }
appendTextPadding
282,026
void (@Nls String html, SimpleTextAttributes baseAttributes) { new HtmlToSimpleColoredComponentConverter().appendHtml(this, html, baseAttributes); }
appendHTML
282,027
void (int padding, @JdkConstants.HorizontalAlignment int align) { synchronized (myFragments) { if (myCurrentFragment != null) { myCurrentFragment.padding = padding; myCurrentFragment.alignment = align; } } }
appendTextPadding
282,028
void (@JdkConstants.HorizontalAlignment int align) { myTextAlign = align; }
setTextAlign
282,029
void () { _clear(); revalidateAndRepaint(); }
clear
282,030
void () { synchronized (myFragments) { myIcon = null; myPaintFocusBorder = false; myFragments.clear(); myCurrentFragment = null; myMainTextLastIndex = -1; } }
_clear
282,031
Icon () { return myIcon; }
getIcon
282,032
void (final @Nullable Icon icon) { if (!Objects.equals(icon, myIcon)) { myIcon = icon; revalidateAndRepaint(); } }
setIcon
282,033
Insets () { return myIpad; }
getIpad
282,034
void (@NotNull Insets ipad) { myIpad = ipad; revalidateAndRepaint(); }
setIpad
282,035
int () { return myIconTextGap; }
getIconTextGap
282,036
void (final int iconTextGap) { if (iconTextGap < 0) { throw new IllegalArgumentException("wrong iconTextGap: " + iconTextGap); } myIconTextGap = iconTextGap; revalidateAndRepaint(); }
setIconTextGap
282,037
Border () { return myBorder; }
getMyBorder
282,038
void (@Nullable Border border) { myBorder = border; }
setMyBorder
282,039
void (final boolean paintFocusBorder) { if (myPaintFocusBorder == paintFocusBorder) return; myPaintFocusBorder = paintFocusBorder; repaint(); }
setPaintFocusBorder
282,040
void (final boolean focusBorderAroundIcon) { if (myFocusBorderAroundIcon == focusBorderAroundIcon) return; myFocusBorderAroundIcon = focusBorderAroundIcon; repaint(); }
setFocusBorderAroundIcon
282,041
boolean () { return myIconOpaque; }
isIconOpaque
282,042
void (final boolean iconOpaque) { if (myIconOpaque == iconOpaque) return; myIconOpaque = iconOpaque; repaint(); }
setIconOpaque
282,043
Dimension () { return computePreferredSize(false); }
getPreferredSize
282,044
Dimension () { if (isMinimumSizeSet()) return super.getMinimumSize(); return computePreferredSize(false); }
getMinimumSize
282,045
int () { synchronized (myFragments) { return myFragments.size(); } }
getFragmentCount
282,046
Dimension (final boolean mainTextOnly) { synchronized (myFragments) { // Calculate width float width = myIpad.left; if (myIcon != null) { width += myIcon.getIconWidth() + myIconTextGap; } final Insets borderInsets = myBorder != null ? myBorder.getBorderInsets(this) : JBInsets.emptyInsets(); width += borderInsets.left; ...
computePreferredSize
282,047
int () { return JBUIScale.scale(16); }
getMinHeight
282,048
Rectangle () { Rectangle area = new Rectangle(getWidth(), getHeight()); JBInsets.removeFrom(area, getInsets()); JBInsets.removeFrom(area, myIpad); return area; }
computePaintArea
282,049
float (@NotNull Font font, boolean mainTextOnly) { float result = 0; int baseSize = font.getSize(); boolean wasSmaller = false; for (int i = 0; i < myFragments.size(); i++) { ColoredFragment fragment = myFragments.get(i); SimpleTextAttributes attributes = fragment.attributes; boolean isSmaller = attributes.isSmaller();...
computeTextWidth
282,050
Font () { Font font = getFont(); if (font == null) font = StartupUiUtil.getLabelFont(); return font; }
getBaseFont
282,051
FontRenderContext (Font font) { FontRenderContext frc = getFontMetrics(font).getFontRenderContext(); Font baseFont = getBaseFont(); if (!baseFont.equals(myLayoutFont) || !frc.equals(myLayoutFRC)) { myFragments.forEach(ColoredFragment::invalidateLayout); myLayoutFont = new ImmutableFont(baseFont); myLayoutFRC = frc; } r...
getFontRenderContext
282,052
void (Graphics2D g, @NotNull ColoredFragment fragment, int fragmentIndex, float x, float y) { String text = fragment.text; if (StringUtil.isEmpty(text)) return; Font font = g.getFont(); FontRenderContext frc = getFontRenderContext(font); fragment.getAndCacheRenderer(font, frc).draw(g, fragmentIndex, x, y); }
doDrawString
282,053
float (@NotNull ColoredFragment fragment, int index, Font font) { if (StringUtil.isEmpty(fragment.text)) return 0; if (myFragments.get(index) != fragment) { return 0; // assertion? } ColoredFragment nextFragment = index < myFragments.size() - 1 ? myFragments.get(index + 1) : null; FontRenderContext frc = getFontRenderC...
computeStringWidth
282,054
float (@NotNull ColoredFragment fragment, Font font, FontRenderContext frc) { WidthKey key = new WidthKey(fragment.text, new ImmutableFont(font), frc, fragment.attributes.getStyle(), font.getSize()); return widthCache.get(key, it -> fragment.getAndCacheRenderer(it.font, it.frc).getWidth()); }
getFragmentWidth
282,055
TextLayout (String text, Font basefont, FontRenderContext fontRenderContext) { AttributedString string = new AttributedString(text); int length = text.length(); Font currentFont = basefont; int currentIndex = 0; for (int pos = 0; pos < length; pos = text.offsetByCodePoints(pos, 1)) { int codePoint = text.codePointAt(po...
createTextLayout
282,056
boolean (Font font, String text) { return font.canDisplayUpTo(text) != -1 && text.indexOf(CharacterIterator.DONE) == -1; // see IDEA-137517, TextLayout does not support this character }
needFontFallback
282,057
int (int x) { float curX = myIpad.left; //added even if no icon, see com.intellij.ui.SimpleColoredComponent.doPaintText if (myBorder != null) { curX += myBorder.getBorderInsets(this).left; } curX += getInsets().left; if (myIcon != null && !myIconOnTheRight) { final int iconRight = myIcon.getIconWidth() + myIconTextGap;...
findFragmentAt
282,058
JLabel (@NotNull JLabel label) { label.setIcon(myIcon); synchronized (myFragments) { if (!myFragments.isEmpty()) { @Nls StringBuilder sb = new StringBuilder(); sb.append("<html><body style=\"white-space:nowrap\">"); for (ColoredFragment fragment : myFragments) { final String text = fragment.text; final SimpleTextAttrib...
formatToLabel
282,059
void (@NotNull StringBuilder builder, @NotNull String fragment, @NotNull SimpleTextAttributes attributes) { if (!fragment.isEmpty()) { builder.append("<span"); formatStyle(builder, attributes); builder.append('>').append(convertFragment(fragment)).append("</span>"); } }
formatText
282,060
void (@NotNull StringBuilder builder, @NotNull String fragment, @NotNull SimpleTextAttributes attributes, @NotNull String url) { if (!fragment.isEmpty()) { builder.append("<a href=\"").append(StringUtil.replace(url, "\"", "%22")).append("\""); formatStyle(builder, attributes); builder.append('>').append(convertFragment...
formatLink
282,061
String (@NotNull String fragment) { return StringUtil.escapeXmlEntities(fragment).replaceAll("\\\\n", "<br>"); }
convertFragment
282,062
void (final StringBuilder builder, final SimpleTextAttributes attributes) { final Color fgColor = attributes.getFgColor(); final Color bgColor = attributes.getBgColor(); final int style = attributes.getStyle(); final int pos = builder.length(); if (fgColor != null) { builder.append("color:").append(ColorUtil.toHtmlColo...
formatStyle
282,063
void (final Graphics g) { try { doPaint((Graphics2D)g); } catch (ProcessCanceledException pce) { throw pce; } catch (RuntimeException e) { LOG.error(logSwingPath(), e); throw e; } }
paintComponent
282,064
void (final Graphics2D g) { synchronized (myFragments) { int offset = 0; final Icon icon = myIcon; // guard against concurrent modification (IDEADEV-12635) if (icon != null && !myIconOnTheRight) { doPaintIcon(g, icon, 0); offset += myIpad.left + icon.getIconWidth() + myIconTextGap; } doPaintTextBackground(g, offset); o...
doPaint
282,065
void (Graphics2D g, int offset) { if (isOpaque() || shouldDrawBackground()) { paintBackground(g, offset, getWidth() - offset, getHeight()); } }
doPaintTextBackground
282,066
void (Graphics2D g, int x, int width, int height) { g.setColor(getBackground()); g.fillRect(x, 0, width, height); }
paintBackground
282,067
void (@NotNull Graphics2D g, @NotNull Icon icon, int offset) { final Container parent = getParent(); Color iconBackgroundColor = null; if ((isOpaque() || isIconOpaque()) && !isTransparentIconBackground()) { if (parent != null && !myFocusBorderAroundIcon && !UIUtil.isFullRowSelectionLAF()) { iconBackgroundColor = parent...
doPaintIcon
282,068
int (Graphics2D g, int textStart, boolean focusAroundIcon) { synchronized (myFragments) { // If there is no icon, then we have to add left internal padding if (textStart == 0) { textStart = myIpad.left; } float offset = textStart; if (myBorder != null) { offset += myBorder.getBorderInsets(this).left; } offset += getIns...
doPaintText
282,069
boolean (int index, Graphics2D g, Font font, float x1, float x2, float baseline) { if (!SystemInfo.isMacOSCatalina || !myDynamicSearchMatchHighlighting) return false; ColoredFragment fragment = myFragments.get(index); if (!fragment.attributes.isSearchMatch()) return false; ColoredFragment prevFragment = index > 0 ? myF...
drawWithClipping
282,070
Color (Color attributesColor) { // in case if color is not defined we have to get foreground color from Swing hierarchy return attributesColor != null ? attributesColor : getForeground(); }
getActiveTextColor
282,071
void (@NotNull Graphics2D g, int index, @NotNull Color bgColor, int x, int y, int width, int height) { g.setColor(bgColor); g.fillRect(x, y, width, height); }
doPaintFragmentBackground
282,072
void (Graphics2D g, float x1, float x2, int height, boolean selected, boolean hovered, boolean noBorder) { if (noBorder) return; GraphicsConfig c = GraphicsUtil.setupRoundedBorderAntialiasing(g); RoundRectangle2D.Float shape = new RoundRectangle2D.Float(x1 + 1, 2, x2 - x1 - 2, height - 4, 6, 6); g.setColor(JBUI.Current...
drawClickableFrag
282,073
void (@NotNull Graphics2D g, @NotNull SimpleTextAttributes attributes, int offset, int textBaseline, int fragmentWidth, @NotNull FontMetrics metrics, Font font) { if (attributes.isStrikeout()) { EffectPainter.STRIKE_THROUGH.paint(g, offset, textBaseline, fragmentWidth, getCharHeight(g), font); } if (attributes.isWaved(...
drawTextAttributes
282,074
int (Graphics g) { // magic of determining character height return g.getFontMetrics().charWidth('a'); }
getCharHeight
282,075
int () { if (myTextAlign == SwingConstants.LEFT || myTextAlign == SwingConstants.LEADING) { return 0; } int componentWidth = getSize().width; int excessiveWidth = componentWidth - computePreferredSize(false).width; if (excessiveWidth <= 0) { return 0; } if (myTextAlign == SwingConstants.CENTER) { return excessiveWidth ...
computeTextAlignShift
282,076
boolean () { return false; }
shouldDrawDimmed
282,077
boolean () { return false; }
shouldDrawBackground
282,078
void (@NotNull Graphics g, @NotNull Icon icon, int offset) { Rectangle area = computePaintArea(); //noinspection UnnecessaryLocalVariable int x = offset; int y = area.y + (area.height - icon.getIconHeight()) / 2; IconUtil.paintSelectionAwareIcon(icon, this, g, x, y, isSelection()); }
paintIcon
282,079
boolean () { Color bg = getBackground(); return bg != null && Comparing.equal(UIUtil.getTreeSelectionBackground(true), bg) || Comparing.equal(UIUtil.getListSelectionBackground(true), bg); }
isSelection
282,080
void (@NotNull Graphics2D g) { UISettings.setupAntialiasing(g); g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, getClientProperty(RenderingHints.KEY_FRACTIONALMETRICS)); }
applyAdditionalHints
282,081
int (int width, int height) { super.getBaseline(width, height); return getTextBaseLine(getFontMetrics(getBaseFont()), height); }
getBaseline
282,082
boolean () { return myTransparentIconBackground; }
isTransparentIconBackground
282,083
void (boolean transparentIconBackground) { myTransparentIconBackground = transparentIconBackground; }
setTransparentIconBackground
282,084
void (boolean dynamicSearchMatchHighlighting) { myDynamicSearchMatchHighlighting = dynamicSearchMatchHighlighting; }
setDynamicSearchMatchHighlighting
282,085
int (@NotNull FontMetrics metrics, final int height) { // adding leading to ascent, just like in editor (leads to bad presentation for certain fonts with Oracle JDK, see IDEA-167541) return (height - metrics.getHeight() + 1) / 2 + metrics.getAscent() + (SystemInfo.isJetBrainsJvm ? metrics.getLeading() : 0); }
getTextBaseLine
282,086
String () { final StringBuilder buffer = new StringBuilder("Components hierarchy:\n"); for (Container c = this; c != null; c = c.getParent()) { buffer.append('\n'); buffer.append(c); } return buffer.toString(); }
logSwingPath
282,087
void (Insets insets) { myBorder = new JBEmptyBorder(insets); revalidateAndRepaint(); }
setBorderInsets
282,088
String () { return getCharSequence(false).toString(); }
toString
282,089
void (@NotNull Runnable runnable, boolean autoInvalidate) { boolean old = myAutoInvalidate; myAutoInvalidate = autoInvalidate; try { runnable.run(); } finally { myAutoInvalidate = old; } }
change
282,090
String (MouseEvent event) { if (myIcon instanceof IconWithToolTip && findFragmentAt(event.getX()) == FRAGMENT_ICON) { String iconToolTip = ((IconWithToolTip)myIcon).getToolTip(false); if (iconToolTip != null) { return StringUtil.capitalize(iconToolTip); } } return super.getToolTipText(event); }
getToolTipText
282,091
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleSimpleColoredComponent(); } return accessibleContext; }
getAccessibleContext
282,092
Font (Font originalFont, int style, float size) { Font derivedFont = originalFont.deriveFont(style, size); if (Font.DIALOG.equals(derivedFont.getFamily()) && !Font.DIALOG.equals(originalFont.getFamily())) { // workaround for JBR-3423 return originalFont.deriveFont(size); } return derivedFont; }
deriveFont
282,093
String () { return getCharSequence(false).toString(); }
getAccessibleName
282,094
AccessibleRole () { return AccessibleRole.LABEL; }
getAccessibleRole
282,095
void () { BrowserUtil.browse(myUrl); }
run
282,096
int () { return myOffset; }
getOffset
282,097
int () { return myEndOffset; }
getEndOffset
282,098
String () { synchronized (myFragments) { return myFragments.get(myIndex).text; } }
getFragment
282,099
SimpleTextAttributes () { synchronized (myFragments) { return myFragments.get(myIndex).attributes; } }
getTextAttributes