Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
280,900
void (final KeyStroke keyStroke, AbstractAction action) { myChooserComponent.getComponent().registerKeyboardAction(action, keyStroke, JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); }
registerPopupKeyboardAction
280,901
void (MouseEvent e, boolean isOk) { if (isOk) { myPopup.closeOk(e); } else { myPopup.cancel(e); } }
closePopup
280,902
PopupChooserBuilder<T> (final boolean autoSelect) { myAutoselect = autoSelect; return this; }
setAutoSelectIfEmpty
280,903
PopupChooserBuilder<T> (final boolean enabled) { myCancelKeyEnabled = enabled; return this; }
setCancelKeyEnabled
280,904
PopupChooserBuilder<T> (final JBPopupListener listener) { myListeners.add(listener); return this; }
addListener
280,905
PopupChooserBuilder<T> (Component button) { mySettingsButtons = button; return this; }
setSettingButton
280,906
PopupChooserBuilder<T> (boolean mayBeParent) { myMayBeParent = mayBeParent; return this; }
setMayBeParent
280,907
PopupChooserBuilder<T> (boolean closeOnEnter) { myCloseOnEnter = closeOnEnter; return this; }
setCloseOnEnter
280,908
PopupChooserBuilder<T> (Component @NotNull [] focusOwners) { myFocusOwners = focusOwners; return this; }
setFocusOwners
280,909
PopupChooserBuilder<T> (String ad) { setAdText(ad, SwingConstants.LEFT); return this; }
setAdText
280,910
PopupChooserBuilder<T> (@Nullable JComponent advertiser) { myAdvertiser = advertiser; return this; }
setAdvertiser
280,911
PopupChooserBuilder<T> (String ad, int alignment) { myAd = ad; myAdAlignment = alignment; return this; }
setAdText
280,912
PopupChooserBuilder<T> (boolean cancelOnWindowDeactivation) { myCancelOnWindowDeactivation = cancelOnWindowDeactivation; return this; }
setCancelOnWindowDeactivation
280,913
IPopupChooserBuilder<T> (boolean cancelOnWindow) { myCancelOnOtherWindowOpen = cancelOnWindow; return this; }
setCancelOnOtherWindowOpen
280,914
IPopupChooserBuilder<T> (int selection) { myChooserComponent.setSelectionMode(selection); return this; }
setSelectionMode
280,915
IPopupChooserBuilder<T> (T preselection, boolean shouldScroll) { myChooserComponent.setSelectedValue(preselection, shouldScroll); return this; }
setSelectedValue
280,916
IPopupChooserBuilder<T> (String title) { AccessibleContextUtil.setName(myChooserComponent.getComponent(), title); return this; }
setAccessibleName
280,917
IPopupChooserBuilder<T> (Consumer<? super T> c) { myChooserComponent.setItemSelectedCallback(c); return this; }
setItemSelectedCallback
280,918
void (Computable<Boolean> cbb) { Computable<Boolean> callback = myCancelCallback; myCancelCallback = () -> cbb.compute() && (callback == null || callback.compute()); }
addCancelCallback
280,919
IPopupChooserBuilder<T> () { HintUpdateSupply.installDataContextHintUpdateSupply(myChooserComponent.getComponent()); addCancelCallback(() -> { HintUpdateSupply.hideHint(myChooserComponent.getComponent()); return true; }); return this; }
withHintUpdateSupply
280,920
IPopupChooserBuilder<T> (Font f) { myChooserComponent.setFont(f); return this; }
setFont
280,921
IPopupChooserBuilder<T> (int visibleRowCount) { myVisibleRowCount = visibleRowCount; return this; }
setVisibleRowCount
280,922
IPopupChooserBuilder<T> (@NotNull Dimension dimension) { myChooserComponent.setFixedRendererSize(dimension); return this; }
withFixedRendererSize
280,923
int () { return myVisibleRowCount; }
getVisibleRowCount
280,924
GenericListComponentUpdater<T> () { return myChooserComponent.getBackgroundUpdater(); }
getBackgroundUpdater
280,925
void (JComponent contentComponent) { if (contentComponent instanceof ListWithFilter<?> listWithFilter) { Insets insets = PopupUtil.getListInsets(StringUtil.isNotEmpty(myTitle), StringUtil.isNotEmpty(myAd)); listWithFilter.getList().setBorder(new EmptyBorder(insets)); } }
applyInsets
280,926
void (@PopupTitle @Nullable String title, @NotNull List<? extends T> values, @Nullable List<? extends Icon> icons) { myTitle = title; myValues = new ArrayList<>(values); myIcons = icons; }
init
280,927
List<T> () { return myValues; }
getValues
280,928
Icon (T value) { int index = myValues.indexOf(value); if (index != -1 && myIcons != null && index < myIcons.size()) { return myIcons.get(index); } else { return null; } }
getIconFor
280,929
String (T value) { //noinspection HardCodedStringLiteral (can't be fixed without upgrading the inspection or breaking clients) return value.toString(); }
getTextFor
280,930
boolean (T value) { return true; }
isSelectable
280,931
boolean (T selectedValue) { return false; }
hasSubstep
280,932
void () { }
canceled
280,933
void (int aDefaultOptionIndex) { myDefaultOptionIndex = aDefaultOptionIndex; }
setDefaultOptionIndex
280,934
int () { return myDefaultOptionIndex; }
getDefaultOptionIndex
280,935
boolean () { return false; }
isSpeedSearchEnabled
280,936
boolean () { return true; }
isAutoSelectionEnabled
280,937
SpeedSearchFilter<T> () { return this; }
getSpeedSearchFilter
280,938
String (T value) { return getTextFor(value); }
getIndexedString
280,939
boolean () { return false; }
isMnemonicsNavigationEnabled
280,940
int (T value) { String text = getTextFor(value); int i = text.indexOf('&'); if (i < 0) i = text.indexOf(UIUtil.MNEMONIC); return i; }
getMnemonicPos
280,941
MnemonicNavigationFilter<T> () { return this; }
getMnemonicNavigationFilter
280,942
JBPopup (@Nullable Component c) { if (c == null) return null; if (c instanceof JComponent) { JBPopup popup = (JBPopup)((JComponent)c).getClientProperty(JBPopup.KEY); if (popup != null) return popup; } final Window wnd = SwingUtilities.getWindowAncestor(c); if (wnd instanceof JWindow) { final JRootPane root = ((JWindow)wnd).getRootPane(); return (JBPopup)root.getClientProperty(JBPopup.KEY); } return null; }
getPopupContainerFor
280,943
void (final @NotNull PopupFactory factory, final int type) { try { final Method method = PopupFactory.class.getDeclaredMethod("setPopupType", int.class); method.setAccessible(true); method.invoke(factory, type); } catch (Throwable e) { LOG.error(e); } }
setPopupType
280,944
int (final @NotNull PopupFactory factory) { try { if (!ClientId.isCurrentlyUnderLocalId()) { final Field field = PopupFactory.class.getDeclaredField("HEAVY_WEIGHT_POPUP"); field.setAccessible(true); return (Integer)field.get(null); } final Method method = PopupFactory.class.getDeclaredMethod("getPopupType"); method.setAccessible(true); final Object result = method.invoke(factory); return result instanceof Integer ? (Integer) result : -1; } catch (Throwable e) { LOG.error(e); } return -1; }
getPopupType
280,945
Component () { Window[] windows = Window.getWindows(); for (Window each : windows) { if (each.isActive()) { return each; } } final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame != null) return frame.getComponent(); return JOptionPane.getRootFrame(); }
getActiveComponent
280,946
void (final @NotNull @NlsContexts.PopupContent String message, final MessageType type) { final Runnable runnable = () -> { final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame == null) { final Project[] projects = ProjectManager.getInstance().getOpenProjects(); final Project project = projects.length == 0 ? ProjectManager.getInstance().getDefaultProject() : projects[0]; final JFrame jFrame = WindowManager.getInstance().getFrame(project); if (jFrame != null) { showBalloonForComponent(jFrame, message, type, true, project); } else { LOG.info("Can not get component to show message: " + message); } return; } showBalloonForComponent(frame.getComponent(), message, type, true, frame.getProject()); }; UIUtil.invokeLaterIfNeeded(runnable); }
showBalloonForActiveFrame
280,947
void (final @NotNull @NlsContexts.PopupContent String message, final MessageType type) { Runnable runnable = () -> { Window[] windows = Window.getWindows(); Window targetWindow = null; for (Window each : windows) { if (each.isActive()) { targetWindow = each; break; } } if (targetWindow == null) { targetWindow = JOptionPane.getRootFrame(); } showBalloonForComponent(targetWindow, message, type, true, null); }; UIUtil.invokeLaterIfNeeded(runnable); }
showBalloonForActiveComponent
280,948
void (@NotNull Component component, final @NotNull @NlsContexts.PopupContent String message, final MessageType type, final boolean atTop, final @Nullable Disposable disposable) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); if (popupFactory == null) return; BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null); balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable); Balloon balloon = balloonBuilder.createBalloon(); Dimension size = component.getSize(); Balloon.Position position; int x; int y; if (size == null) { x = y = 0; position = Balloon.Position.above; } else { x = Math.min(10, size.width / 2); y = size.height; position = Balloon.Position.below; } balloon.show(new RelativePoint(component, new Point(x, y)), position); }
showBalloonForComponent
280,949
boolean (@NotNull ComponentEvent event, @NotNull JComboBox comboBox) { final Component component = event.getComponent(); if(!comboBox.isPopupVisible() || component == null) return false; ComboPopup popup = ReflectionUtil.getField(comboBox.getUI().getClass(), comboBox.getUI(), ComboPopup.class, "popup"); return popup != null && SwingUtilities.isDescendingFrom(popup.getList(), component); }
isComboPopupKeyEvent
280,950
boolean () { MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager(); MenuElement[] selectedPath = menuSelectionManager.getSelectedPath(); if (selectedPath.length > 0) { // hide popup menu if any menuSelectionManager.clearSelectedPath(); } else { if (ApplicationManager.getApplication() == null) { return false; } final StackingPopupDispatcher popupDispatcher = StackingPopupDispatcher.getInstance(); if (popupDispatcher != null && !popupDispatcher.isPopupFocused()) { return false; } } return true; }
handleEscKeyEvent
280,951
void (@NotNull JBPopup popup, @NotNull AnActionEvent e) { InputEvent inputEvent = e.getInputEvent(); if (inputEvent == null) { popup.showInFocusCenter(); } else { Component component = inputEvent.getComponent(); if (component instanceof ActionButtonComponent) { popup.showUnderneathOf(component); } else { popup.showInCenterOf(component); } } }
showForActionButtonEvent
280,952
Border () { return JBUI.Borders.compound(new JBEmptyBorder(JBUI.CurrentTheme.ComplexPopup.textFieldBorderInsets().getUnscaled()), JBUI.Borders.customLine(JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground(), 0, 0, JBUI.CurrentTheme.ComplexPopup.TEXT_FIELD_SEPARATOR_HEIGHT, 0), new JBEmptyBorder(JBUI.CurrentTheme.ComplexPopup.textFieldInputInsets().getUnscaled())); }
createComplexPopupTextFieldBorder
280,953
void (@Nullable Component component) { if (component != null && ExperimentalUI.isNewUI()) { component.setBackground(JBUI.CurrentTheme.Popup.BACKGROUND); } }
applyNewUIBackground
280,954
Border () { Insets headerInsets = JBUI.CurrentTheme.ComplexPopup.headerInsets().getUnscaled(); return new JBEmptyBorder(0, headerInsets.left, 0, headerInsets.right); }
getComplexPopupHorizontalHeaderBorder
280,955
Border () { Insets headerInsets = JBUI.CurrentTheme.ComplexPopup.headerInsets().getUnscaled(); return new JBEmptyBorder(headerInsets.top, 0, headerInsets.bottom, 0); }
getComplexPopupVerticalHeaderBorder
280,956
void (SelectablePanel selectablePanel) { configListRendererFlexibleHeight(selectablePanel); selectablePanel.setPreferredHeight(JBUI.CurrentTheme.List.rowHeight()); }
configListRendererFixedHeight
280,957
void (SelectablePanel selectablePanel) { int leftRightInset = JBUI.CurrentTheme.Popup.Selection.LEFT_RIGHT_INSET.get(); Insets innerInsets = JBUI.CurrentTheme.Popup.Selection.innerInsets(); //noinspection UseDPIAwareBorders selectablePanel.setBorder(new EmptyBorder(innerInsets.top, innerInsets.left + leftRightInset, innerInsets.bottom, innerInsets.right + leftRightInset)); selectablePanel.setSelectionArc(JBUI.CurrentTheme.Popup.Selection.ARC.get()); //noinspection UseDPIAwareInsets selectablePanel.setSelectionInsets(new Insets(0, leftRightInset, 0, leftRightInset)); }
configListRendererFlexibleHeight
280,958
void (JComponent title) { if (ExperimentalUI.isNewUI()) { title.setBorder(JBUI.Borders.empty(10, 20, 6, 0)); } else { title.setBorder(JBUI.Borders.empty(3, 8, 4, 8)); } }
applyPreviewTitleInsets
280,959
Insets (boolean titleVisible, boolean adVisible) { if (!ExperimentalUI.isNewUI()) { return UIUtil.getListViewportPadding(adVisible); } int topInset = titleVisible ? 0 : JBUI.CurrentTheme.Popup.bodyTopInsetNoHeader(); int bottomInset = adVisible ? JBUI.CurrentTheme.Popup.bodyBottomInsetBeforeAd() : JBUI.CurrentTheme.Popup.bodyBottomInsetNoAd(); return new JBInsets(topInset, 0, bottomInset, 0); }
getListInsets
280,960
void (@NotNull JBPopup jbPopup, @Nullable Component toggleComponent) { JComponent content = jbPopup.getContent(); content.putClientProperty(POPUP_TOGGLE_COMPONENT, toggleComponent != null ? new WeakReference<>(toggleComponent) : null); }
setPopupToggleComponent
280,961
void (@NotNull JBPopup popup, @NotNull Presentation presentation) { popup.addListener(new JBPopupListener() { @Override public void beforeShown(@NotNull LightweightWindowEvent event) { Toggleable.setSelected(presentation, true); } @Override public void onClosed(@NotNull LightweightWindowEvent event) { Toggleable.setSelected(presentation, false); } }); }
addToggledStateListener
280,962
void (@NotNull LightweightWindowEvent event) { Toggleable.setSelected(presentation, true); }
beforeShown
280,963
void (@NotNull LightweightWindowEvent event) { Toggleable.setSelected(presentation, false); }
onClosed
280,964
AbstractTreeStructure () { return myStructure; }
getStructure
280,965
boolean () { return false; }
isRootVisible
280,966
Project () { return myProject; }
getProject
280,967
String () { return myTitle; }
getTitle
280,968
boolean (T node, T userData) { return true; }
isSelectable
280,969
boolean (T selectedValue) { return false; }
hasSubstep
280,970
PopupStep (T selectedValue, final boolean finalChoice) { return FINAL_CHOICE; }
onChosen
280,971
void () { }
canceled
280,972
String (T value) { return value.toString(); }
getTextFor
280,973
List<T> () { return Collections.emptyList(); }
getValues
280,974
boolean () { return true; }
isSpeedSearchEnabled
280,975
ProgressPanelBuilder (@NlsContexts.Label @NotNull String text) { initialLabelText = text; return this; }
withLabel
280,976
ProgressPanelBuilder () { labelAbove = false; return this; }
moveLabelLeft
280,977
ProgressPanelBuilder (@NotNull Runnable cancelAction) { this.cancelAction = cancelAction; return this; }
withCancel
280,978
ProgressPanelBuilder (String cancelText) { this.cancelText = cancelText; return this; }
andCancelText
280,979
ProgressPanelBuilder () { this.cancelAsButton = true; return this; }
andCancelAsButton
280,980
ProgressPanelBuilder (@NotNull Runnable playAction) { this.resumeAction = playAction; return this; }
withResume
280,981
ProgressPanelBuilder (@NotNull Runnable pauseAction) { this.pauseAction = pauseAction; return this; }
withPause
280,982
ProgressPanelBuilder () { this.smallVariant = true; return this; }
andSmallIcons
280,983
ProgressPanelBuilder () { this.commentEnabled = false; return this; }
withoutComment
280,984
ProgressPanelBuilder () { text2Enabled = true; return this; }
withText2
280,985
ProgressPanelBuilder () { this.topSeparatorEnabled = true; return this; }
withTopSeparator
280,986
JPanel () { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, null, 0, 0); addToPanel(panel, gc, false); return panel; }
createPanel
280,987
boolean () { return true; }
constrainsValid
280,988
void (JPanel panel, GridBagConstraints gc, boolean splitColumns) { if (constrainsValid()) { new LabeledPanelImpl().addToPanel(panel, gc); } }
addToPanel
280,989
int () { int width = labelAbove ? 1 : 2; width += (cancelAction != null) ? 1 : 0; width += (resumeAction != null && pauseAction != null) ? 1 : 0; return width; }
gridWidth
280,990
String () { return commentEnabled ? " " : ""; }
emptyComment
280,991
String () { return label.getText(); }
getLabelText
280,992
void (String labelText) { label.setText(StringUtil.isNotEmpty(labelText) ? labelText : " "); if (StringUtil.isNotEmpty(labelText)) { Dimension size = comment.getPreferredSize(); size.width = label.getMinimumSize().width; comment.setMinimumSize(size); if (text2 != null) { text2.setMinimumSize(size); } } }
setLabelText
280,993
String () { return myServiceComment ? myCommentText : comment.getText(); }
getCommentText
280,994
void (String commentText) { if (commentEnabled) { setCommentText(commentText, false); } }
setCommentText
280,995
void (boolean enabled) { label.setEnabled(enabled); }
setLabelEnabled
280,996
void (boolean enabled) { comment.setEnabled(enabled); }
setCommentEnabled
280,997
void (@Nullable String text) { if (text2 != null) { boolean empty = StringUtil.isEmpty(text); if (empty && !text2.isVisible()) { return; } text2.setText(empty ? " " : text); text2.setVisible(true); } }
setText2
280,998
void (boolean enabled) { if (text2 != null) { text2.setEnabled(enabled); } }
setText2Enabled
280,999
void (boolean enabled) { mySeparatorComponent.setVisible(enabled); }
setSeparatorEnabled