Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
281,200 | int () { return myEnd; } | getEnd |
281,201 | IElementType () { return myElementType; } | getElementType |
281,202 | TextAttributes () { return myAttributes; } | getAttributes |
281,203 | int () { return myOffset; } | getOffset |
281,204 | int () { return 0; } | getOldLength |
281,205 | int () { return 0; } | getNewLength |
281,206 | CharSequence () { return ""; } | getOldFragment |
281,207 | CharSequence () { return ""; } | getNewFragment |
281,208 | long () { return myTimestamp; } | getOldTimeStamp |
281,209 | void (KeyEvent e) { SpeedSearchSupply supply = SpeedSearchSupply.getSupply(CheckBoxList.this); if (supply != null && supply.isPopupActive()) { return; } if (e.getKeyChar() == ' ') { Boolean value = null; for (int index : getSelectedIndices()) { if (index >= 0) { JCheckBox checkbox = getCheckBoxAt(index); if (checkbox.isEnabled()) { value = value != null ? value : !checkbox.isSelected(); setSelected(checkbox, index, value); } } } } } | keyTyped |
281,210 | boolean (@NotNull MouseEvent e, int clickCount) { if (isEnabled()) { int index = locationToIndex(e.getPoint()); if (index != -1) { JCheckBox checkBox = getCheckBoxAt(index); Rectangle bounds = getCellBounds(index, index); if (bounds == null) { return false; } Point p = findPointRelativeToCheckBox(e.getX() - bounds.x, e.getY() - bounds.y, checkBox, index); if (p != null) { Dimension dim = getCheckBoxDimension(checkBox); if (p.x >= 0 && p.x < dim.width && p.y >= 0 && p.y < dim.height) { if (checkBox.isEnabled()) { setSelected(checkBox, index, !checkBox.isSelected()); } return true; } } } } return false; } | onClick |
281,211 | void (MouseEvent e, boolean pressed) { Point point = e.getPoint(); int index = locationToIndex(point); if (index >= 0 && index < getModel().getSize()) { JCheckBox cb = getModel().getElementAt(index); cb.getModel().setPressed(pressed); UIUtil.repaintViewport(CheckBoxList.this); } } | setPressed |
281,212 | void (int newIndex) { if (rollOverIndex >= 0 && rollOverIndex < getModel().getSize()) { JCheckBox oldRollover = getModel().getElementAt(rollOverIndex); oldRollover.getModel().setRollover(false); } rollOverIndex = newIndex; if (rollOverIndex >= 0) { JCheckBox newRollover = getModel().getElementAt(rollOverIndex); newRollover.getModel().setRollover(true); } UIUtil.repaintViewport(this); } | fireRollOverUpdated |
281,213 | Dimension (@NotNull JCheckBox checkBox) { Icon icon = null; BasicRadioButtonUI ui = ObjectUtils.tryCast(checkBox.getUI(), BasicRadioButtonUI.class); if (ui != null) { icon = ui.getDefaultIcon(); } if (icon == null) { // com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI.getDefaultIcon() icon = JBUIScale.scaleIcon(EmptyIcon.create(20)); } Insets margin = checkBox.getMargin(); return new Dimension(margin.left + icon.getIconWidth(), margin.top + icon.getIconHeight()); } | getCheckBoxDimension |
281,214 | JCheckBox (int index) { return getModel().getElementAt(index); } | getCheckBoxAt |
281,215 | void (final Map<@NlsContexts.Checkbox String, Boolean> items) { clear(); for (Map.Entry<@NlsContexts.Checkbox String, Boolean> entry : items.entrySet()) { //noinspection unchecked addItem((T)entry.getKey(), entry.getKey(), entry.getValue()); } } | setStringItems |
281,216 | void (final List<? extends T> items, @Nullable Function<? super T, @NlsContexts.Checkbox String> converter) { clear(); for (T item : items) { @SuppressWarnings("HardCodedStringLiteral") String text = converter != null ? converter.fun(item) : item.toString(); addItem(item, text, false); } } | setItems |
281,217 | void (T item, @NlsContexts.Checkbox String text, boolean selected) { JCheckBox checkBox = new JCheckBox(text, selected); checkBox.setOpaque(true); // to paint selection background myItemMap.put(item, checkBox); //noinspection unchecked ((DefaultListModel)getModel()).addElement(checkBox); } | addItem |
281,218 | void (@NotNull T oldItem, @NotNull T newItem, @NotNull @NlsContexts.Checkbox String newText) { JCheckBox checkBox = myItemMap.remove(oldItem); myItemMap.put(newItem, checkBox); checkBox.setText(newText); DefaultListModel<JCheckBox> model = (DefaultListModel<JCheckBox>)getModel(); int ind = model.indexOf(checkBox); if (ind >= 0) { model.set(ind, checkBox); // to fire contentsChanged event } } | updateItem |
281,219 | void () { ((DefaultListModel<?>)getModel()).clear(); myItemMap.clear(); } | clear |
281,220 | boolean (int index) { return getModel().getElementAt(index).isSelected(); } | isItemSelected |
281,221 | boolean (T item) { JCheckBox checkBox = myItemMap.get(item); return checkBox != null && checkBox.isSelected(); } | isItemSelected |
281,222 | void (T item, boolean selected) { JCheckBox checkBox = myItemMap.get(item); if (checkBox != null) { checkBox.setSelected(selected); } } | setItemSelected |
281,223 | void (JCheckBox checkbox, int index, boolean value) { checkbox.setSelected(value); repaint(); // fire change notification in case if we've already initialized model final ListModel model = getModel(); if (model instanceof DefaultListModel) { //noinspection unchecked ((DefaultListModel)model).setElementAt(getModel().getElementAt(index), index); } if (checkBoxListListener != null) { checkBoxListListener.checkBoxSelectionChanged(index, value); } } | setSelected |
281,224 | void (CheckBoxListListener checkBoxListListener) { this.checkBoxListListener = checkBoxListListener; } | setCheckBoxListListener |
281,225 | JComponent (JComponent rootComponent, final JCheckBox checkBox, int index, final boolean selected, final boolean hasFocus) { return rootComponent; } | adjustRendering |
281,226 | Component (JList list, JCheckBox checkbox, int index, boolean isSelected, boolean cellHasFocus) { Color textColor = getForeground(isSelected); Color backgroundColor = getBackground(isSelected); Font font = getFont(); checkbox.setBackground(backgroundColor); checkbox.setForeground(textColor); checkbox.setEnabled(isEnabled() && isEnabled(index)); checkbox.setFont(font); checkbox.setFocusPainted(false); checkbox.setBorderPainted(false); checkbox.setOpaque(true); String auxText = getSecondaryText(index); JComponent rootComponent; if (auxText != null) { JPanel panel = new JPanel(new BorderLayout()); panel.add(checkbox, BorderLayout.LINE_START); JLabel infoLabel = new JLabel(auxText, SwingConstants.RIGHT); infoLabel.setBorder(JBUI.Borders.emptyRight(checkbox.getInsets().left)); infoLabel.setFont(UIUtil.getFont(UIUtil.FontSize.SMALL, font)); panel.add(infoLabel, BorderLayout.CENTER); panel.setBackground(backgroundColor); infoLabel.setForeground(isSelected ? textColor : JBColor.GRAY); infoLabel.setBackground(backgroundColor); rootComponent = panel; } else { rootComponent = checkbox; } rootComponent.setBorder(isSelected ? mySelectedBorder : myBorder); boolean isRollOver = checkbox.getModel().isRollover(); rootComponent = adjustRendering(rootComponent, checkbox, index, isSelected, cellHasFocus); checkbox.getModel().setRollover(isRollOver); return rootComponent; } | getListCellRendererComponent |
281,227 | Insets () { return myBorderInsets; } | getBorderInsets |
281,228 | boolean (int index) { return true; } | isEnabled |
281,229 | Color (final boolean isSelected) { return isSelected ? getSelectionBackground() : getBackground(); } | getBackground |
281,230 | Color (final boolean isSelected) { return isSelected ? getSelectionForeground() : getForeground(); } | getForeground |
281,231 | void (boolean enabled) { } | setEnabled |
281,232 | boolean () { return false; } | isEnabled |
281,233 | Collection<Object> () { return Collections.emptyList(); } | getExpandedItems |
281,234 | Color () { return myWideSelection ? null : super.getBorderSelectionColor(); } | getBorderSelectionColor |
281,235 | Color (final @NotNull JTree tree) { return myWideSelection && !tree.hasFocus() ? UIUtil.getTreeForeground() : UIUtil.getTreeSelectionForeground(); } | getSelectionForeground |
281,236 | Component ( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus ) { setText(tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus)); setFont(UIUtil.getTreeFont()); setIcon(null); if (WideSelectionTreeUI.isWideSelection(tree)) { setOpaque(false); myIsSelected = false; myHasFocus = false; setDoNotHighlight(selected && hasFocus); setForeground(UIUtil.getTreeForeground(selected, hasFocus)); } else { setOpaque(true); myIsSelected = selected; myHasFocus = hasFocus; setDoNotHighlight(false); } myHasFocus = hasFocus; return this; } | getTreeCellRendererComponent |
281,237 | Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { //noinspection HardCodedStringLiteral setText((value == null) ? "" : value.toString()); setFont(UIUtil.getListFont()); setIcon(null); myIsSelected = isSelected; myHasFocus = cellHasFocus; return this; } | getListCellRendererComponent |
281,238 | JList () { return myList; } | getList |
281,239 | RemoveActionDescription (final @NlsActions.ActionText String actionName) { final RemoveActionDescription description = new RemoveActionDescription(actionName); addActionDescription(description); return description; } | addRemoveAction |
281,240 | AddActionDescription (final @NlsActions.ActionText String actionName, final Factory<? extends T> creator, final boolean createShortcut) { final AddActionDescription description = new AddActionDescription(actionName, creator, createShortcut); addActionDescription(description); return description; } | addAddAction |
281,241 | AddMultipleActionDescription (final @NlsActions.ActionText String actionName, final Factory<? extends Collection<T>> creator, final boolean createShortcut) { final AddMultipleActionDescription description = new AddMultipleActionDescription(actionName, creator, createShortcut); addActionDescription(description); return description; } | addAddMultipleAction |
281,242 | void () { addAction(new AnAction(UIBundle.messagePointer("move.up.action.name"), Presentation.NULL_STRING, IconUtil.getMoveUpIcon()) { @Override public void actionPerformed(final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsUp(myList); } @Override public void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsUp(myList)); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } }); } | addMoveUpAction |
281,243 | void (final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsUp(myList); } | actionPerformed |
281,244 | void (final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsUp(myList)); } | update |
281,245 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
281,246 | void () { addAction(new AnAction(UIBundle.messagePointer("move.down.action.name"), Presentation.NULL_STRING, AllIcons.Actions.MoveDown) { @Override public void actionPerformed(final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsDown(myList); } @Override public void update(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsDown(myList)); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.EDT; } }); } | addMoveDownAction |
281,247 | void (final @NotNull AnActionEvent e) { ListUtil.moveSelectedItemsDown(myList); } | actionPerformed |
281,248 | void (final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canMoveSelectedItemsDown(myList)); } | update |
281,249 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
281,250 | void (final AnAction action) { addActionDescription(new FixedActionDescription(action)); } | addAction |
281,251 | void (final T element) { final ListModel listModel = myList.getModel(); if (listModel instanceof SortedListModel) { ((SortedListModel<T>)listModel).add(element); } else { ((DefaultListModel)listModel).addElement(element); } myList.clearSelection(); ScrollingUtil.selectItem(myList, element); } | handleNewElement |
281,252 | void (final ActionDescription description) { actionGroup.add(description.createAction(list)); } | addActionDescription |
281,253 | void (final ActionNotification<V> runnable) { myPostHandlers.add(runnable); } | addPostHandler |
281,254 | void (final V change) { for (final ActionNotification<V> runnable : myPostHandlers) { runnable.afterActionPerformed(change); } } | runPostHandlers |
281,255 | void (final boolean showText) { myShowText = showText; } | setShowText |
281,256 | void (final @NotNull AnActionEvent e) { final V change = myBehaviour.performAction(e); if (change == null) return; myCustomActionDescription.runPostHandlers(change); } | actionPerformed |
281,257 | void (final @NotNull AnActionEvent e) { myBehaviour.updateAction(e); } | update |
281,258 | ActionUpdateThread () { return ActionUpdateThread.EDT; } | getActionUpdateThread |
281,259 | boolean () { return true; } | displayTextInToolbar |
281,260 | BaseAction (final JComponent component) { final ActionBehaviour<List<T>> behaviour = new ActionBehaviour<>() { @Override public List<T> performAction(final @NotNull AnActionEvent e) { if (myConfirmation != null && !myConfirmation.value((List<T>)Arrays.asList(myList.getSelectedValues()))) { return Collections.emptyList(); } return ListUtil.removeSelectedItems(myList, myEnableCondition); } @Override public void updateAction(final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canRemoveSelectedItems(myList, myEnableCondition)); } }; final BaseAction action = createAction(behaviour); action.registerCustomShortcutSet(CommonShortcuts.getDelete(), component); return action; } | createAction |
281,261 | List<T> (final @NotNull AnActionEvent e) { if (myConfirmation != null && !myConfirmation.value((List<T>)Arrays.asList(myList.getSelectedValues()))) { return Collections.emptyList(); } return ListUtil.removeSelectedItems(myList, myEnableCondition); } | performAction |
281,262 | void (final @NotNull AnActionEvent e) { e.getPresentation().setEnabled(ListUtil.canRemoveSelectedItems(myList, myEnableCondition)); } | updateAction |
281,263 | Icon () { return REMOVE_ICON; } | getActionIcon |
281,264 | String () { return myActionName; } | getActionName |
281,265 | void (final Condition<? super List<T>> confirmation) { myConfirmation = confirmation; } | setConfirmation |
281,266 | void (final Condition<? super T> enableCondition) { myEnableCondition = enableCondition; } | setEnableCondition |
281,267 | JList () { return myList; } | getList |
281,268 | BaseAction (final JComponent component) { final ActionBehaviour<V> behaviour = new ActionBehaviour<>() { @Override public V performAction(final @NotNull AnActionEvent e) { return addInternal(myAddHandler.create()); } @Override public void updateAction(final @NotNull AnActionEvent e) {} }; final BaseAction action = createAction(behaviour); if (myCreateShortcut) { action.registerCustomShortcutSet(CommonShortcuts.INSERT, component); } return action; } | createAction |
281,269 | V (final @NotNull AnActionEvent e) { return addInternal(myAddHandler.create()); } | performAction |
281,270 | void (final @NotNull AnActionEvent e) {} | updateAction |
281,271 | Icon () { return myIcon; } | getActionIcon |
281,272 | String () { return myActionDescription; } | getActionName |
281,273 | void (final Icon icon) { myIcon = icon; } | setIcon |
281,274 | T (final T t) { if (t != null) { handleNewElement(t); } return t; } | addInternal |
281,275 | Collection<T> (final Collection<T> t) { if (t != null) { for (T element : t) { handleNewElement(element); } } return t; } | addInternal |
281,276 | AnAction (final JComponent component) { return myAction; } | createAction |
281,277 | JPanel (JComponent aComponent, ActionListener aActionListener) { return constructFieldWithBrowseButton(aComponent, aActionListener, 0); } | constructFieldWithBrowseButton |
281,278 | JPanel (TextFieldWithHistory aComponent, ActionListener aActionListener) { return constructFieldWithBrowseButton(aComponent, aActionListener, 0); } | constructFieldWithBrowseButton |
281,279 | JPanel (final JComponent aComponent, final ActionListener aActionListener, int delta) { JPanel result = new JPanel(new GridBagLayout()); result.add(aComponent, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBInsets.emptyInsets(), 0, 0)); FixedSizeButton browseButton = new FixedSizeButton(aComponent.getPreferredSize().height - delta);//ignore border in case of browse button TextFieldWithBrowseButton.MyDoClickAction.addTo(browseButton, aComponent); result.add(browseButton, new GridBagConstraints(1, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, JBInsets.emptyInsets(), 0, 0)); browseButton.addActionListener(aActionListener); return result; } | constructFieldWithBrowseButton |
281,280 | Component () { return Box.createRigidArea(new Dimension(0, paddingInsideDialog.top)); } | createVerticalStrut |
281,281 | String (String text) { return StringUtil.strip(text, NOT_MNEMONIC_CHAR_FILTER); } | getTextWithoutMnemonicEscaping |
281,282 | char (String text) { final int i = getDisplayedMnemonicIndex(text); return i == -1 ? (char)-1 : text.charAt(i + 1); } | getDisplayedMnemonic |
281,283 | int (String text) { return text.indexOf("&"); } | getDisplayedMnemonicIndex |
281,284 | void (JComponent root) { replaceJSplitPaneWithIDEASplitter(root, false); } | replaceJSplitPaneWithIDEASplitter |
281,285 | void (JComponent root, boolean useOnePixelDivider) { final Container parent = root.getParent(); if (root instanceof JSplitPane pane) { // we can painlessly replace only splitter which is the only child in container if (parent.getComponents().length != 1 && !(parent instanceof Splitter)) { return; } final Component component1 = pane.getTopComponent(); final Component component2 = pane.getBottomComponent(); final int orientation = pane.getOrientation(); boolean vertical = orientation == JSplitPane.VERTICAL_SPLIT; final Splitter splitter = useOnePixelDivider ? new OnePixelSplitter(vertical) : new JBSplitter(vertical); splitter.setFirstComponent((JComponent)component1); splitter.setSecondComponent((JComponent)component2); splitter.setShowDividerControls(pane.isOneTouchExpandable()); splitter.setHonorComponentsMinimumSize(true); if (pane.getDividerLocation() > 0) { // let the component chance to resize itself SwingUtilities.invokeLater(() -> { double proportion; if (pane.getOrientation() == JSplitPane.VERTICAL_SPLIT) { proportion = pane.getDividerLocation() / (double)(parent.getHeight() - pane.getDividerSize()); } else { proportion = pane.getDividerLocation() / (double)(parent.getWidth() - pane.getDividerSize()); } if (proportion > 0 && proportion < 1) { splitter.setProportion((float)proportion); } }); } if (parent instanceof Splitter psplitter) { if (psplitter.getFirstComponent() == root) { psplitter.setFirstComponent(splitter); } else { psplitter.setSecondComponent(splitter); } } else { parent.remove(0); parent.setLayout(new BorderLayout()); parent.add(splitter, BorderLayout.CENTER); } replaceJSplitPaneWithIDEASplitter((JComponent)component1, useOnePixelDivider); replaceJSplitPaneWithIDEASplitter((JComponent)component2, useOnePixelDivider); } else { final Component[] components = root.getComponents(); for (Component component : components) { if (component instanceof JComponent) { replaceJSplitPaneWithIDEASplitter((JComponent)component, useOnePixelDivider); } } } } | replaceJSplitPaneWithIDEASplitter |
281,286 | void (Component container, Consumer<? super Component> consumer, JComponent... excludeComponents) { if (excludeComponents != null && ArrayUtil.find(excludeComponents, container) != -1) return; consumer.consume(container); if (container instanceof Container) { final Component[] components = ((Container)container).getComponents(); for (Component child : components) { iterateChildren(child, consumer, excludeComponents); } } } | iterateChildren |
281,287 | void (final boolean enabled, Component... components) { for (final Component component : components) { enableChildren(component, enabled); } } | enableChildren |
281,288 | void (final boolean visible, Component... components) { for (final Component component : components) { component.setVisible(visible); } } | showComponents |
281,289 | void (Component container, final boolean enabled, JComponent... excludeComponents) { iterateChildren(container, t -> enableComponent(t, enabled), excludeComponents); } | enableChildren |
281,290 | void (Component component, boolean enabled) { if (component.isEnabled() == enabled) return; component.setEnabled(enabled); if (component instanceof JPanel) { final Border border = ((JPanel)component).getBorder(); if (border instanceof TitledBorder) { Color color; color = enabled ? component.getForeground() : NamedColorUtil.getInactiveTextColor(); ((TitledBorder)border).setTitleColor(color); } } else if (component instanceof JLabel label) { Color color = NamedColorUtil.getInactiveTextColor(); @NonNls String changeColorString = "<font color=#" + colorToHex(color) + ">"; @NonNls String text = label.getText(); if (text != null && text.startsWith("<html>")) { if (StringUtil.startsWithConcatenation(text, "<html>", changeColorString) && enabled) { text = "<html>" + text.substring(("<html>" + changeColorString).length()); } else if (!StringUtil.startsWithConcatenation(text, "<html>", changeColorString) && !enabled) { text = "<html>" + changeColorString + text.substring("<html>".length()); } label.setText(text); } } else if (component instanceof JTable) { TableColumnModel columnModel = ((JTable)component).getColumnModel(); for (int i = 0; i < columnModel.getColumnCount(); i++) { TableCellRenderer cellRenderer = columnModel.getColumn(0).getCellRenderer(); if (cellRenderer instanceof Component) { enableComponent((Component)cellRenderer, enabled); } } } } | enableComponent |
281,291 | String (final Color color) { return UIUtil.colorToHex(color); } | colorToHex |
281,292 | void (@NotNull Runnable runnable, @NotNull ModalityState modalityState) { Application app = ApplicationManager.getApplication(); if (app.isDispatchThread()) { runnable.run(); } else { app.invokeLater(runnable, modalityState); } } | invokeLaterIfNeeded |
281,293 | void (@NotNull Runnable runnable, @NotNull ModalityState modalityState, @NotNull Condition expired) { Application app = ApplicationManager.getApplication(); if (app.isDispatchThread()) { runnable.run(); } else { app.invokeLater(runnable, modalityState, expired); } } | invokeLaterIfNeeded |
281,294 | JTextField () { return new JBTextField(); } | createUndoableTextField |
281,295 | Dimension (int charCount, @NotNull JComponent comp) { Dimension size = comp.getPreferredSize(); FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); size.width = fontMetrics.charWidth('a') * charCount; return size; } | getSizeByChars |
281,296 | void (JComponent owner, JComponent referent) { referent.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { toggleVisibility(e); } @Override public void componentHidden(ComponentEvent e) { toggleVisibility(e); } private void toggleVisibility(ComponentEvent e) { Component component = e.getComponent(); if (component != null) { owner.setVisible(component.isVisible()); } } }); } | installVisibilityReferent |
281,297 | void (ComponentEvent e) { toggleVisibility(e); } | componentShown |
281,298 | void (ComponentEvent e) { toggleVisibility(e); } | componentHidden |
281,299 | void (ComponentEvent e) { Component component = e.getComponent(); if (component != null) { owner.setVisible(component.isVisible()); } } | toggleVisibility |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.