Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
283,200
JComponent () { if (getComponentCount() == 1) { return (JComponent) getComponent(0); } else { return this; } }
getTargetComponent
283,201
Wrapper (JComponent verticalSizeReferent) { myVerticalSizeReferent = verticalSizeReferent; return this; }
setVerticalSizeReferent
283,202
Wrapper (JComponent horizontalSizeReferent) { myHorizontalSizeReferent = horizontalSizeReferent; return this; }
setHorizontalSizeReferent
283,203
Dimension () { Dimension size = super.getPreferredSize(); if (myHorizontalSizeReferent != null && myHorizontalSizeReferent.isShowing()) { size.width = Math.max(size.width, myHorizontalSizeReferent.getPreferredSize().width); } if (myVerticalSizeReferent != null && myVerticalSizeReferent.isShowing()) { size.height = Math...
getPreferredSize
283,204
void (Component component, Object constraints) { if ((constraints == null) || (constraints instanceof String)) { addLayoutComponent((String)constraints, component); } else { throw new IllegalArgumentException("unsupported constraints: " + constraints); } }
addLayoutComponent
283,205
Dimension (Container target) { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
maximumLayoutSize
283,206
float (Container target) { return .5f; }
getLayoutAlignmentX
283,207
float (Container target) { return .5f; }
getLayoutAlignmentY
283,208
void (Container target) { }
invalidateLayout
283,209
void (String name, Component component) { synchronized (component.getTreeLock()) { if (name == null || TOP.equalsIgnoreCase(name)) { myTop.add(component); } else if (CENTER.equalsIgnoreCase(name)) { myCenter.add(component); } else if (BOTTOM.equalsIgnoreCase(name)) { myBottom.add(component); } else { throw new IllegalA...
addLayoutComponent
283,210
void (Component component) { myTop.remove(component); myBottom.remove(component); myCenter.remove(component); }
removeLayoutComponent
283,211
Dimension (Container container) { return getPreferredSize(container, true); }
preferredLayoutSize
283,212
Dimension (Container container) { return getPreferredSize(container, false); }
minimumLayoutSize
283,213
void (Container container) { int gap = myGap.get(); synchronized (container.getTreeLock()) { Dimension top = getPreferredSize(myTop); Dimension bottom = getPreferredSize(myBottom); Dimension center = getPreferredSize(myCenter); Insets insets = container.getInsets(); int width = container.getWidth() - insets.left - inse...
layoutContainer
283,214
int (List<? extends Component> list, int y, int width, Insets insets) { int gap = myGap.get(); for (Component component : list) { if (component.isVisible()) { Dimension size = LayoutUtil.getPreferredSize(component); int x = 0; if (myAlignment == FILL) { size.width = width; } else if (myAlignment != SwingConstants.LEFT)...
layout
283,215
Dimension (Dimension result, int gap, Dimension size) { if (size == null) { return result; } if (result == null) { return new Dimension(size); } result.height += gap + size.height; if (result.width < size.width) { result.width = size.width; } return result; }
join
283,216
Dimension (List<? extends Component> list) { int gap = myGap.get(); Dimension result = null; for (Component component : list) { if (component.isVisible()) { result = join(result, gap, LayoutUtil.getPreferredSize(component)); } } return result; }
getPreferredSize
283,217
Dimension (Container container, boolean aligned) { int gap2 = 2 * myGap.get(); synchronized (container.getTreeLock()) { Dimension top = getPreferredSize(myTop); Dimension bottom = getPreferredSize(myBottom); Dimension center = getPreferredSize(myCenter); Dimension result = join(join(join(null, gap2, top), gap2, center)...
getPreferredSize
283,218
void (boolean isOpaque) { super.setOpaque(isOpaque); setDoubleBuffered(false); }
setOpaque
283,219
void (JComponent c) { c.setOpaque(false); }
setTransparent
283,220
void (Graphics g) { Color bg = getBackground(); g.setColor(bg); Dimension size = getSize(); g.fillRect(0, 0, size.width, size.height); }
paintComponent
283,221
void () { myErrorLabel = createErrorLabel(); myMainComponent = createMainComponent(); add(myMainComponent, BorderLayout.CENTER); add(myErrorLabel, BorderLayout.SOUTH); }
doInitialize
283,222
void (@NlsContexts.Label String errorText) { if ("".equals(errorText) || errorText == null) { errorText = " "; } myErrorLabel.setText(errorText); }
setErrorText
283,223
JLabel () { return myErrorLabel; }
getErrorLabel
283,224
T () { return myMainComponent; }
getMainComponent
283,225
String () { final String text = myErrorLabel.getText(); return " ".equals(text) ? "" : text; }
getErrorText
283,226
void (JLabel label) { myLabel = label; myLabel.setLabelFor(myMainComponent); add(label, BorderLayout.WEST); }
setLabel
283,227
JLabel () { final JLabel label = new JLabel(" "); label.setForeground(JBColor.red); label.setFont(ERROR_FONT); return label; }
createErrorLabel
283,228
void () { super.doLayout(); if (myLabel != null) { myErrorLabel.setBorder(BorderFactory.createEmptyBorder(0, myLabel.getSize().width, 0, 0)); } }
doLayout
283,229
Dimension (@NotNull Component component) { Dimension size = component.getPreferredSize(); if (size == null) return new Dimension(); // rare if (component.isMaximumSizeSet()) { Dimension max = component.getMaximumSize(); if (max != null) { if (size.width > max.width) size.width = max.width; if (size.height > max.height)...
getPreferredSize
283,230
JPanel (Component component) { JPanel panel = new JPanel(INSTANCE); if (component != null) panel.add(component); panel.setOpaque(false); return panel; }
wrap
283,231
void (Component visible) { if (visible != null && !visible.isVisible()) { Container container = visible.getParent(); if (container != null) { synchronized (container.getTreeLock()) { for (Component component : container.getComponents()) { component.setVisible(component == visible); } } } } }
show
283,232
Component (Container container) { synchronized (container.getTreeLock()) { for (Component component : container.getComponents()) { if (component.isVisible()) return component; } } return null; }
getComponent
283,233
Dimension (Container container, Dimension size) { Insets insets = container.getInsets(); if (insets != null) { int width = size.width + insets.left + insets.right; if (size.width < width) size.width = width; int height = size.height + insets.top + insets.bottom; if (size.height < height) size.height = height; } return ...
getSize
283,234
void (String name, Component component) { addLayoutComponent(component, name); }
addLayoutComponent
283,235
void (Component component, Object constraints) { if (constraints != null) throw new IllegalArgumentException("unsupported constraints: " + constraints); Container container = component.getParent(); component.setVisible(container != null && 0 < container.getComponentCount()); }
addLayoutComponent
283,236
void (Component component) { }
removeLayoutComponent
283,237
void (Container container) { }
invalidateLayout
283,238
float (Container container) { Component component = getComponent(container); return component != null ? component.getAlignmentX() : Component.CENTER_ALIGNMENT; }
getLayoutAlignmentX
283,239
float (Container container) { Component component = getComponent(container); return component != null ? component.getAlignmentY() : Component.CENTER_ALIGNMENT; }
getLayoutAlignmentY
283,240
Dimension (Container container) { Component component = getComponent(container); return getSize(container, component != null ? component.getPreferredSize() : new Dimension()); }
preferredLayoutSize
283,241
Dimension (Container container) { Component component = getComponent(container); return getSize(container, component != null ? component.getMinimumSize() : new Dimension()); }
minimumLayoutSize
283,242
Dimension (Container container) { Component component = getComponent(container); return getSize(container, component != null ? component.getMaximumSize() : new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); }
maximumLayoutSize
283,243
void (Container container) { synchronized (container.getTreeLock()) { boolean logged = false; boolean updated = false; for (Component component : container.getComponents()) { if (component.isVisible()) { if (!updated) { updated = true; Dimension min = component.getMinimumSize(); Dimension max = component.getMaximumSize...
layoutContainer
283,244
Component (Component comp) { ((JComponent) comp).setAlignmentX(0f); return super.add(comp); }
add
283,245
Component (Component comp) { ((JComponent) comp).setAlignmentY(0f); return super.add(comp); }
add
283,246
Component (Component aComponent) { return myBox.add(aComponent); }
add
283,247
void (Component aComponent) { myBox.remove(aComponent); }
remove
283,248
void () { myBox.removeAll(); }
removeAll
283,249
void (BiConsumer<? super Crumb, ? super InputEvent> consumer) { hover = hover.andThen(consumer); }
onHover
283,250
void (BiConsumer<? super Crumb, ? super InputEvent> consumer) { select = select.andThen(consumer); }
onSelect
283,251
boolean (Crumb crumb) { return hovered == crumb; }
isHovered
283,252
boolean (Crumb crumb) { return selected == crumb; }
isSelected
283,253
boolean (Crumb crumb) { for (CrumbView view : views) { if (view.crumb != null) { if (view.crumb == crumb) return false; if (isSelected(view.crumb)) break; } } return true; }
isAfterSelected
283,254
Crumb (int x, int y) { for (CrumbView view : views) { if (view.contains(x, y)) return view.crumb; } return null; }
getCrumbAt
283,255
Iterable<Crumb> () { return views.stream().map(view -> view.crumb).filter(crumb -> crumb != null).collect(toList()); }
getCrumbs
283,256
void (@NotNull Iterable<? extends Crumb> crumbs) { CrumbView view = null; int index = 0; for (Crumb crumb : crumbs) { if (crumb != null) { if (index < views.size()) { view = views.get(index++); view.initialize(crumb); } else { view = new CrumbView(view, crumb); views.add(view); index++; } } } while (index < views.size(...
setCrumbs
283,257
int (int width, int height) { return views.isEmpty() ? -1 : views.get(0).getBaseline(); }
getBaseline
283,258
void (Graphics g) { // this custom component does not have a corresponding UI, // so we should care of painting its background if (isOpaque()) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); } if (g instanceof Graphics2D g2d) { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHin...
paintComponent
283,259
void (Graphics2D g, int x, int y, int width, int height, Crumb crumb, int thickness) { if (thickness > 0) { Color foreground = getMarkerForeground(crumb); if (foreground != null) { g.setColor(foreground); g.fillRect(x, y + height - thickness, width, thickness); } } }
paintMarker
283,260
Color (Crumb crumb) { if (!Registry.is("editor.breadcrumbs.marker")) return null; CrumbView found = getCrumbView(view -> view.crumb == crumb); Color foreground = found == null ? null : found.foreground; if (foreground == null) return null; double alpha = Registry.doubleValue("editor.breadcrumbs.marker.alpha"); return C...
getMarkerForeground
283,261
Font (Crumb crumb) { Font font = getFont(); if (font == null) return null; int old = font.getStyle(); if (font != cache[old]) { for (int i = 0; i < cache.length; i++) { cache[i] = i == old ? font : null; } } int style = getFontStyle(crumb); if (style == old) return font; Font cached = cache[style]; if (cached != null) ...
getFont
283,262
Font () { Font font = super.getFont(); return font != null ? RelativeFont.NORMAL.fromResource("Breadcrumbs.fontSizeOffset", 0).derive(font) : null; }
getFont
283,263
int (Crumb crumb) { TextAttributes attributes = getAttributes(crumb); return attributes == null ? Font.PLAIN : attributes.getFontType(); }
getFontStyle
283,264
Color (Crumb crumb) { TextAttributes attributes = getAttributes(crumb); Color foreground = attributes == null ? null : attributes.getForegroundColor(); return foreground != null ? foreground : getForeground(); }
getForeground
283,265
Color (Crumb crumb) { TextAttributes attributes = getAttributes(crumb); return attributes == null ? null : attributes.getBackgroundColor(); }
getBackground
283,266
Color (Crumb crumb) { TextAttributes attributes = getAttributes(crumb); return attributes == null ? null : attributes.getEffectColor(); }
getEffectColor
283,267
EffectType (Crumb crumb) { TextAttributes attributes = getAttributes(crumb); return attributes == null ? null : attributes.getEffectType(); }
getEffectType
283,268
EffectPainter (EffectType type) { if (type == EffectType.STRIKEOUT) return EffectPainter.STRIKE_THROUGH; if (type == EffectType.WAVE_UNDERSCORE) return EffectPainter.WAVE_UNDERSCORE; if (type == EffectType.LINE_UNDERSCORE) return EffectPainter.LINE_UNDERSCORE; if (type == EffectType.BOLD_LINE_UNDERSCORE) return EffectP...
getEffectPainter
283,269
TextAttributes (Crumb crumb) { return null; }
getAttributes
283,270
CrumbView (Predicate<? super CrumbView> predicate) { for (CrumbView view : views) if (view.crumb != null && predicate.test(view)) return view; return null; }
getCrumbView
283,271
void (Dimension size, int scale) { for (CrumbView view : views) { if (view.crumb != null) { if (view.font == null) view.update(); size.width += view.preferred.width; if (size.height < view.preferred.height) { size.height = view.preferred.height; } } } if (size.height == 0) { Font font = getFont(); if (font != null) { F...
updatePreferredSize
283,272
int () { Font font = getFont(); if (font != null) { int size = font.getSize(); if (size > 10) return size / 10; } return 1; }
getScale
283,273
float (Font font) { return font == null ? JBUIScale.DEF_SYSTEM_FONT_SIZE : font.getSize2D(); }
getFontSize
283,274
Dimension (Container container) { Dimension size = new Dimension(); if (container instanceof Breadcrumbs breadcrumbs) { breadcrumbs.updatePreferredSize(size, breadcrumbs.getScale()); } JBInsets.addTo(size, container.getInsets()); return size; }
preferredLayoutSize
283,275
void (Container container) { if (container instanceof Breadcrumbs breadcrumbs) { Rectangle bounds = new Rectangle(breadcrumbs.getWidth(), breadcrumbs.getHeight()); JBInsets.removeFrom(bounds, breadcrumbs.getInsets()); int scale = breadcrumbs.getScale(); for (CrumbView view : breadcrumbs.views) { if (view.crumb != null)...
layoutContainer
283,276
void (MouseEvent event) { if (!event.isConsumed()) { Crumb crumb = null; BiConsumer<Crumb, InputEvent> consumer = null; switch (event.getID()) { case MouseEvent.MOUSE_MOVED: case MouseEvent.MOUSE_ENTERED: crumb = getCrumbAt(event.getX(), event.getY()); case MouseEvent.MOUSE_EXITED: if (!isHovered(crumb)) consumer = hov...
handle
283,277
void () { icon = crumb.getIcon(); if (icon != null) { crumbIconWidth = icon.getIconWidth(); crumbIconHeight = icon.getIconHeight(); } else { crumbIconWidth = 0; crumbIconHeight = 0; } text = crumb.getText(); font = getFont(crumb); foreground = getForeground(crumb); background = getBackground(crumb); effectType = getEff...
update
283,278
String (FontMetrics fm, Rectangle iconR, Rectangle textR, Rectangle viewR) { int gap = icon == null ? 0 : Math.min(icon.getIconHeight(), icon.getIconWidth()) / 4; // an icon can have two or more images: [][] return layoutCompoundLabel(fm, text, icon, CENTER, LEFT, CENTER, RIGHT, viewR, iconR, textR, gap); }
layout
283,279
Rectangle (int dx, int dy) { return new Rectangle(bounds.x + dx, bounds.y + dy, bounds.width - dx - dx, bounds.height - dy - dy); }
getBounds
283,280
void (int x, int y, int width, int height, int scale) { int left = scale * getLeftGap(); int right = scale * getRightGap(); bounds.setBounds(x + left, y, width - left - right, height); path = Registry.is("editor.breadcrumbs.marker") ? null : createPath(scale, true); }
setBounds
283,281
boolean (int x, int y) { return crumb != null && (path != null ? path.contains(x, y) : bounds.contains(x, y)); }
contains
283,282
int () { if (crumb == null) { return -1; } if (font == null) { update(); } FontMetrics fm = getFontMetrics(font); if (fm != null) { Rectangle textR = new Rectangle(); int scale = getScale(); String text = layout(fm, new Rectangle(), textR, getBounds(scale * LEFT_RIGHT, scale * TOP_BOTTOM)); if (!StringUtil.isEmpty(text...
getBaseline
283,283
void (Graphics2D g) { final Icon crumbIcon = crumb.getIcon(); if (crumbIcon != null && (crumbIcon.getIconWidth() != crumbIconWidth || crumbIcon.getIconHeight() != crumbIconHeight)) { // process size change for IconDeferrer (lazy calculated on pool thread) Breadcrumbs.this.revalidate(); Breadcrumbs.this.repaint(); retur...
paint
283,284
int () { return !Registry.is("editor.breadcrumbs.marker") ? Registry.intValue("editor.breadcrumbs.gap.left", 5) : parent != null ? 10 : 0; }
getLeftGap
283,285
int () { return !Registry.is("editor.breadcrumbs.marker") ? Registry.intValue("editor.breadcrumbs.gap.right", 9) : 0; }
getRightGap
283,286
Path2D (int scale, boolean closed) { Path2D path = new Path2D.Double(); int left = scale * getLeftGap(); int right = scale * getRightGap(); if (parent != null) { left += right; path.moveTo(bounds.x - left, bounds.y); path.lineTo(bounds.x - left + right, bounds.y + bounds.height * 0.5); } else { path.moveTo(bounds.x - l...
createPath
283,287
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleBreadcrumbs(); } return accessibleContext; }
getAccessibleContext
283,288
int () { return views.size(); }
getAccessibleChildrenCount
283,289
Accessible (int i) { if (i < views.size()) { return new AccessibleCrumb(i, views.get(i).text); } return null; }
getAccessibleChild
283,290
Accessible (Point p) { Crumb crumb = getCrumbAt(p.x, p.y); if (crumb != null) { int index = -1; for (int i = 0; i < views.size(); i++) { CrumbView view = views.get(i); if (view.crumb == crumb) { index = i; break; } } if (index != -1) { return new AccessibleCrumb(index, crumb.getText()); } } return null; }
getAccessibleAt
283,291
AccessibleContext () { return this; }
getAccessibleContext
283,292
AccessibleRole () { return AccessibleRole.PUSH_BUTTON; }
getAccessibleRole
283,293
AccessibleStateSet () { return AccessibleBreadcrumbs.this.getAccessibleStateSet(); }
getAccessibleStateSet
283,294
int () { return myIndex; }
getAccessibleIndexInParent
283,295
int () { return 0; }
getAccessibleChildrenCount
283,296
Accessible (int i) { return null; }
getAccessibleChild
283,297
Icon () { return icon; }
getIcon
283,298
String () { return tooltip; }
getTooltip
283,299
String () { return getText(); }
toString