Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
281,700 | void (JComponent component, int x, int y, int w, int h) { // suppress per-cell "moved" and "resized" events on paint // see Component#setBounds, Component#notifyNewBounds AWTAccessor.getComponentAccessor().setLocation(component, x, y); AWTAccessor.getComponentAccessor().setSize(component, w, h); } | reshapeImpl |
281,701 | void () { } | invalidate |
281,702 | void () { super.invalidate(); } | forceInvalidate |
281,703 | void (JComponent component) { LayoutManager layout = component.getLayout(); if (layout instanceof LayoutManager2) { ((LayoutManager2)layout).invalidateLayout(component); } } | invalidateLayout |
281,704 | void () { doLayout(); } | validate |
281,705 | void () { super.validate(); } | super_validate |
281,706 | void () { } | revalidate |
281,707 | void (long tm, int x, int y, int width, int height) { } | repaint |
281,708 | void (Rectangle r) { } | repaint |
281,709 | void () { } | repaint |
281,710 | void (@NotNull JList<? extends T> list, T value, int index, boolean selected, boolean hasFocus) { setText(value == null ? nullValue : getText.fun(value)); } | customize |
281,711 | void (@NotNull JList<? extends T> list, T value, int index, boolean selected, boolean hasFocus) { customizer.customize(this, value, index); } | customize |
281,712 | Component (JList<? extends T> list, T value, int index, boolean isSelected, boolean cellHasFocus) { setComponentOrientation(list.getComponentOrientation()); setBorder(JBUI.Borders.empty(UIUtil.getListCellVPadding(), UIUtil.getListCellHPadding())); Color bg, fg; JList.DropLocation dropLocation = list.getDropLocation(); if (dropLocation != null && !dropLocation.isInsert() && dropLocation.getIndex() == index) { bg = DefaultLookup.getColor(this, ui, "List.dropCellBackground"); fg = DefaultLookup.getColor(this, ui, "List.dropCellForeground"); isSelected = true; } else { bg = RenderingUtil.getBackground(list, isSelected); fg = RenderingUtil.getForeground(list, isSelected); } setBackground(bg); setForeground(fg); setFont(list.getFont()); setText(""); setIcon(null); customize(list, value, index, isSelected, cellHasFocus); setOpaque(isSelected); return this; } | getListCellRendererComponent |
281,713 | Dimension () { if (StringUtil.isNotEmpty(getText())) { return super.getPreferredSize(); } setText(" "); Dimension size = super.getPreferredSize(); setText(""); return size; } | getPreferredSize |
281,714 | void (String propertyName, Object oldValue, Object newValue) { if ("text".equals(propertyName) || (("font".equals(propertyName) || "foreground".equals(propertyName)) && oldValue != newValue && getClientProperty(BasicHTML.propertyKey) != null)) { super.firePropertyChange(propertyName, oldValue, newValue); } } | firePropertyChange |
281,715 | void (boolean enabled) { getComponent().setEnabled(enabled); if (myLabel != null) { myLabel.setEnabled(enabled); } for (JButton button: myButtons) { button.setEnabled(enabled); } } | setEnabled |
281,716 | boolean () { return myComponent != null && myComponent.isEnabled(); } | isEnabled |
281,717 | JComponent () { return myComponent; } | getComponent |
281,718 | JLabel () { if (myLabel == null){ myLabel = new JLabel(myLabelText); add(myLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insetsBottom(5), 0, 0)); myLabel.setLabelFor(getComponent()); } return myLabel; } | getFieldLabel |
281,719 | Runnable () { return myChangeListener; } | getChangeListener |
281,720 | void (Runnable runnable) { myChangeListener = runnable; } | setChangeListener |
281,721 | void () { removeAll(); setLayout(new GridBagLayout()); if (myLabelText != null) { myLabel = new JLabel(myLabelText); this.add(myLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insetsBottom(5), 0, 0)); myLabel.setLabelFor(myComponent); } this.add(myComponent, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBInsets.emptyInsets(), 0, 0)); if (myBrowseButtonActionListener != null) { if (myComponent instanceof ExtendableTextComponent) { ((ExtendableTextComponent)myComponent).addExtension(ExtendableTextComponent.Extension.create( getDefaultIcon(), getHoveredIcon(), getIconTooltip(), this::notifyActionListener)); new DumbAwareAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { notifyActionListener(); } }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)), myComponent); } else { FixedSizeButton browseButton = new FixedSizeButton(getComponent()); myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(browseButton); browseButton.setFocusable(false); browseButton.addActionListener(myBrowseButtonActionListener); myButtons.add(browseButton); this.add(browseButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insetsLeft(2), 0, 0)); } } if (myViewerDialogTitle != null) { final FixedSizeButton showViewerButton = new FixedSizeButton(getComponent()); if (myBrowseButtonActionListener == null) { LOG.assertTrue(myDoClickAction == null); myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(showViewerButton); } showViewerButton.setFocusable(false); showViewerButton.setIcon(AllIcons.Actions.ShowViewer); showViewerButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Viewer viewer = new Viewer(); viewer.setTitle(myViewerDialogTitle); viewer.show(); } }); myButtons.add(showViewerButton); this.add(showViewerButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBInsets.emptyInsets(), 0, 0)); } } | createComponent |
281,722 | void (@NotNull AnActionEvent e) { notifyActionListener(); } | actionPerformed |
281,723 | void (ActionEvent e) { Viewer viewer = new Viewer(); viewer.setTitle(myViewerDialogTitle); viewer.show(); } | actionPerformed |
281,724 | Icon () { return AllIcons.General.OpenDisk; } | getDefaultIcon |
281,725 | Icon () { return AllIcons.General.OpenDiskHover; } | getHoveredIcon |
281,726 | void () { ActionEvent event = new ActionEvent(myComponent, ActionEvent.ACTION_PERFORMED, "action"); if (myBrowseButtonActionListener != null) myBrowseButtonActionListener.actionPerformed(event); } | notifyActionListener |
281,727 | void (ActionListener browseButtonActionListener) { myBrowseButtonActionListener = browseButtonActionListener; } | setBrowseButtonActionListener |
281,728 | void (@NlsContexts.Label String labelText) { myLabelText = labelText; } | setLabelText |
281,729 | void (char c) { getFieldLabel().setDisplayedMnemonic(c); } | setDisplayedMnemonic |
281,730 | void (int i) { getFieldLabel().setDisplayedMnemonicIndex(i); } | setDisplayedMnemonicIndex |
281,731 | JComponent () { return myTextArea; } | getPreferredFocusedComponent |
281,732 | void () { setText(myTextArea.getText()); super.doOKAction(); } | doOKAction |
281,733 | JComponent () { myTextArea = new JTextArea(10, 50); myTextArea.setText(getText()); myTextArea.setWrapStyleWord(true); myTextArea.setLineWrap(true); myTextArea.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(@NotNull DocumentEvent event) { if (myChangeListener != null) { myChangeListener.run(); } } }); DumbAwareAction.create(e -> doOKAction()).registerCustomShortcutSet(CommonShortcuts.ENTER, myTextArea); return ScrollPaneFactory.createScrollPane(myTextArea); } | createCenterPanel |
281,734 | void (@NotNull DocumentEvent event) { if (myChangeListener != null) { myChangeListener.run(); } } | textChanged |
281,735 | JComboBox () { return getChildComponent(); } | getComboBox |
281,736 | void (final int charCount) { super.setTextFieldPreferredWidth(charCount); final Component comp = getChildComponent().getEditor().getEditorComponent(); Dimension size = comp.getPreferredSize(); FontMetrics fontMetrics = comp.getFontMetrics(comp.getFont()); size.width = fontMetrics.charWidth('a') * charCount; comp.setPreferredSize(size); } | setTextFieldPreferredWidth |
281,737 | void (Project project, FileChooserDescriptor descriptor) { addBrowseFolderListener(null, null, project, descriptor, TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT); } | addBrowseFolderListener |
281,738 | int () { return row; } | getRow |
281,739 | int () { return column; } | getColumn |
281,740 | String () { return row + "@" + column; } | toString |
281,741 | int () { return row * 31 + column; } | hashCode |
281,742 | boolean (Object o) { if (o == null) return false; if (o.getClass() != getClass()) return false; return ((Cell)o).row == row && ((Cell)o).column == column; } | equals |
281,743 | Color () { return myTextForeground; } | getTextForeground |
281,744 | void (@NotNull Color textForeground) { myTextForeground = textForeground; } | setTextForeground |
281,745 | int () { return UIUtil.isUnderNativeMacLookAndFeel() ? 1 : 3; } | getVgap |
281,746 | int () { return DEFAULT_H_GAP; } | getHgap |
281,747 | void (boolean captionCentered) { myAlignment = captionCentered ? CENTER : LEFT; } | setCaptionCentered |
281,748 | Dimension () { return isPreferredSizeSet() ? super.getPreferredSize() : getPreferredElementSize(); } | getPreferredSize |
281,749 | Dimension () { Dimension size = getLabelSize(new Insets(0, getHgap(), 0, getHgap())); JBInsets.addTo(size, getInsets()); return size; } | getPreferredElementSize |
281,750 | Dimension (Insets labelInsets) { String caption = getCaption(); if (caption == null) { return new Dimension(Math.max(myPrefWidth, 0), 1); } FontMetrics fm = getFontMetrics(getFont()); int width = myPrefWidth < 0 ? fm.stringWidth(caption) + labelInsets.left + labelInsets.right : myPrefWidth; return new Dimension(width, fm.getHeight() + labelInsets.top + labelInsets.bottom); } | getLabelSize |
281,751 | Dimension () { return isMinimumSizeSet() ? super.getMinimumSize() : getPreferredElementSize(); } | getMinimumSize |
281,752 | void (int width) { myPrefWidth = width; } | setMinimumWidth |
281,753 | void (Graphics g) { g.setColor(getForeground()); Rectangle bounds = new Rectangle(getWidth(), getHeight()); JBInsets.removeFrom(bounds, getInsets()); String caption = getCaption(); if (caption != null) { int hGap = getHgap(); bounds.x += hGap; bounds.width -= hGap + hGap; Rectangle iconR = new Rectangle(); Rectangle textR = new Rectangle(); FontMetrics fm = g.getFontMetrics(); String label = layoutCompoundLabel(fm, caption, null, CENTER, myAlignment, CENTER, myAlignment, bounds, iconR, textR, 0); textR.y += fm.getAscent(); if (caption.equals(label)) { int y = textR.y + (int)fm.getLineMetrics(label, g).getStrikethroughOffset(); paintLinePart(g, bounds.x, textR.x, -hGap, y); paintLinePart(g, textR.x + textR.width, bounds.x + bounds.width, hGap, y); } UISettings.setupAntialiasing(g); g.setColor(getTextForeground()); g.drawString(label, textR.x, textR.y); } else { paintLine(g, bounds.x, bounds.y, bounds.width); } } | paintComponent |
281,754 | void (Graphics g, int xMin, int xMax, int hGap, int y) { if (xMax > xMin) paintLine(g, xMin + hGap, y, xMax - xMin); } | paintLinePart |
281,755 | void (Graphics g, int x, int y, int width) { FILL.paint((Graphics2D)g, x, y, width, 1, null); } | paintLine |
281,756 | void (@NlsContexts.Separator String captionAboveOf) { myCaption = captionAboveOf; } | setCaption |
281,757 | AccessibleContext () { if (accessibleContext == null) { accessibleContext = new AccessibleSeparatorWithText(); } return accessibleContext; } | getAccessibleContext |
281,758 | AccessibleRole () { return myCaption != null ? AccessibleRole.LABEL : AccessibleRole.SEPARATOR; } | getAccessibleRole |
281,759 | String () { return myCaption; } | getAccessibleName |
281,760 | void (char c) { myCheckbox.setMnemonic(c); } | setMnemonic |
281,761 | Color () { return myColor; } | getColor |
281,762 | void (Color color) { myColor = color; } | setColor |
281,763 | void (boolean selected) { myCheckbox.setSelected(selected); } | setSelected |
281,764 | boolean () { return myCheckbox.isSelected(); } | isSelected |
281,765 | boolean (@NotNull MouseEvent e, int clickCount) { if (myCheckbox.isSelected()) { final Color color = ColorChooserService.getInstance().showDialog(myCheckbox, UIBundle.message("dialog.title.choose.color"), CheckBoxWithColorChooser.this.myColor); if (color != null) { myColor = color; } } return true; } | onClick |
281,766 | void (Graphics g) { final Color color = g.getColor(); g.setColor(myColor); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(color); } | paint |
281,767 | Dimension () { return getPreferredSize(); } | getMinimumSize |
281,768 | Dimension () { return getPreferredSize(); } | getMaximumSize |
281,769 | Dimension () { return new Dimension(12, 12); } | getPreferredSize |
281,770 | HelpIdAwareLinkListener () { return ApplicationManager.getApplication().getService(HelpIdAwareLinkListener.class); } | getInstance |
281,771 | void (@NotNull HyperlinkEvent e) { final String description = e.getDescription(); if (description != null && description.trim().startsWith(HELP_LINK_MARKER)) { final String wouldBeHelpId = description.trim().substring(HELP_LINK_MARKER.length()).trim(); if (StringUtil.isNotEmpty(wouldBeHelpId)) { final ApplicationNamesInfo nameInfo = ApplicationNamesInfo.getInstance(); final String editionName = nameInfo.getEditionName(); final String productName = StringUtil.toLowerCase(nameInfo.getProductName()); final String productWebPath = switch (productName) { case "rubymine", "ruby" -> "ruby"; case "intellij idea", "idea" -> "idea"; case "goland" -> "go"; case "appcode" -> "objc"; case "pycharm" -> editionName != null && "edu".equals(StringUtil.toLowerCase(editionName)) ? "pycharm-edu" : "pycharm"; default -> productName; }; BrowserUtil.browse(String.format(URL_TEMPLATE, productWebPath, wouldBeHelpId, ApplicationInfo.getInstance().getShortVersion())); return; } } super.hyperlinkActivated(e); } | hyperlinkActivated |
281,772 | Component (Container aContainer, Component aComponent) { return null; } | getComponentAfter |
281,773 | Component (Container aContainer, Component aComponent) { return null; } | getComponentBefore |
281,774 | Component (Container aContainer) { return null; } | getFirstComponent |
281,775 | Component (Container aContainer) { return null; } | getLastComponent |
281,776 | Component (Container aContainer) { return null; } | getDefaultComponent |
281,777 | boolean (Component aComponent) { return super.accept(aComponent) && aComponent.isShowing(); } | accept |
281,778 | Component (Container aContainer) { return getNextComponent(0); } | getFirstComponent |
281,779 | Component (Container aContainer) { return getPreviousComponent(myComponents.length - 1); } | getLastComponent |
281,780 | Component (Container aContainer, Component aComponent) { if (!myComponentToIndex.containsKey(aComponent)) { return null; } int i = myComponentToIndex.get(aComponent); return getNextComponent((i==-1?0:i) + 1); } | getComponentAfter |
281,781 | Component (Container aContainer, Component aComponent) { if (!myComponentToIndex.containsKey(aComponent)) { return null; } int i = myComponentToIndex.get(aComponent); return getPreviousComponent((i==-1 ?0:i) - 1); } | getComponentBefore |
281,782 | void (@NlsContexts.Label String text, Color color) { boolean newUnderline = text != null; myForeground = color; if (newUnderline) { updateLabelView(true, text); } else if (myUnderline) { updateLabelView(false, myTooltip); } } | setErrorText |
281,783 | void (@NlsContexts.Tooltip String text) { if (myUnderline) { myTooltip = text; } else { super.setToolTipText(text); } } | setToolTipText |
281,784 | void (boolean newUnderline, @NlsContexts.Tooltip String tooltip) { super.setToolTipText(tooltip); myUnderline = newUnderline; repaint(); } | updateLabelView |
281,785 | void (Graphics g) { super.paintComponent(g); String text = getText(); if (text != null && myUnderline) { g.setColor(myForeground); int x = 0; Icon icon = getIcon(); if (icon != null) { x = icon.getIconWidth() + getIconTextGap(); } if (getHorizontalAlignment() == CENTER) { int w = g.getFontMetrics().stringWidth(text); x += (getWidth() - x - w) >> 1; } Border border = getBorder(); if (border != null) { Insets insets = border.getBorderInsets(this); if (insets.left != -1) { x += insets.left; } } drawWave(this, g, x, text); } } | paintComponent |
281,786 | void (Component c, Graphics g, int x, String text) { int y = getTextBaseLine(c); y += 2; int width = c.getFontMetrics(c.getFont()).stringWidth(text); int nLines = (width >> 1) + 1; int xCurr = x; int yBottom = y + 1; int []xx = new int[nLines + 1]; int []yy = new int[nLines + 1]; int line = 0; for (; line < nLines; line += 2) { xx[line] = xCurr; yy[line] = yBottom; xx[line + 1] = xCurr + 2; yy[line + 1] = yBottom - 2; xCurr += 4; } g.drawPolyline(xx, yy, line); } | drawWave |
281,787 | int (Component c) { FontMetrics fm = c.getFontMetrics(c.getFont()); return (c.getHeight() >> 1) + (fm.getHeight() >> 1) - fm.getDescent(); } | getTextBaseLine |
281,788 | void (Graphics g, JComponent c) { FontMetrics metrics = g.getFontMetrics(g.getFont()); Dimension size = c.getSize(); g.setColor(c.getBackground()); g.fillRect(0, 0, size.width, size.height); g.setColor(c.getForeground()); int idx = 0; for (Iterator it = myLines.iterator(); it.hasNext(); idx++) { String line = (String)it.next(); g.drawString(line, 3, (metrics.getHeight()) * (idx + 1)); } } | paint |
281,789 | Dimension (JComponent c) { FontMetrics metrics = c.getFontMetrics(c.getFont()); @NlsContexts.Tooltip String tipText = ((JToolTip)c).getTipText(); if (tipText == null) { tipText = ""; } int maxWidth = 0; myLines.clear(); @Nls String[] lines = LineTokenizer.tokenize(tipText.toCharArray(), false); for (@Nls String line : lines) { myLines.add(line); int width = SwingUtilities.computeStringWidth(metrics, line); if (width > maxWidth) { maxWidth = width; } } int height = metrics.getHeight() * Math.max(lines.length, 1); return new Dimension(maxWidth + 6, height + 4); } | getPreferredSize |
281,790 | Component (JList<? extends T> list, T value, int index, boolean isSelected, boolean cellHasFocus) { GraphicsUtil.setAntialiasingType(list, AntialiasingType.getAAHintForSwingComponent()); Component result = myWrappee.getListCellRendererComponent(list, UIUtil.htmlInjectionGuard(value), index, isSelected, cellHasFocus); if (!myHandler.getExpandedItems().contains(index)) return result; Rectangle bounds = result.getBounds(); ExpandedItemRendererComponentWrapper wrapper = ExpandedItemRendererComponentWrapper.wrap(result); if (ClientProperty.isTrue(list, ExpandableItemsHandler.EXPANDED_RENDERER)) { if (ClientProperty.isTrue(result, ExpandableItemsHandler.USE_RENDERER_BOUNDS)) { wrapper.setBounds(bounds); wrapper.putClientProperty(ExpandableItemsHandler.USE_RENDERER_BOUNDS, true); } } wrapper.owner = list; return wrapper; } | getListCellRendererComponent |
281,791 | String () { return "ExpandedItemListCellRendererWrapper[" + getWrappee().getClass().getName() + "]"; } | toString |
281,792 | ListCellRenderer () { return myWrappee; } | getWrappee |
281,793 | Component (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { final Component editorComponent = myEditor.getEditorComponent(); Font editorFont = editorComponent.getFont(); final Component component = super.getListCellRendererComponent(list, UIUtil.htmlInjectionGuard(value), index, isSelected, cellHasFocus); component.setFont(editorFont); component.setSize(editorComponent.getSize()); return component; } | getListCellRendererComponent |
281,794 | void (ListSelectionEvent e) { updateButtons(); } | valueChanged |
281,795 | void (PropertyChangeEvent evt) { updateButtons(); } | propertyChange |
281,796 | JComponent () { return myTable; } | getComponent |
281,797 | ToolbarDecorator (int rowCount) { if (myTable instanceof JBTable) { ((JBTable) myTable).setVisibleRowCount(rowCount); } return this; } | setVisibleRowCount |
281,798 | void () { final CommonActionsPanel p = getActionsPanel(); if (p != null) { boolean someElementSelected; if (myTable.isEnabled()) { final int index = myTable.getSelectedRow(); final int size = myTable.getModel().getRowCount(); someElementSelected = 0 <= index && index < size; if (someElementSelected) { final boolean downEnable = myTable.getSelectionModel().getMaxSelectionIndex() < size - 1; final boolean upEnable = myTable.getSelectionModel().getMinSelectionIndex() > 0; final boolean editEnabled = myTable.getSelectedRowCount() == 1; p.setEnabled(CommonActionsPanel.Buttons.EDIT, editEnabled); p.setEnabled(CommonActionsPanel.Buttons.UP, upEnable); p.setEnabled(CommonActionsPanel.Buttons.DOWN, downEnable); } else { p.setEnabled(CommonActionsPanel.Buttons.EDIT, false); p.setEnabled(CommonActionsPanel.Buttons.UP, false); p.setEnabled(CommonActionsPanel.Buttons.DOWN, false); } p.setEnabled(CommonActionsPanel.Buttons.ADD, myProducer == null || myProducer.canCreateElement()); } else { someElementSelected = false; p.setEnabled(CommonActionsPanel.Buttons.ADD, false); p.setEnabled(CommonActionsPanel.Buttons.EDIT, false); p.setEnabled(CommonActionsPanel.Buttons.UP, false); p.setEnabled(CommonActionsPanel.Buttons.DOWN, false); } p.setEnabled(CommonActionsPanel.Buttons.REMOVE, someElementSelected); updateExtraElementActions(someElementSelected); } } | updateButtons |
281,799 | void (final @Nullable ElementProducer<?> producer) { final JTable table = myTable; final EditableModel tableModel = (EditableModel)table.getModel(); myAddAction = new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { TableUtil.stopEditing(table); final int rowCount = table.getRowCount(); if (tableModel instanceof ListTableModel && producer != null) { //noinspection unchecked ((ListTableModel)tableModel).addRow(producer.createElement()); } else { tableModel.addRow(); } if (rowCount == table.getRowCount()) return; final int index = table.getModel().getRowCount() - 1; table.setRowSelectionInterval(index, index); table.setColumnSelectionInterval(0, 0); table.editCellAt(index, 0); TableUtil.updateScroller(table); //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> { final Component editorComponent = table.getEditorComponent(); if (editorComponent != null) { final Rectangle bounds = editorComponent.getBounds(); table.scrollRectToVisible(bounds); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(editorComponent, true)); } }); } }; myRemoveAction = new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { if (TableUtil.doRemoveSelectedItems(table, tableModel, null)) { updateButtons(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(table, true)); TableUtil.updateScroller(table); } } }; class MoveRunnable implements AnActionButtonRunnable { final int delta; MoveRunnable(int delta) { this.delta = delta; } @Override public void run(AnActionButton button) { int row = table.getEditingRow(); int col = table.getEditingColumn(); int rowCount = table.getModel().getRowCount(); TableUtil.stopEditing(table); int[] idx = table.getSelectedRows(); Arrays.sort(idx); if (delta > 0) { idx = ArrayUtil.reverseArray(idx); } if (idx.length == 0) return; if (idx[0] + delta < 0) return; if (idx[idx.length - 1] + delta > rowCount) return; for (int i = 0; i < idx.length; i++) { tableModel.exchangeRows(idx[i], idx[i] + delta); idx[i] += delta; } TableUtil.selectRows(table, idx); TableUtil.scrollSelectionToVisible(table); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> IdeFocusManager.getGlobalInstance().requestFocus(table, true)); if (row != -1 && col != -1) { int newEditingRow = row + delta; if (newEditingRow != -1 && newEditingRow < rowCount) { table.editCellAt(newEditingRow, col); } } } } myUpAction = new MoveRunnable(-1); myDownAction = new MoveRunnable(1); } | createDefaultTableActions |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.