Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
280,700
void (@NotNull Point p) { myUserBounds.setLocation(p); myUserLocationSet = true; myPeer.setLocation(p); }
setLocation
280,701
void (int x, int y) { myUserBounds.setLocation(x, y); myUserLocationSet = true; myPeer.setLocation(x, y); }
setLocation
280,702
void (Rectangle rect) { Rectangle before = null; if (LOG.isDebugEnabled()) { before = new Rectangle(rect); } ScreenUtil.fitToScreen(rect); if (LOG.isDebugEnabled() && !Objects.equals(before, rect)) { LOG.debug("Fitted these bounds to the screen: " + before + " -> " + rect); } }
fitToScreen
280,703
void () { myPeer.centerInParent(); }
centerRelativeToParent
280,704
void () { if (LoadingState.APP_STARTED.isOccurred()) { logShowDialogEvent(); } doShow(); }
show
280,705
boolean () { if (!isModal()) { throw new IllegalStateException("The showAndGet() method is for modal dialogs only"); } show(); return isOK(); }
showAndGet
280,706
AsyncResult<Boolean> () { if (isModal()) { throw new IllegalStateException("The showAndGetOk() method is for modeless dialogs only"); } AsyncResult<Boolean> result = new AsyncResult<>(); Disposer.register(myDisposable, () -> result.setDone(isOK())); doShow(); return result; }
showAndGetOk
280,707
void () { if (UiInterceptors.tryIntercept(this)) { return; } ensureEventDispatchThread(); registerKeyboardShortcuts(); Disposable uiParent = ClientDisposableProvider.getCurrentDisposable(); // may be null if no app yet (license agreement) if (uiParent != null) { // ensure everything is disposed on app quit Disposer.reg...
doShow
280,708
void (@NotNull Computable<? extends Point> callback) { myInitialLocationCallback = callback; }
setInitialLocationCallback
280,709
void () { }
beforeShowCallback
280,710
void () { JRootPane rootPane = getRootPane(); if (rootPane == null) return; ActionListener cancelKeyboardAction = createCancelAction(); if (cancelKeyboardAction != null) { rootPane.registerKeyboardAction(cancelKeyboardAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), WHEN_IN_FOCUSED_WINDOW); ActionUtil.registerFor...
registerKeyboardShortcuts
280,711
void (boolean next) { List<JButton> buttons = new ArrayList<>(myButtonMap.values()); int focusedIndex = ContainerUtil.indexOf(buttons, (Condition<? super Component>)Component::hasFocus); if (focusedIndex >= 0) { getEnabledIndexCyclic(buttons, focusedIndex, next).ifPresent(i -> buttons.get(i).requestFocus()); } }
focusButton
280,712
OptionalInt (@NotNull List<? extends Component> components, int currentIndex, boolean next) { assert -1 <= currentIndex && currentIndex <= components.size(); int start = !next && currentIndex == -1 ? components.size() : currentIndex; return IntStream.range(0, components.size()) .map(i -> (next ? start + i + 1 : start +...
getEnabledIndexCyclic
280,713
void (int exitCode) { boolean canRecord = canRecordDialogId(); if (canRecord) { FeatureUsageUiEventsKt.getUiEventLogger().logCloseDialog(getClass(), exitCode); } }
logCloseDialogEvent
280,714
void () { boolean canRecord = canRecordDialogId(); if (canRecord) { FeatureUsageUiEventsKt.getUiEventLogger().logShowDialog(getClass()); } }
logShowDialogEvent
280,715
void () { if (!canRecordDialogId()) return; FeatureUsageUiEventsKt.getUiEventLogger().logClickOnHelpDialog(getClass()); }
logClickOnHelpDialogEvent
280,716
boolean () { return true; }
canRecordDialogId
280,717
void (ActionEvent e) { if (myClosed) return; if (myPerformAction) return; myPerformAction = true; try (AccessToken ignore = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { doAction(e); } finally { myPerformAction = false; } }
actionPerformed
280,718
void (ActionEvent e) { recordAction("DialogOkAction", EventQueue.getCurrentEvent()); List<ValidationInfo> infoList = doValidateAll(); if (!infoList.isEmpty()) { ValidationInfo info = infoList.get(0); if (info.component != null && info.component.isVisible()) { IdeFocusManager.getInstance(null).requestFocus(info.componen...
doAction
280,719
void (String name, AWTEvent event) { if (event instanceof KeyEvent && ApplicationManager.getApplication() != null && LoadingState.COMPONENTS_REGISTERED.isOccurred()) { // noinspection removal ActionsCollector.getInstance().record(name, (KeyEvent)event, getClass()); } }
recordAction
280,720
void (ActionEvent e) { doCancelAction(e); }
doAction
280,721
void (ActionEvent e) { if (isEnabled()) { close(myExitCode); } }
doAction
280,722
void (ActionEvent e) { myHelpActionPerformed.run(); }
actionPerformed
280,723
void (@NlsContexts.DialogMessage @Nullable String text) { setErrorText(text, null); }
setErrorText
280,724
void (@Nullable HtmlChunk errorHtml) { setErrorInfoAll(errorHtml == null ? List.of() : List.of(new ValidationInfo(errorHtml, null))); }
setErrorHtml
280,725
void (@Nullable HtmlChunk errorHtml, @Nullable JComponent component) { setErrorInfoAll(errorHtml == null ? List.of() : List.of(new ValidationInfo(errorHtml, component))); }
setErrorHtml
280,726
void (@NlsContexts.DialogMessage @Nullable String text, @Nullable JComponent component) { setErrorInfoAll(text == null ? List.of() : List.of(new ValidationInfo(text, component))); }
setErrorText
280,727
void (@NotNull List<ValidationInfo> info) { if (myInfo.equals(info)) return; updateErrorText(info); updateComponentErrors(info); myInfo = info; }
setErrorInfoAll
280,728
void (@NotNull List<ValidationInfo> info) { // clear current component errors myInfo.stream() .filter(vi -> !info.contains(vi)) .filter(vi -> vi.component != null) .map(vi -> ComponentValidator.getInstance(vi.component)) .forEach(c -> c.ifPresent(vi -> vi.updateInfo(null))); // show current errors for (ValidationInfo v...
updateComponentErrors
280,729
void (@NotNull List<ValidationInfo> infos) { //init was not called - there's nothing to update ErrorText errorText = myErrorText; if (errorText == null) return; Runnable updateRunnable = () -> { if (!myDisposed) doUpdateErrorText(errorText, infos); }; Application application = ApplicationManager.getApplication(); boole...
updateErrorText
280,730
void (@NotNull ErrorText errorText, @NotNull List<ValidationInfo> infos) { HtmlBuilder htmlBuilder = new HtmlBuilder(); for (ValidationInfo info : infos) { if (info.component != null || Strings.isEmptyOrSpaces(info.message)) { continue; } Color color = info.warning ? MessageType.WARNING.getTitleForeground() : NamedColo...
doUpdateErrorText
280,731
boolean (@NotNull JComponent component) { return ContainerUtil.exists(myInfo, i -> component.equals(i.component) && !i.warning); }
hasErrors
280,732
void () { if (myActualSize == null && !myErrorText.isVisible()) { myActualSize = getSize(); } }
updateSize
280,733
void (@NotNull @Nls String errorText) { myLabel.setText(errorText); setVisible(true); }
setText
280,734
boolean () { boolean isCurrentlyVisible = isVisible(); myLabel.setBounds(0, 0, 0, 0); myLabel.setText(""); setVisible(false); return isCurrentlyVisible; }
clear
280,735
Border (@Nullable Border contentBorder) { Insets contentInsets = contentBorder != null ? contentBorder.getBorderInsets(null) : JBInsets.emptyInsets(); Insets baseInsets = JBInsets.create(16, 13); //noinspection UseDPIAwareBorders: Insets are already scaled, so use raw version. return new EmptyBorder(baseInsets.top, bas...
createErrorTextBorder
280,736
DialogWrapperPeer () { return myPeer; }
getPeer
280,737
void () { if (!EventQueue.isDispatchThread()) { throw new IllegalStateException("The DialogWrapper can only be used in event dispatch thread. Current thread: "+Thread.currentThread()); } }
ensureEventDispatchThread
280,738
Disposable () { return myDisposable; }
getDisposable
280,739
boolean () { return myDisposed; }
isDisposed
280,740
void () { if (isDisposed()) return; Disposer.dispose(getDisposable()); }
disposeIfNeeded
280,741
void (@Nullable Object object, @NotNull Condition<? super Field> selectCondition) { if (object == null) return; for (Field each : ReflectionUtil.collectFields(object.getClass())) { if ((each.getModifiers() & (Modifier.FINAL | Modifier.STATIC)) > 0) continue; if (!selectCondition.value(each)) continue; try { ReflectionU...
clearOwnFields
280,742
Color () { Color bg = UIManager.getColor("DialogWrapper.southPanelBackground"); if (myStyle == DialogStyle.COMPACT && bg != null) { return bg; } return super.getBackground(); }
getBackground
280,743
String (String message) { throw new RuntimeException(message); }
show
280,744
String (String message) { return ""; }
show
280,745
Dimension () { return getPreferredSize(); }
getMinimumSize
280,746
Dimension () { return getPreferredSize(); }
getMaximumSize
280,747
Dimension () { if (mySize != -1) { return new Dimension(mySize, mySize); } Dimension d = super.getPreferredSize(); int base = new JTextField().getPreferredSize().height; if (base %2 == 1) base++; d.width = Math.max(d.height, base); int width = mySize == -1 ? d.width : mySize; int height = myComponent != null ? myCompon...
getPreferredSize
280,748
void (JComponent component) { myComponent = component; }
setAttachedComponent
280,749
JComponent () { return myComponent; }
getAttachedComponent
280,750
void (int size) { mySize = size; }
setSize
280,751
boolean () { return false; }
isChooseMultiple
280,752
void (@Nullable Project project) { myProject = project; }
setProject
280,753
void () { FileChooserDescriptor fileChooserDescriptor = myFileChooserDescriptor; if (myTitle != null || myDescription != null) { fileChooserDescriptor = (FileChooserDescriptor)myFileChooserDescriptor.clone(); if (myTitle != null) { fileChooserDescriptor.setTitle(myTitle); } if (myDescription != null) { fileChooserDescr...
run
280,754
String () { return myAccessor.getText(myTextComponent).trim(); }
getComponentText
280,755
void (@NotNull VirtualFile chosenFile) { myAccessor.setText(myTextComponent, chosenFileToResultingText(chosenFile)); }
onFileChosen
280,756
String ( JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR) { String s = layoutCompoundLabel( label, fontMetrics, splitStringByLines(text), icon, label.getVerticalAlignment(), label.getHorizontalAlignment(), label.getVerticalTextPosition(), label.getHorizon...
layoutCL
280,757
String (JComponent c, FontMetrics fm, String[] text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap) { boolean orientationIsLeftToRight = true; if (c != null) { if (!(c.getComponentOrient...
layoutCompoundLabel
280,758
String ( FontMetrics fm, String[] text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap) { /* Initialize the icon bounds rectangle iconR. */ if (icon != null) { iconR.width = icon.getIconW...
layoutCompoundLabel
280,759
void (JLabel l, Graphics g, String s, int textX, int textY) { int accChar = l.getDisplayedMnemonic(); g.setColor(l.getForeground()); drawString(g, s, accChar, textX, textY); }
paintEnabledText
280,760
void (JLabel l, Graphics g, String s, int textX, int textY) { int accChar = l.getDisplayedMnemonic(); g.setColor(l.getBackground()); drawString(g, s, accChar, textX, textY); }
paintDisabledText
280,761
void (Graphics g, String s, int accChar, int textX, int textY) { UISettings.setupAntialiasing(g); if (s.indexOf('\n') == -1) BasicGraphicsUtils.drawString(g, s, accChar, textX, textY); else { String[] strs = splitStringByLines(s); int height = g.getFontMetrics().getHeight(); // Only the first line can have the accel ch...
drawString
280,762
Dimension (FontMetrics fm, @Nls String [] strs) { int width = 0; for (@Nls String str : strs) { width = Math.max(width, SwingUtilities.computeStringWidth(fm, str)); } return new Dimension(width, fm.getHeight() * strs.length); }
computeMultiLineDimension
280,763
String[] (String str) { if (str == null) return ArrayUtilRt.EMPTY_STRING_ARRAY; if (str.equals(myString)) { return myLines; } myString = convertTabs(str, 2); myLines = StringUtil.splitByLines(myString, false); return myLines; }
splitStringByLines
280,764
String (@Nls String text, final int tabLength) { @Nls StringBuilder buf = new StringBuilder(text.length()); for (int idx = 0; idx < text.length(); idx++) { char ch = text.charAt(idx); if (ch == '\t') { for (int i = 0; i < tabLength; i++) buf.append(' '); } else { buf.append(ch); } } return buf.toString(); }
convertTabs
280,765
boolean () { return myNeedsRepaint; }
needsRepaint
280,766
void (boolean needsRepaint) { setNeedsRepaint(needsRepaint, null); }
setNeedsRepaint
280,767
void (boolean needsRepaint, @Nullable JComponent dirtyComponent) { myNeedsRepaint = needsRepaint; if (myNeedsRepaint) { fireNeedsRepaint(dirtyComponent); } }
setNeedsRepaint
280,768
void (@NotNull Listener listener) { myListeners.add(listener); }
addListener
280,769
void (@NotNull Listener listener) { myListeners.remove(listener); }
removeListener
280,770
void (JComponent dirtyComponent) { for (Listener each : myListeners) { each.onNeedsRepaint(this, dirtyComponent); } }
fireNeedsRepaint
280,771
void (Component component, Graphics2D g) { myNeedsRepaint = false; executePaint(component, g); }
paint
280,772
void (ContainerEvent e) { Component child = e.getChild(); if (child instanceof Container) { ((Container)child).addContainerListener(this); } if (myBorderless) { UIUtil.removeScrollBorder(SimpleToolWindowPanel.this); } }
componentAdded
280,773
void (ContainerEvent e) { Component child = e.getChild(); if (child instanceof Container) { ((Container)child).removeContainerListener(this); } }
componentRemoved
280,774
boolean () { return myVertical; }
isVertical
280,775
void (boolean vertical) { if (myVertical == vertical) return; removeAll(); myVertical = vertical; updateLayout(); setContent(myContent); setToolbar(myToolbar); }
setVertical
280,776
boolean () { return myToolbar != null && myToolbar.isVisible(); }
isToolbarVisible
280,777
void () { setLayout(new BorderLayout(myVertical ? 0 : 1, myVertical ? 1 : 0)); }
updateLayout
280,778
void (@Nullable JComponent c) { if (c == null) { JComponent toolbar = myToolbar; if (toolbar != null) { remove(toolbar); } } myToolbar = c; if (myToolbar instanceof ActionToolbar) { ((ActionToolbar)myToolbar).setOrientation(myVertical ? SwingConstants.HORIZONTAL : SwingConstants.VERTICAL); } if (c != null) { if (myVert...
setToolbar
280,779
SimpleToolWindowPanel (boolean provide) { myProvideQuickActions = provide; return this; }
setProvideQuickActions
280,780
List<AnAction> (boolean originalProvider) { return collectActions(myToolbar); }
getActions
280,781
JComponent () { return this; }
getComponent
280,782
void (@NotNull JComponent c) { if (myContent != null) { remove(myContent); } myContent = c; if (ExperimentalUI.isNewUI()) { JScrollPane scrollPane = UIUtil.findComponentOfType(myContent, JScrollPane.class); AdjustmentListener listener = event -> { ClientProperty.put(myContent, SCROLLED_STATE, event.getAdjustable().getV...
setContent
280,783
void (Graphics g) { super.paintComponent(g); if (myToolbar != null && myToolbar.getParent() == this && myContent != null && myContent.getParent() == this) { g.setColor(JBColor.border()); if (ExperimentalUI.isNewUI()) { //don't draw line for scrolled content if (Boolean.FALSE.equals(ClientProperty.get(myContent, SCROLLE...
paintComponent
280,784
List<AnAction> (@Nullable JComponent component) { JBIterable<ActionToolbar> toolbars = UIUtil.uiTraverser(component).traverse().filter(ActionToolbar.class); if (toolbars.size() == 0) { return Collections.emptyList(); } return toolbars.flatten(ActionToolbar::getActions).toList(); }
collectActions
280,785
DialogWrapperPeerFactory () { if (!LoadingState.COMPONENTS_REGISTERED.isOccurred()) { return getInstanceByName(); } DialogWrapperPeerFactory factory = ApplicationManager.getApplication().getService(DialogWrapperPeerFactory.class); return factory == null ? getInstanceByName() : factory; }
getInstance
280,786
DialogWrapperPeerFactory () { try { Constructor<?> constructor = Class.forName("com.intellij.openapi.ui.impl.DialogWrapperPeerFactoryImpl").getDeclaredConstructor(); constructor.setAccessible(true); return (DialogWrapperPeerFactory)constructor.newInstance(); } catch (Exception e) { throw new RuntimeException("Can't ins...
getInstanceByName
280,787
JComponent () { JPanel panel = createIconPanel(); JPanel messagePanel = createMessagePanel(); messagePanel.add(createCheckComponent(), BorderLayout.SOUTH); panel.add(messagePanel, BorderLayout.CENTER); return panel; }
createNorthPanel
280,788
JComponent () { myCheckBox = new JCheckBox(myCheckboxText); myCheckBox.setSelected(myChecked); return myCheckBox; }
createCheckComponent
280,789
int () { final int exitCode = super.getExitCode(); if (myExitFunc != null) { return myExitFunc.apply(exitCode, myCheckBox); } boolean checkBoxSelected = (myCheckBox != null && myCheckBox.isSelected()); boolean okExitCode = (exitCode == OK_EXIT_CODE); return checkBoxSelected && okExitCode ? OK_EXIT_CODE : CANCEL_EXIT_CO...
getExitCode
280,790
JComponent () { return myDefaultOptionIndex == -1 ? myCheckBox : super.getPreferredFocusedComponent(); }
getPreferredFocusedComponent
280,791
JComponent () { return null; }
createCenterPanel
280,792
void (@NlsContexts.DialogTitle String title, @NlsContexts.DialogMessage @Nullable String message, String @NotNull [] options, int defaultOptionIndex, int focusedOptionIndex, @Nullable Icon icon, @Nullable com.intellij.openapi.ui.DoNotAskOption doNotAskOption, @Nullable String helpId) { setTitle(title); myMessage = mess...
_init
280,793
void (ActionEvent e) { close(exitCode, true); }
actionPerformed
280,794
void () { close(-1); }
doCancelAction
280,795
JComponent () { return doCreateCenterPanel(); }
createCenterPanel
280,796
JComponent () { JPanel panel = createIconPanel(); if (myMessage != null) { JTextPane messageComponent = createMessageComponent(myMessage); panel.add(Messages.wrapToScrollPaneIfNeeded(messageComponent, 100, 15), BorderLayout.CENTER); } return panel; }
doCreateCenterPanel
280,797
JPanel () { JPanel panel = new JPanel(new BorderLayout(15, 0)); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); Container container = new Container(); container.setLayout(new BorderLayout()); container.add(iconLabel, BorderLayout.NORTH); panel.add(container, BorderLayout.WEST); } return panel; }
createIconPanel
280,798
JPanel () { JPanel messagePanel = new JPanel(new BorderLayout()); if (myMessage != null) { JLabel textLabel = new JLabel(myMessage); textLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); textLabel.setUI(new MultiLineLabelUI()); messagePanel.add(textLabel, BorderLayout.NORTH); } return messagePanel; }
createMessagePanel
280,799
JTextPane (final @NlsContexts.DialogMessage String message) { final JTextPane messageComponent = new JTextPane(); return Messages.configureMessagePaneUi(messageComponent, message); }
createMessageComponent