Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
283,000
int () { ListModel<?> model = getModel(); return model == null ? 0 : model.getSize(); }
getItemsCount
283,001
StatusText () { return myEmptyText; }
getEmptyText
283,002
void (@NotNull @NlsContexts.StatusText String text) { myEmptyText.setText(text); }
setEmptyText
283,003
ExpandableItemsHandler<Integer> () { return myExpandableItemsHandler; }
getExpandableItemsHandler
283,004
ExpandableItemsHandler<Integer> () { return ExpandableItemsHandlerFactory.install(this); }
createExpandableItemsHandler
283,005
void (boolean enabled) { myExpandableItemsHandler.setEnabled(enabled); }
setExpandableItemsEnabled
283,006
void (@NotNull ListCellRenderer<? super E> cellRenderer) { // myExpandableItemsHandler may not yeb be initialized if (myExpandableItemsHandler == null) { super.setCellRenderer(cellRenderer); return; } super.setCellRenderer(new ExpandedItemListCellRendererWrapper<>(cellRenderer, myExpandableItemsHandler)); }
setCellRenderer
283,007
int (Rectangle visibleRect, int orientation, int direction) { int increment = super.getScrollableUnitIncrement(visibleRect, orientation, direction); return adjustIncrement(visibleRect, orientation, direction, increment); }
getScrollableUnitIncrement
283,008
int (Rectangle visibleRect, int orientation, int direction) { int increment = super.getScrollableBlockIncrement(visibleRect, orientation, direction); // in case of scrolling list up using a single wheel rotation, the block increment is used to calculate min scroll as // currScroll - blockIncrement // the resulting y-position of visible rect never exceed min scroll // see javax.swing.plaf.basic.BasicScrollPaneUI.Handler.mouseWheelMoved -> vertical handling part -> limitScroll return adjustIncrement(visibleRect, orientation, direction, increment); }
getScrollableBlockIncrement
283,009
int (Rectangle visibleRect, int orientation, int direction, int increment) { if (increment == 0 && orientation == SwingConstants.VERTICAL && direction < 0) { return visibleRect.y; } return increment; }
adjustIncrement
283,010
void (final @NotNull NotNullFunction<? super E, ? extends JComponent> fun) { setCellRenderer(new SelectionAwareListCellRenderer<>(fun)); }
installCellRenderer
283,011
void (@NotNull DataProvider provider) { DataManager.registerDataProvider(this, provider); }
setDataProvider
283,012
void () { getEmptyText().setText(""); }
disableEmptyText
283,013
Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (!isSelected && index % 2 == 0) { setBackground(UIUtil.getDecoratedRowColor()); } return this; }
getListCellRendererComponent
283,014
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleContextDelegateWithContextMenu(super.getAccessibleContext()) { @Override protected void doShowContextMenu() { ActionManager.getInstance().tryToExecute(ActionManager.getInstance().getAction("ShowPopupMenu"), null, null, null, true); } @Override protected Container getDelegateParent() { return getParent(); } }; } return accessibleContext; }
getAccessibleContext
283,015
void () { ActionManager.getInstance().tryToExecute(ActionManager.getInstance().getAction("ShowPopupMenu"), null, null, null, true); }
doShowContextMenu
283,016
Container () { return getParent(); }
getDelegateParent
283,017
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleJBList(); } return accessibleContext; }
getAccessibleContext
283,018
Accessible (Point p) { return getAccessibleChild(locationToIndex(p)); }
getAccessibleAt
283,019
Accessible (int i) { return i < 0 || i >= getModel().getSize() ? null : new AccessibleJBListChild(JBList.this, i); }
getAccessibleChild
283,020
AccessibleRole () { // In some cases, this method is called from the 'Access Bridge' thread instead of the AWT. // See https://code.google.com/p/android/issues/detail?id=193072 return UIUtil.invokeAndWaitIfNeeded(() -> super.getAccessibleRole()); }
getAccessibleRole
283,021
AccessibleRole () { // In some cases, this method is called from the 'Access Bridge' thread instead of the AWT. // See https://code.google.com/p/android/issues/detail?id=193072 return UIUtil.invokeAndWaitIfNeeded(() -> super.getAccessibleRole()); }
getAccessibleRole
283,022
void () { setIconTextGap(JBUIScale.scale(1)); setHorizontalAlignment(SwingConstants.LEADING); setHorizontalTextPosition(SwingConstants.LEADING); }
init
283,023
T () { return chosenItem; }
getChosenItem
283,024
Dimension () { return recomputeSize(super.getPreferredSize()); }
getPreferredSize
283,025
Dimension () { return recomputeSize(super.getMinimumSize()); }
getMinimumSize
283,026
Dimension (@NotNull Dimension size) { size.height = Math.max(size.height, JBUIScale.scale(22)); size.width = Math.max(size.width, owner.getPreferredSize().width); return size; }
recomputeSize
283,027
Component (JList<? extends T> list, T value, int index, boolean isSelected, boolean cellHasFocus) { setText(value.toString()); setEnabled(list.isEnabled()); setOpaque(true); setBackground(isSelected ? list.getSelectionBackground() : UIManager.getColor("Label.background")); setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); return this; }
getListCellRendererComponent
283,028
void (LinkLabel<Action> link, Action action) { action.actionPerformed(myEvent); }
linkSelected
283,029
void (KeyEvent e) { super.keyReleased(e); if (e.getModifiers() == 0 && e.getKeyCode() == KeyEvent.VK_SPACE) { e.consume(); doClick(); } }
keyReleased
283,030
void (FocusEvent e) { myUnderline = true; repaint(); }
focusGained
283,031
void (FocusEvent e) { myUnderline = false; repaint(); }
focusLost
283,032
void (Icon icon) { super.setIcon(icon); myInactiveIcon = icon; }
setIcon
283,033
void (Icon iconForHovering) { myHoveringIcon = iconForHovering; }
setHoveringIcon
283,034
void (LinkListener<T> listener, @Nullable T linkData) { myLinkListener = listener; myLinkData = linkData; }
setListener
283,035
T () { return myLinkData; }
getLinkData
283,036
void () { if (myClickIsBeingProcessed) return; try { myClickIsBeingProcessed = true; if (myLinkListener != null) { myLinkListener.linkSelected(this, myLinkData); } if (myVisitedLinksKey != null) { ourVisitedLinks.add(myVisitedLinksKey); } repaint(); } finally { myClickIsBeingProcessed = false; } }
doClick
283,037
boolean () { return myVisitedLinksKey != null && ourVisitedLinks.contains(myVisitedLinksKey); }
isVisited
283,038
void (Graphics g) { setForeground(getTextColor()); super.paintComponent(g); if (getText() != null) { g.setColor(getTextColor()); if (myUnderline && myPaintUnderline) { Rectangle bounds = getTextBounds(); int lineY = getUI().getBaseline(this, getWidth(), getHeight()) + 1; g.drawLine(bounds.x, lineY, bounds.x + bounds.width, lineY); } if (g instanceof Graphics2D && isFocusOwner()) { g.setColor(JBUI.CurrentTheme.Link.FOCUSED_BORDER_COLOR); Rectangle bounds = getTextBounds(); int round = Registry.intValue("ide.link.button.focus.round.arc", 4); RectanglePainter.DRAW.paint((Graphics2D)g, bounds.x, bounds.y, bounds.width, bounds.height, JBUI.scale(round)); } } }
paintComponent
283,039
Rectangle () { if (textR.isEmpty()) { updateLayoutRectangles(); } return textR; }
getTextBounds
283,040
Color () { return myIsLinkActive ? getActive() : myUnderline ? getHover() : isVisited() ? getVisited() : getNormal(); }
getTextColor
283,041
void (boolean paintUnderline) { myPaintUnderline = paintUnderline; }
setPaintUnderline
283,042
void () { super.removeNotify(); if (ScreenUtil.isStandardAddRemoveNotify(this)) { disableUnderline(); } }
removeNotify
283,043
void (boolean isActive) { myIsLinkActive = isActive; onSetActive(myIsLinkActive); repaint(); }
setActive
283,044
void (boolean active) { }
onSetActive
283,045
boolean (Point pt) { updateLayoutRectangles(); if (getIcon() != null) { iconR.width += getIconTextGap(); //todo[kb] icon at right? if (iconR.contains(pt)) { return true; } } return textR.contains(pt); }
isInClickableArea
283,046
void () { iconR.clear(); textR.clear(); final Insets insets = getInsets(null); viewR.x = insets.left; viewR.y = insets.top; viewR.width = getWidth() - (insets.left + insets.right); viewR.height = getHeight() - (insets.top + insets.bottom); SwingUtilities.layoutCompoundLabel(this, getFontMetrics(getFont()), getText(), isEnabled() ? getIcon() : getDisabledIcon(), getVerticalAlignment(), getHorizontalAlignment(), getVerticalTextPosition(), getHorizontalTextPosition(), viewR, iconR, textR, getIconTextGap()); }
updateLayoutRectangles
283,047
Point () { isInClickableArea(new Point(0, 0)); //to update textR before clicking return new Point(textR.x + textR.width / 2, textR.y + textR.height / 2); }
getTextRectangleCenter
283,048
void () { UIUtil.setCursor(this, Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); myUnderline = true; if (myHoveringIcon != null) { super.setIcon(myHoveringIcon); } setStatusBarText(getStatusBarText()); repaint(); }
enableUnderline
283,049
void () { UIUtil.setCursor(this, Cursor.getDefaultCursor()); myUnderline = false; super.setIcon(myInactiveIcon); setStatusBarText(null); setActive(false); }
disableUnderline
283,050
void (@NlsContexts.StatusBarText String statusBarText) { if (ApplicationManager.getApplication() == null || !LoadingState.COMPONENTS_REGISTERED.isOccurred()) return; // makes this component work in UIDesigner preview. final Project[] projects = ProjectManager.getInstance().getOpenProjects(); for (Project project : projects) { StatusBar.Info.set(statusBarText, project); } }
setStatusBarText
283,051
Color () { return JBUI.CurrentTheme.Link.Foreground.VISITED; }
getVisited
283,052
Color () { return JBUI.CurrentTheme.Link.Foreground.PRESSED; }
getActive
283,053
Color () { return JBUI.CurrentTheme.Link.Foreground.ENABLED; }
getNormal
283,054
Color () { return JBUI.CurrentTheme.Link.Foreground.HOVERED; }
getHover
283,055
void (MouseEvent e) { enableUnderline(); }
entered
283,056
void (MouseEvent e) { disableUnderline(); }
exited
283,057
void (MouseEvent e) { doClick(e); }
pressed
283,058
void (MouseEvent e) { if (isEnabled() && isInClickableArea(e.getPoint())) { setActive(true); e.consume(); } }
mousePressed
283,059
void (MouseEvent e) { if (isEnabled() && myIsLinkActive && isInClickableArea(e.getPoint())) { doClick(e); e.consume(); } setActive(false); }
mouseReleased
283,060
void (MouseEvent e) { if (isEnabled() && isInClickableArea(e.getPoint())) { enableUnderline(); } else { disableUnderline(); } }
mouseMoved
283,061
void (MouseEvent e) { disableUnderline(); }
mouseExited
283,062
void (MouseEvent e) { }
mouseDragged
283,063
void (InputEvent e) { doClick(); }
doClick
283,064
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleLinkLabel(); } return accessibleContext; }
getAccessibleContext
283,065
AccessibleRole () { return AccessibleRole.HYPERLINK; }
getAccessibleRole
283,066
int () { return 1; }
getAccessibleActionCount
283,067
String (int i) { if (i == 0) { return UIManager.getString("AbstractButton.clickText"); } else { return null; } }
getAccessibleActionDescription
283,068
boolean (int i) { if (i == 0) { doClick(); return true; } else { return false; } }
doAccessibleAction
283,069
void (LinkLabel<Object> aSource, Object aLinkData) { ActionUtil.invokeAction(myAction, ActionLink.this, place, myEvent, onDone); }
linkSelected
283,070
void (InputEvent e) { myEvent = e; super.doClick(); }
doClick
283,071
Color () { return myVisitedColor == null ? super.getVisited() : myVisitedColor; }
getVisited
283,072
Color () { return myActiveColor == null ? super.getActive() : myActiveColor; }
getActiveColor
283,073
Color () { return myUnderline ? getActiveColor() : getNormal(); }
getTextColor
283,074
Color () { return myNormalColor == null ? super.getNormal() : myNormalColor; }
getNormal
283,075
void (Color visitedColor) { myVisitedColor = visitedColor; }
setVisitedColor
283,076
void (Color activeColor) { myActiveColor = activeColor; }
setActiveColor
283,077
void (Color normalColor) { myNormalColor = normalColor; }
setNormalColor
283,078
Object (@NotNull @NonNls String dataId) { if (PlatformDataKeys.DOMINANT_HINT_AREA_RECTANGLE.is(dataId)) { final Point p = SwingUtilities.getRoot(this).getLocationOnScreen(); return new Rectangle(p.x, p.y + getHeight(), 0, 0); } if (PlatformDataKeys.CONTEXT_MENU_POINT.is(dataId)) { return SwingUtilities.convertPoint(this, 0, getHeight(), UIUtil.getRootPane(this)); } return myAction instanceof DataProvider ? ((DataProvider)myAction).getData(dataId) : null; }
getData
283,079
AnAction () { return myAction; }
getAction
283,080
void (@NlsContexts.Label String text) { super.setText(toHtml(text)); }
setText
283,081
Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final JLabel label = (JLabel)super.getListCellRendererComponent(list, myToString.fun(value), index, isSelected, cellHasFocus); myChecked = (value == myValue); if (myChecked) { label.setIcon(getIcon(isSelected)); } else { label.setIcon(getEmptyIcon()); } GraphicsUtil.setAntialiasingType(label, AntialiasingType.getAAHintForSwingComponent()); return label; }
getListCellRendererComponent
283,082
Icon () { if (myEmptyIcon == null) { myEmptyIcon = EmptyIcon.create(getIcon(true).getIconWidth()); } return myEmptyIcon; }
getEmptyIcon
283,083
Icon (boolean selected) { final boolean small = "small".equals(JBComboBoxTableCellEditorComponent.this.getClientProperty("JComponent.sizeVariant")); return small ? selected ? PlatformIcons.CHECK_ICON_SMALL_SELECTED : PlatformIcons.CHECK_ICON_SMALL : selected ? PlatformIcons.CHECK_ICON_SELECTED : PlatformIcons.CHECK_ICON; }
getIcon
283,084
AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleRenderer(); } return accessibleContext; }
getAccessibleContext
283,085
AccessibleRole () { return AccessibleRole.CHECK_BOX; }
getAccessibleRole
283,086
AccessibleStateSet () { AccessibleStateSet set = super.getAccessibleStateSet(); if (myChecked) { set.add(AccessibleState.CHECKED); } return set; }
getAccessibleStateSet
283,087
void (JTable table, int row, int column) { setTable(table); setRow(row); setColumn(column); }
setCell
283,088
void (JTable table) { myTable = table; }
setTable
283,089
void (int row) { myRow = row; }
setRow
283,090
void (int column) { myColumn = column; }
setColumn
283,091
Object[] () { return myOptions; }
getOptions
283,092
void (Object... options) { myOptions = options; }
setOptions
283,093
void () { super.addNotify(); initAndShowPopup(); }
addNotify
283,094
void () { myList.removeAll(); myList.setModel(JBList.createDefaultListModel(myOptions)); if (myRenderer != null) { myList.setCellRenderer(myRenderer); } final Rectangle rect = myTable.getCellRect(myRow, myColumn, true); Point point = new Point(rect.x, rect.y); final boolean surrendersFocusOnKeystrokeOldValue = myTable instanceof JBTable ? ((JBTable)myTable).surrendersFocusOnKeyStroke() : myTable.getSurrendersFocusOnKeystroke(); final JBPopup popup = JBPopupFactory.getInstance() .createListPopupBuilder(myList) .setItemChosenCallback(() -> { myValue = myList.getSelectedValue(); final ActionEvent event = new ActionEvent(myList, ActionEvent.ACTION_PERFORMED, "elementChosen"); for (ActionListener listener : myListeners) { listener.actionPerformed(event); } TableUtil.stopEditing(myTable); myTable.setValueAt(myValue, myRow, myColumn); // on Mac getCellEditorValue() called before myValue is set. myTable.tableChanged(new TableModelEvent(myTable.getModel(), myRow)); // force repaint }) .setCancelCallback(() -> { TableUtil.stopEditing(myTable); return true; }) .addListener(new JBPopupListener() { @Override public void beforeShown(@NotNull LightweightWindowEvent event) { myTable.setSurrendersFocusOnKeystroke(false); } @Override public void onClosed(@NotNull LightweightWindowEvent event) { myTable.setSurrendersFocusOnKeystroke(surrendersFocusOnKeystrokeOldValue); } }) .setMinSize(myWide ? new Dimension(((int)rect.getSize().getWidth()), -1) : null) .createPopup(); popup.show(new RelativePoint(myTable, point)); }
initAndShowPopup
283,095
void (@NotNull LightweightWindowEvent event) { myTable.setSurrendersFocusOnKeystroke(false); }
beforeShown
283,096
void (@NotNull LightweightWindowEvent event) { myTable.setSurrendersFocusOnKeystroke(surrendersFocusOnKeystrokeOldValue); }
onClosed
283,097
void (boolean wide) { this.myWide = wide; }
setWide
283,098
Object () { return myValue; }
getEditorValue
283,099
void (ListCellRenderer renderer) { myRenderer = renderer; }
setRenderer