Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
281,900
Component (JList<? extends T> list, T value, int index, boolean selected, boolean hasFocus) { clear(); setFont(list.getFont()); mySelected = selected; myForeground = isEnabled() ? list.getForeground() : UIUtil.getLabelDisabledForeground(); mySelectionForeground = list.getSelectionForeground(); if (UIUtil.isUnderWin10Lo...
getListCellRendererComponent
281,901
void (@NotNull String fragment, @NotNull SimpleTextAttributes attributes, boolean isMainText) { if (mySelected) { super.append(fragment, new SimpleTextAttributes(attributes.getStyle(), mySelectionForeground), isMainText); } else if (attributes.getFgColor() == null) { super.append(fragment, attributes.derive(-1, myForeg...
append
281,902
void () { // no need for this in a renderer }
revalidateAndRepaint
281,903
Dimension () { // There is a bug in BasicComboPopup. It does not add renderer into CellRendererPane, // so font can be null here. Font oldFont = getFont(); if (oldFont == null) { setFont(UIUtil.getListFont()); } Dimension result = super.getPreferredSize(); if (oldFont == null) { setFont(null); } return UIUtil.updateLis...
getPreferredSize
281,904
void () { JComponent mainComponent = createMainComponent(); JButton[] buttons = createButtons(); @Nls String labelText = getLabelText(); if (labelText != null) { setBorder(IdeBorderFactory.createTitledBorder(labelText, false)); } add( mainComponent, new GridBagConstraints(0, 1, 1, buttons.length == 0 ? 1 : buttons.leng...
initPanel
281,905
void () { super.createComponent(); TextFieldWithBrowseButton.MyDoClickAction doClickAction = getDoClickAction(); if (doClickAction != null) { doClickAction.registerShortcut(myComboBox); } myComboBox.setMaximumRowCount(8); myComboBox.setEditable(true); final JTextField editorComponent = (JTextField)myComboBox.getEditor(...
createComponent
281,906
void (@NotNull DocumentEvent e) { final String text = getText(); if (!Comparing.equal(text, oldText, true)) { oldText = text; final Runnable changeListener = getChangeListener(); if (changeListener != null) { changeListener.run(); } } }
textChanged
281,907
String () { final Object selectedItem = myComboBox.isEditable()? myComboBox.getEditor().getItem() : myComboBox.getSelectedItem(); return selectedItem instanceof String ? (String)selectedItem : null; }
getText
281,908
void (String text) { myComboBox.setSelectedItem(text); }
setText
281,909
JComboBox () { return myComboBox; }
getComboBox
281,910
void (Object[] items) { myComboBox.removeAllItems(); for (Object item : items) { myComboBox.addItem(item); } }
setItems
281,911
void (@NlsContexts.ListItem String text) { JComboBox comboBox = getComboBox(); int n = comboBox.getItemCount(); boolean found = false; for (int i = 0; i < n; i++) { String item = (String)comboBox.getItemAt(i); if (Comparing.strEqual(item, text)) { found = true; break; } } if (!found) { comboBox.addItem(text); } comboBo...
addItemSetText
281,912
IdeUICustomization () { return ApplicationManager.getApplication().getService(IdeUICustomization.class); }
getInstance
281,913
String () { return UIBundle.message("tool.window.name.version.control"); }
getVcsToolWindowName
281,914
boolean (@NotNull MouseEvent event, int clickCount) { if (clickCount == 2 && event.getButton() == MouseEvent.BUTTON1) { return onDoubleClick(event); } return false; }
onClick
281,915
void (final @NotNull JTable table, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; table.setDragEnabled(true); installImpl(table, model); }
install
281,916
void (final @NotNull JList list, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; list.setDragEnabled(true); installImpl(list, model); }
install
281,917
void (final @NotNull JTree tree, final @NotNull EditableModel model) { if (GraphicsEnvironment.isHeadless()) return; tree.setDragEnabled(true); installImpl(tree, model); }
install
281,918
void (final @NotNull JComponent component, final @NotNull EditableModel model) { component.setTransferHandler(new TransferHandler(null)); SmoothAutoScroller.installDropTargetAsNecessary(component); DnDSupport.createBuilder(component) .setBeanProvider(info -> { final Point p = info.getPoint(); return new DnDDragStartBea...
installImpl
281,919
boolean (DnDEvent event) { final Object o = event.getAttachedObject(); if (! (o instanceof RowDragInfo) || ((RowDragInfo)o).component != component) { event.setDropPossible(false, ""); return true; } event.setDropPossible(true); int oldIndex = ((RowDragInfo)o).row; int newIndex = getRow(component, event.getPoint()); if ...
update
281,920
void (DnDEvent event) { final Object o = event.getAttachedObject(); final Point p = event.getPoint(); if (o instanceof RowDragInfo && ((RowDragInfo)o).component == component) { int oldIndex = ((RowDragInfo)o).row; if (oldIndex == -1) return; int newIndex = getRow(component, p); if (newIndex == -1) { newIndex = getRowCo...
drop
281,921
int (JComponent component, Point point) { if (component instanceof JTable) { return ((JTable)component).rowAtPoint(point); } else if (component instanceof JList) { return ((JList<?>)component).locationToIndex(point); } else if (component instanceof JTree) { return ((JTree)component).getClosestRowForLocation(point.x, po...
getRow
281,922
int (JComponent component) { if (component instanceof JTable) { return ((JTable)component).getRowCount(); } else if (component instanceof JList) { return ((JList)component).getModel().getSize(); } else if (component instanceof JTree) { return ((JTree)component).getRowCount(); } else { throw new IllegalArgumentException...
getRowCount
281,923
Rectangle (JComponent component, int row) { if (component instanceof JTable) { Rectangle rectangle = ((JTable)component).getCellRect(row, 0, true); rectangle.width = component.getWidth(); return rectangle; } else if (component instanceof JList) { return ((JList<?>)component).getCellBounds(row, row); } else if (componen...
getCellBounds
281,924
void (JComponent component, int row) { if (component instanceof JTable) { ((JTable)component).getSelectionModel().setSelectionInterval(row, row); } else if (component instanceof JList) { ((JList<?>)component).setSelectedIndex(row); } else if (component instanceof JTree) { ((JTree)component).setSelectionRow(row); } else...
setSelectedRow
281,925
record (JComponent component, int row) { }
RowDragInfo
281,926
void (@Nls String text, TextAttributes attributes) { int startOffset = myBuffer.length(); myBuffer.append(text); if (attributes != null) { myHighlightedRegions.add(new HighlightedRegion(startOffset, myBuffer.length(), attributes)); } }
appendText
281,927
void (char[] text, TextAttributes attributes) { int startOffset = myBuffer.length(); myBuffer.append(text); if (attributes != null) { myHighlightedRegions.add(new HighlightedRegion(startOffset, myBuffer.length(), attributes)); } }
appendText
281,928
boolean (Object o) { if (!(o instanceof HighlightedText highlightedText)) return false; return StringUtil.equals(myBuffer, highlightedText.myBuffer) && myHighlightedRegions.equals(highlightedText.myHighlightedRegions); }
equals
281,929
void (HighlightableComponent renderer) { renderer.setText(myBuffer.toString()); for (HighlightedRegion info : myHighlightedRegions) { renderer.addHighlighter(info.startOffset, info.endOffset, info.textAttributes); } }
applyToComponent
281,930
void (boolean hideLine) { myHideLine = hideLine; }
setHideLine
281,931
Dimension () { Dimension size; if (getCaption() == null) { size = new Dimension(Math.max(myPrefWidth, 0), 0); } else { size = getLabelSize(myLabelInsets); } if (!myHideLine) size.height += lineInsets.top + lineInsets.bottom + 1; JBInsets.addTo(size, getInsets()); return size; }
getPreferredElementSize
281,932
void (Graphics g) { g.setColor(getForeground()); Rectangle bounds = new Rectangle(getWidth(), getHeight()); JBInsets.removeFrom(bounds, getInsets()); if (!myHideLine) { paintLine(g, bounds); int lineHeight = lineInsets.top + lineInsets.bottom + 1; bounds.y += lineHeight; bounds.height -= lineHeight; } String caption = ...
paintComponent
281,933
void (Graphics g, Rectangle bounds) { int x = bounds.x + lineInsets.left; int width = bounds.width - lineInsets.left - lineInsets.right; int y = bounds.y + lineInsets.top; FILL.paint((Graphics2D)g, x, y, width, 1, null); }
paintLine
281,934
void (@NotNull AnActionEvent e) { boolean state = !isSelected(e); setSelected(e, state); Presentation presentation = e.getPresentation(); Toggleable.setSelected(presentation, state); }
actionPerformed
281,935
void (@NotNull AnActionEvent e) { boolean selected = isSelected(e); Toggleable.setSelected(e.getPresentation(), selected); }
updateButton
281,936
void (@NotNull HyperlinkEvent e) { URL url = e.getURL(); if (url != null) { BrowserUtil.browse(url); // e.getURL() provides href with base URL if <base> tag is added in a document } else { BrowserUtil.browse(e.getDescription()); } }
hyperlinkActivated
281,937
AnActionButton (@NotNull Listener listener, String name, @NotNull Icon icon) { return new AddButton(listener, name == null ? getText() : name, icon); }
createButton
281,938
AnActionButton (@NotNull Listener listener, String name, @NotNull Icon icon) { return new RemoveButton(listener, name == null ? getText() : name, icon); }
createButton
281,939
AnActionButton (@NotNull Listener listener, String name, @NotNull Icon icon) { return new EditButton(listener, name == null ? getText() : name, icon); }
createButton
281,940
AnActionButton (@NotNull Listener listener, String name, @NotNull Icon icon) { return new UpButton(listener, name == null ? getText() : name, icon); }
createButton
281,941
AnActionButton (@NotNull Listener listener, String name, @NotNull Icon icon) { return new DownButton(listener, name == null ? getText() : name, icon); }
createButton
281,942
Icon () { return myIcon; }
getIcon
281,943
ActionToolbar () { return myToolbar; }
getToolbar
281,944
void (JComponent label, ActionToolbarPosition position) { removeAll(); add(label, ToolbarDecorator.getPlacement(position)); if (position == ActionToolbarPosition.LEFT) add(myToolbar.getComponent(), BorderLayout.EAST); else if (position == ActionToolbarPosition.RIGHT) add(myToolbar.getComponent(), BorderLayout.WEST); el...
setToolbarLabel
281,945
void () { if (getBackground() != null && !getBackground().equals(UIUtil.getPanelBackground())) { SwingUtilities.updateComponentTreeUI(this.getParent()); } for (AnAction button : myActions) { ShortcutSet shortcut; if (button instanceof AnActionButton anActionButton) { shortcut = anActionButton.getShortcut(); } else { sh...
addNotify
281,946
void (final MyActionButton removeButton) { new AnAction(IdeBundle.messagePointer("action.Anonymous.text.delete.hook")) { @Override public void actionPerformed(@NotNull AnActionEvent e) { removeButton.actionPerformed(e); } @Override public boolean isDumbAware() { return removeButton.isDumbAware(); } @Override public voi...
registerDeleteHook
281,947
void (@NotNull AnActionEvent e) { removeButton.actionPerformed(e); }
actionPerformed
281,948
boolean () { return removeButton.isDumbAware(); }
isDumbAware
281,949
void (@NotNull AnActionEvent e) { final JComponent contextComponent = removeButton.getContextComponent(); if (contextComponent instanceof JTable && ((JTable)contextComponent).isEditing()) { e.getPresentation().setEnabled(false); return; } final SpeedSearchSupply supply = SpeedSearchSupply.getSupply(contextComponent); i...
update
281,950
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
281,951
void (Buttons button, boolean enabled) { AnAction b = myButtons.get(button); if (b instanceof AnActionButton anActionButton) { anActionButton.setEnabled(enabled); } }
setEnabled
281,952
void (@NotNull Buttons button, ShortcutSet @Nullable ... shortcutSets) { if (shortcutSets != null) { if (myCustomShortcuts == null) myCustomShortcuts = new EnumMap<>(Buttons.class); myCustomShortcuts.put(button, new CompositeShortcutSet(shortcutSets)); } else { if (myCustomShortcuts != null) { myCustomShortcuts.remove(...
setCustomShortcuts
281,953
ActionToolbarPosition () { return myPosition; }
getPosition
281,954
RelativePoint (@NotNull AnAction action, @Nullable Component contextComponent) { var c = contextComponent; ActionToolbar toolbar = null; while (c != null && (c = c.getParent()) != null) { if (c instanceof JComponent && (toolbar = (ActionToolbar)((JComponent)c).getClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY...
getPreferredPopupPoint
281,955
ShortcutSet () { return getCommonShortcut(myButton); }
getShortcut
281,956
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled( isEnabled() && isContextComponentShowingAndEnabled() && isContextComponentStateAllowingAction() && isEventAllowingAction(e) ); }
updateButton
281,957
boolean () { final var component = getContextComponent(); return component != null && component.isShowing() && component.isEnabled(); }
isContextComponentShowingAndEnabled
281,958
boolean () { final var c = getContextComponent(); if (c instanceof JTable || c instanceof JList) { final ListSelectionModel model = c instanceof JTable ? ((JTable)c).getSelectionModel() : ((JList<?>)c).getSelectionModel(); final int size = c instanceof JTable ? ((JTable)c).getRowCount() : ((JList<?>)c).getModel().getSi...
isContextComponentStateAllowingAction
281,959
boolean (AnActionEvent e) { return true; }
isEventAllowingAction
281,960
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
281,961
boolean (int size, int min, int max) { return true; }
isEnabled
281,962
void (@NotNull AnActionEvent e) { myListener.doAdd(); }
actionPerformed
281,963
boolean (int size, int min, int max) { return size > 0; }
isEnabled
281,964
void (@NotNull AnActionEvent e) { myListener.doRemove(); }
actionPerformed
281,965
boolean (AnActionEvent e) { final var c = getContextComponent(); final var inputEvent = e.getInputEvent(); if ( inputEvent instanceof KeyEvent && c instanceof JTable && ((JTable)c).isEditing() && !(inputEvent.getComponent() instanceof ActionButtonComponent) // action button active in any case in the toolbar ) { return ...
isEventAllowingAction
281,966
boolean (int size, int min, int max) { return size > 0 && min == max && min >= 0; }
isEnabled
281,967
void (@NotNull AnActionEvent e) { myListener.doEdit(); }
actionPerformed
281,968
boolean (int size, int min, int max) { return size > 0 && min >= 1; }
isEnabled
281,969
void (@NotNull AnActionEvent e) { myListener.doUp(); }
actionPerformed
281,970
boolean (int size, int min, int max) { return size > 0 && max < size-1; }
isEnabled
281,971
void (@NotNull AnActionEvent e) { myListener.doDown(); }
actionPerformed
281,972
ShortcutSet (@NotNull Buttons button) { return switch (button) { case ADD -> CommonShortcuts.getNewForDialogs(); case EDIT -> CustomShortcutSet.fromString("ENTER"); case REMOVE -> CustomShortcutSet.fromString(SystemInfo.isMac ? "meta BACK_SPACE" : "alt DELETE"); case UP -> CommonShortcuts.MOVE_UP; case DOWN -> CommonSh...
getCommonShortcut
281,973
void (String name, Component comp) { super.addLayoutComponent(name, comp); myMap.put(name, comp); }
addLayoutComponent
281,974
void (Component comp) { stopSwipeIfNeeded(); super.removeLayoutComponent(comp); for (Iterator<Map.Entry<String, Component>> iterator = myMap.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry<String, Component> entry = iterator.next(); if (entry.getValue() == comp) { iterator.remove(); break; } } }
removeLayoutComponent
281,975
void (Container parent) { if (!myTimer.isRunning()) { super.layoutContainer(parent); } }
layoutContainer
281,976
void (final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction) { swipe(parent, name, direction, null); }
swipe
281,977
void (final @NotNull Container parent, final @NotNull String name, @NotNull SwipeDirection direction, final @Nullable Runnable onDone) { stopSwipeIfNeeded(); mySwipeFrom = findVisible(parent); mySwipeTo = myMap.get(name); if (mySwipeTo == null) return; Application app = ApplicationManager.getApplication(); if (mySwipeF...
swipe
281,978
void (ActionEvent e) { long timePassed = System.currentTimeMillis() - startTime; if (timePassed >= mySwipeTime) { Component currentFocusComponent = IdeFocusManager.getGlobalInstance().getFocusedDescendantFor(parent); show(parent, name); if (currentFocusComponent != null) currentFocusComponent.requestFocusInWindow(); if...
actionPerformed
281,979
void () { if (myTimer.isRunning()) { myTimer.stop(); mySwipeFrom = null; if (mySwipeTo != null) { mySwipeTo.setVisible(false); mySwipeTo = null; } } }
stopSwipeIfNeeded
281,980
void (Container parent) { stopSwipeIfNeeded(); super.first(parent); }
first
281,981
void (Container parent) { stopSwipeIfNeeded(); super.next(parent); }
next
281,982
void (Container parent) { stopSwipeIfNeeded(); super.previous(parent); }
previous
281,983
void (Container parent) { stopSwipeIfNeeded(); super.last(parent); }
last
281,984
void (Container parent, String name) { stopSwipeIfNeeded(); super.show(parent, name); }
show
281,985
void (ActionEvent e) { cursor[0]--; if (cursor[0] < 0) { cursor[0] = 9; } cardLayout.swipe(centerPanel, "page" + cursor[0], SwipeDirection.BACKWARD); }
actionPerformed
281,986
void (ActionEvent e) { cursor[0] = (cursor[0] + 1) % 10; cardLayout.swipe(centerPanel, "page" + cursor[0], SwipeDirection.FORWARD); }
actionPerformed
281,987
Component (String id) { return myMap.get(id); }
findComponentById
281,988
List<AnAction> (@NotNull List<? extends AnAction> actions, @NotNull DataContext context) { final SortedList<AnAction> result = new SortedList<>(ACTION_BUTTONS_SORTER); result.addAll(actions); return result; }
promote
281,989
void (Component c, Graphics g, int x, int y, int width, int height) { Point textLoc = new Point(); Border border = getBorder(); if (getTitle() == null || getTitle().length() == 0) { if (border != null) { border.paintBorder(c, g, x, y, width, height); } return; } Rectangle grooveRect = new Rectangle(x + EDGE_SPACING, y ...
paintBorder
281,990
boolean (Rectangle dest, int rx, int ry, int rw, int rh) { int x1 = Math.max(rx, dest.x); int x2 = Math.min(rx + rw, dest.x + dest.width); int y1 = Math.max(ry, dest.y); int y2 = Math.min(ry + rh, dest.y + dest.height); dest.x = x1; dest.y = y1; dest.width = x2 - x1; dest.height = y2 - y1; if (dest.width <= 0 || dest.h...
computeIntersection2
281,991
List<Fragment> (@NotNull @Nls String htmlString, SimpleTextAttributes defaultAttributes) { TextAttributesStack attributesStack = new TextAttributesStack(defaultAttributes); List<Fragment> res = new ArrayList<>(); HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback() { @Override public void handleTe...
convert
281,992
void (char[] data, int pos) { res.add(new Fragment(new String(data), attributesStack.peek())); }
handleText
281,993
void (HTML.Tag t, MutableAttributeSet a, int pos) { String tagName = t.toString(); SimpleTextAttributes attributesByTag = myStyleTagHandler.calcAttributes(t, a); if (attributesByTag != null) { SimpleTextAttributes newAttributes = merge( attributesStack.peek(), attributesByTag); attributesStack.push(tagName, newAttribut...
handleStartTag
281,994
void (HTML.Tag t, int pos) { attributesStack.removeFromTop(t.toString()); }
handleEndTag
281,995
void (String errorMsg, int pos) { //since <body> tag may be skipped for this parser if (errorMsg.startsWith("start.missing body")) return; // style attribute can be processed by StyleTagHandler if (errorMsg.startsWith("invalid.tagatt style")) return; LOG.error("Cannot parse HTML: [" + htmlString + "]", errorMsg); }
handleError
281,996
void (@NotNull SimpleColoredComponent component, @NotNull @Nls String html, @NotNull SimpleTextAttributes defaultAttributes) { convert(html, defaultAttributes).forEach(fragment -> component.append(fragment.myText, fragment.myAttributes)); }
appendHtml
281,997
SimpleTextAttributes () { return myAttributes; }
getAttributes
281,998
void (@NotNull String tagName, @NotNull SimpleTextAttributes attributes) { myStack.push(Pair.create(tagName, attributes)); }
push
281,999
void (@NotNull String tagName) { if (tagName.equalsIgnoreCase(myStack.peek().first)) myStack.pop(); }
removeFromTop