Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
278,500
long (boolean isCyclic) { var f = frame; frame++; if (isCyclic) { frame %= frames; } return f; }
getNextFrame
278,501
long () { // at least one frame should be played return Math.max(frames, 1); }
getTotalFrames
278,502
long (long currentFrame) { return period; }
getDelay
278,503
long (boolean isCyclic) { return TimeUnit.NANOSECONDS.toMillis(System.nanoTime()) - startTime; }
getNextFrame
278,504
long () { return duration; }
getTotalFrames
278,505
long (long currentFrame) { return Math.min(duration - currentFrame, period); }
getDelay
278,506
long () { return taskId; }
getTaskId
278,507
long () { return count.get(); }
getCount
278,508
long () { return TimeUnit.NANOSECONDS.toMillis(end - start); }
getDuration
278,509
String () { return "Statistic{" + "name=" + myName + ", taskId=" + taskId + ", duration=" + getDuration() + "ms" + ", count=" + count + ", updates=" + (count.get() * 1000 / getDuration()) + '}'; }
toString
278,510
<T> (@NotNull DoubleFunction<? extends T> function, @NotNull Consumer<? super T> consumer) { myConsumer = value -> consumer.accept(function.apply(value)); }
Animation
278,511
int () { return myDelay; }
getDelay
278,512
Animation (int delay) { myDelay = Math.max(delay, 0); return this; }
setDelay
278,513
int () { return myDuration; }
getDuration
278,514
Animation (int duration) { myDuration = Math.max(duration, 0); return this; }
setDuration
278,515
int () { return myDelay + myDuration; }
getFinish
278,516
Easing () { return myEasing; }
getEasing
278,517
Animation (@NotNull Easing easing) { myEasing = easing; return this; }
setEasing
278,518
Animation (@NotNull Listener listener) { if (myListeners == null) { myListeners = new ArrayList<>(); } myListeners.add(listener); return this; }
addListener
278,519
Animation (@NotNull Runnable runnable) { return addListener(Phase.SCHEDULED, runnable); }
runWhenScheduled
278,520
Animation (@NotNull Runnable runnable) { return addListener(Phase.UPDATED, runnable); }
runWhenUpdated
278,521
Animation (@NotNull Runnable runnable) { return addListener(Phase.EXPIRED, runnable); }
runWhenExpired
278,522
Animation (@NotNull Runnable runnable) { return addListener(Phase.CANCELLED, runnable); }
runWhenCancelled
278,523
Animation (@NotNull Runnable runnable) { return addListener(p -> { if (p == Phase.EXPIRED || p == Phase.CANCELLED) runnable.run(); }); }
runWhenExpiredOrCancelled
278,524
Animation (@NotNull Phase phase, @NotNull Runnable runnable) { return addListener(p -> { if (p == phase) runnable.run(); }); }
addListener
278,525
void (@NotNull Phase phase) { if (myListeners == null) { return; } Iterator<Listener> iterator = myListeners.iterator(); while (iterator.hasNext()) { try { iterator.next().update(phase); } catch (Throwable t) { iterator.remove(); Logger.getInstance(Animation.class).error("Listener caused an error and was removed from listeners", t); } } }
fireEvent
278,526
ActivityTracker (@NotNull Supplier<@NotNull @NlsSafe String> debugMessageProducer) { return new MyActivityTracker(); }
registerBeginningOfInitializationActivity
278,527
boolean () { return true; }
isProjectInitializationAndIndexingFinished
278,528
void () { }
activityFinished
278,529
ProjectInitializationDiagnosticService (@NotNull Project project) { return project.getService(ProjectInitializationDiagnosticService.class); }
getInstance
278,530
ActivityTracker (@NotNull Project project, @NotNull @NlsSafe String debugActivityName) { return getInstance(project).registerBeginningOfInitializationActivity(() -> debugActivityName); }
registerTracker
278,531
DelegatingItemPresentation (@Nls String presentableText) { myPresentableText = presentableText; return this; }
withPresentableText
278,532
DelegatingItemPresentation (@Nullable String locationString) { myCustomLocationString = true; myLocationString = locationString; return this; }
withLocationString
278,533
DelegatingItemPresentation (Icon icon) { myIcon = icon; return this; }
withIcon
278,534
String () { if (myPresentableText != null) { return myPresentableText; } return myBase.getPresentableText(); }
getPresentableText
278,535
String () { if (myCustomLocationString) { return myLocationString; } return myBase.getLocationString(); }
getLocationString
278,536
Icon (boolean open) { if (myIcon != null) { return myIcon; } return myBase.getIcon(open); }
getIcon
278,537
TextAttributesKey () { return myBase instanceof ColoredItemPresentation ? ((ColoredItemPresentation) myBase).getTextAttributesKey() : null; }
getTextAttributesKey
278,538
void (Element element) { myId = Objects.requireNonNull(element.getAttributeValue(ATTRIBUTE_ID)); myTipId = element.getAttributeValue(ATTRIBUTE_TIP_ID); String needToBeShownInGuide = element.getAttributeValue(ATTRIBUTE_SHOW_IN_GUIDE); if (needToBeShownInGuide != null) { myNeedToBeShownInGuide = Boolean.parseBoolean(needToBeShownInGuide); } myDaysBeforeFirstShowUp = StringUtil.parseInt(element.getAttributeValue(ATTRIBUTE_FIRST_SHOW), myDaysBeforeFirstShowUp); myDaysBetweenSuccessiveShowUps = StringUtil.parseInt(element.getAttributeValue(ATTRIBUTE_SUCCESSIVE_SHOW), myDaysBetweenSuccessiveShowUps); myMinUsageCount = StringUtil.parseInt(element.getAttributeValue(ATTRIBUTE_MIN_USAGE_COUNT), myMinUsageCount); myUtilityScore = StringUtil.parseInt(element.getAttributeValue(ATTRIBUTE_UTILITY_SCORE), myUtilityScore); List<Element> actionEvents = element.getChildren(ELEMENT_TRACK_ACTION); for (Element actionElement : actionEvents) { @NonNls String actionId = actionElement.getAttributeValue(ATTRIBUTE_ID); if (actionId != null) { myActionEvents.add(FeatureUsageEvent.createActionEvent(myId, actionId)); } } List<Element> intentionEvents = element.getChildren(ELEMENT_TRACK_INTENTION); for (Element intentionElement : intentionEvents) { @NonNls String intentionClassName = intentionElement.getAttributeValue(ATTRIBUTE_CLASS_NAME); if (intentionClassName != null) { myIntentionEvents.add(FeatureUsageEvent.createIntentionEvent(myId, intentionClassName)); } } List<Element> dependencies = element.getChildren(ELEMENT_DEPENDENCY); if (!dependencies.isEmpty()) { myDependencies = new HashSet<>(); for (Element dependencyElement : dependencies) { myDependencies.add(dependencyElement.getAttributeValue(ATTRIBUTE_ID)); } } }
readExternal
278,539
String () { return myId; }
getId
278,540
String () { if (myDisplayName == null) { myDisplayName = FeatureStatisticsBundle.message(myId); } return myDisplayName; }
getDisplayName
278,541
boolean () { return myNeedToBeShownInGuide; }
isNeedToBeShownInGuide
278,542
int () { return myUsageCount; }
getUsageCount
278,543
boolean () { return myUsageCount < myMinUsageCount; }
isUnused
278,544
void (int newUsageCount, long newLastTimeUsed) { myUsageCount = Math.max(myUsageCount, newUsageCount); myLastTimeUsed = Math.max(myLastTimeUsed, newLastTimeUsed); }
adjustUsageInfo
278,545
String () { return "id = [" + myId + "], displayName = [" + myDisplayName + "], groupId = [" + myGroupId + "], usageCount = [" + myUsageCount + "]"; }
toString
278,546
int () { return myDaysBeforeFirstShowUp; }
getDaysBeforeFirstShowUp
278,547
int () { return myDaysBetweenSuccessiveShowUps; }
getDaysBetweenSuccessiveShowUps
278,548
int () { return myUtilityScore; }
getUtilityScore
278,549
long () { return myLastTimeShown; }
getLastTimeShown
278,550
String[] () { if (myDependencies == null) return ArrayUtilRt.EMPTY_STRING_ARRAY; return ArrayUtilRt.toStringArray(myDependencies); }
getDependencyFeatures
278,551
long () { return myLastTimeUsed; }
getLastTimeUsed
278,552
int () { return myShownCount; }
getShownCount
278,553
void (Element element) { myId = element.getAttributeValue(ID_ATTR); }
readExternal
278,554
String () { return myId; }
getId
278,555
ResourceBundle (final String key) { ResourceBundle providerBundle = ProviderBundles.INSTANCE.get(key); if (providerBundle != null) { return providerBundle; } ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle); if (bundle == null) { bundle = ResourceBundle.getBundle(BUNDLE); ourBundle = new SoftReference<>(bundle); } return bundle; }
getBundle
278,556
PluginDescriptor () { return myPluginDescriptor; }
getPluginDescriptor
278,557
void (@NotNull PluginDescriptor pluginDescriptor) { myPluginDescriptor = pluginDescriptor; }
setPluginDescriptor
278,558
FeatureDescriptor[] () { return new FeatureDescriptor[0]; }
getFeatureDescriptors
278,559
GroupDescriptor[] () { return new GroupDescriptor[0]; }
getGroupDescriptors
278,560
ApplicabilityFilter[] () { return new ApplicabilityFilter[0]; }
getApplicabilityFilters
278,561
Collection<String> () { return Collections.emptyList(); }
getXmlFilesUrls
278,562
String () { return myFeatureId; }
featureId
278,563
Action (@NonNls @NotNull String featureId, @NonNls @NotNull String actionId) { return new Action(featureId, actionId); }
createActionEvent
278,564
Intention (@NonNls @NotNull String featureId, @NonNls @NotNull String intentionClassName) { return new Intention(featureId, intentionClassName); }
createIntentionEvent
278,565
String () { return myActionId; }
getActionId
278,566
String () { return myIntentionClassName; }
getIntentionClassName
278,567
boolean () { return true; }
canNavigate
278,568
boolean () { return true; }
canNavigateToSource
278,569
void (Project project, VirtualFile file, boolean requestFocus) { navigate(project, file, 0, requestFocus); }
navigate
278,570
void (Project project, VirtualFile file, int offset, boolean requestFocus) { PsiNavigationSupport.getInstance().createNavigatable(project, file, offset).navigate(requestFocus); }
navigate
278,571
FreezeLogger () { return ApplicationManager.getApplication().getService(FreezeLogger.class); }
getInstance
278,572
void (final ExecutionException e, final @NlsContexts.DialogTitle String title, final Project project) { if (e instanceof RunCanceledByUserException) { return; } if (ApplicationManager.getApplication().isUnitTestMode()) { throw new RuntimeException(e.getLocalizedMessage()); } final String message = e.getMessage(); if (message == null || message.length() < 100) { Messages.showErrorDialog(project, message == null ? IdeBundle.message("error.message.exception.was.thrown") : message, title); return; } final DialogBuilder builder = new DialogBuilder(project); builder.setTitle(title); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setForeground(UIUtil.getLabelForeground()); textArea.setBackground(UIUtil.getLabelBackground()); textArea.setFont(StartupUiUtil.getLabelFont()); textArea.setText(message); textArea.setWrapStyleWord(false); textArea.setLineWrap(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel panel = new JPanel(new BorderLayout(10, 0)); panel.setPreferredSize(JBUI.size(500, 200)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(new JLabel(Messages.getErrorIcon()), BorderLayout.WEST); builder.setCenterPanel(panel); builder.addOkAction(); builder.show(); }
show
278,573
void (@NotNull Project project) { navigate(project, null); }
navigate
278,574
void (@NotNull Project project) { BrowserUtil.browse(myUrl); }
navigate
278,575
void () { super.addNotify(); myDisposable = Disposer.newDisposable(); registerShortcuts(); }
addNotify
278,576
void () { super.removeNotify(); Disposer.dispose(myDisposable); }
removeNotify
278,577
void () { if (myDisposable != null && !Disposer.isDisposed(myDisposable)) { Disposer.dispose(myDisposable); } }
dispose
278,578
Collection<SettingsEditor<Settings>> () { return new ArrayList<>(myFragments); }
getEditors
278,579
JComponent () { List<SettingsEditorFragment<Settings, ?>> fragments = new ArrayList<>(myFragments); fragments.sort(Comparator.comparingInt(SettingsEditorFragment::getPriority)); SettingsEditorFragment<Settings, ?> beforeRun = ContainerUtil.find(fragments, fragment -> fragment.isBeforeRun()); SettingsEditorFragment<Settings, ?> header = ContainerUtil.find(fragments, fragment -> fragment.isHeader()); List<SettingsEditorFragment<Settings, ?>> commandLine = ContainerUtil.filter(fragments, fragment -> fragment.isCommandLine()); List<SettingsEditorFragment<Settings, ?>> subGroups = ContainerUtil.filter(fragments, fragment -> !fragment.getChildren().isEmpty()); List<SettingsEditorFragment<Settings, ?>> tags = ContainerUtil.filter(fragments, it -> it.isTag()); fragments.remove(beforeRun); fragments.remove(header); fragments.removeAll(commandLine); fragments.removeAll(subGroups); fragments.removeAll(tags); if (myMain == null) { myPanel.setBorder(JBUI.Borders.emptyLeft(5)); addLine(new JSeparator()); } addBeforeRun(beforeRun); addHeader(header); myGroupInset = myMain == null ? 0 : LEFT_INSET; if (myMain != null && myMain.component() != null) { addLine(myMain.component()); } addCommandLinePanel(commandLine); addFragments(fragments); addTagPanel(tags); addSubGroups(subGroups); myGroupInset = 0; if (myMain == null) { myConstraints.weighty = 1; myPanel.add(new JPanel(), myConstraints); } return myPanel; }
createCompoundEditor
278,580
void (Component component, int top, int left, int bottom) { myConstraints.insets = JBUI.insets(top, left + myGroupInset, bottom, 0); myPanel.add(component, myConstraints.clone()); myConstraints.gridy++; myConstraints.insets = JBUI.insetsTop(top); }
addLine
278,581
void (Component component) { addLine(component, TOP_INSET, 0, 0); }
addLine
278,582
void (@Nullable SettingsEditorFragment<Settings, ?> beforeRun) { if (beforeRun != null) { addLine(beforeRun.getComponent(), TOP_INSET, 0, TOP_INSET * 2); } }
addBeforeRun
278,583
void (@Nullable SettingsEditorFragment<Settings, ?> header) { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(JBUI.Borders.empty(5, 0)); if (header != null) { panel.add(header.getComponent(), BorderLayout.WEST); } var separator = createHeaderSeparator(); if (separator != null) { panel.add(separator, BorderLayout.CENTER); } String message = OptionsBundle.message(myMain == null ? "settings.editor.modify.options" : "settings.editor.modify"); myLinkLabel = new DropDownLink<>(message, link -> showOptions()); myLinkLabel.setBorder(JBUI.Borders.emptyLeft(5)); JPanel linkPanel = new JPanel(new BorderLayout()); linkPanel.add(myLinkLabel, BorderLayout.CENTER); CustomShortcutSet shortcutSet = KeymapUtil.getShortcutsForMnemonicCode(TextWithMnemonic.parse(message).getMnemonicCode()); if (shortcutSet != null) { List<String> list = ContainerUtil.sorted(ContainerUtil.map(shortcutSet.getShortcuts(), shortcut -> KeymapUtil.getShortcutText(shortcut)), Comparator.comparingInt(String::length)); JLabel shortcutLabel = new JLabel(list.get(0)); shortcutLabel.setEnabled(false); shortcutLabel.setBorder(JBUI.Borders.empty(0, 5)); linkPanel.add(shortcutLabel, BorderLayout.EAST); } panel.add(linkPanel, BorderLayout.EAST); addLine(panel, myMain == null ? TOP_INSET : LARGE_TOP_INSET, 0, 0); }
addHeader
278,584
void (@NotNull List<? extends SettingsEditorFragment<Settings, ?>> fragments) { for (SettingsEditorFragment<Settings, ?> fragment : fragments) { JComponent component = fragment.getComponent(); addLine(component); if (fragment.getHintComponent() != null) { addLine(fragment.getHintComponent(), TOP_INSET, getLeftInset(component), 0); } } }
addFragments
278,585
void (@NotNull List<? extends SettingsEditorFragment<Settings, ?>> subGroups) { for (SettingsEditorFragment<Settings, ?> group : subGroups) { addLine(group.getComponent(), 0, 0, 0); } }
addSubGroups
278,586
void (@NotNull List<? extends SettingsEditorFragment<Settings, ?>> tags) { JPanel tagsPanel = new JPanel(new WrapLayout(FlowLayout.LEADING, JBUI.scale(TAG_HGAP), JBUI.scale(TAG_VGAP))); for (SettingsEditorFragment<Settings, ?> tag : tags) { tagsPanel.add(tag.getComponent()); } if (tagsPanel.getComponentCount() > 0) { hideWhenChildrenIsInvisible(tagsPanel); addLine(tagsPanel, MEDIUM_TOP_INSET, -getLeftInset((JComponent)tagsPanel.getComponent(0)) - TAG_HGAP, 0); } }
addTagPanel
278,587
void (JComponent component) { Component[] children = component.getComponents(); component.setVisible(ContainerUtil.exists(children, it -> it.isVisible())); for (var child : children) { UIUtil.runWhenVisibilityChanged(child, () -> component.setVisible(ContainerUtil.exists(children, it -> it.isVisible()))); } }
hideWhenChildrenIsInvisible
278,588
void () { for (AnAction action : buildGroup(new Ref<>()).getChildActionsOrStubs()) { ShortcutSet shortcutSet = action.getShortcutSet(); if (shortcutSet.getShortcuts().length > 0 && action instanceof ToggleFragmentAction) { new DumbAwareAction(action.getTemplateText()) { @Override public void actionPerformed(@NotNull AnActionEvent e) { SettingsEditorFragment<?, ?> fragment = ((ToggleFragmentAction)action).myFragment; fragment.toggle(true, e); // show or set focus IdeFocusManager.getGlobalInstance().requestFocus(fragment.getEditorComponent(), false); FragmentStatisticsService.getInstance().logNavigateOption(e.getProject(), fragment.getId(), myConfigId, e); } }.registerCustomShortcutSet(shortcutSet, myPanel.getRootPane(), myDisposable); } } }
registerShortcuts
278,589
void (@NotNull AnActionEvent e) { SettingsEditorFragment<?, ?> fragment = ((ToggleFragmentAction)action).myFragment; fragment.toggle(true, e); // show or set focus IdeFocusManager.getGlobalInstance().requestFocus(fragment.getEditorComponent(), false); FragmentStatisticsService.getInstance().logNavigateOption(e.getProject(), fragment.getId(), myConfigId, e); }
actionPerformed
278,590
JBPopup () { DataContext dataContext = DataManager.getInstance().getDataContext(myLinkLabel); Ref<JComponent> lastSelected = new Ref<>(); DefaultActionGroup group = buildGroup(lastSelected); Runnable callback = () -> { ApplicationManager.getApplication().invokeLater(() -> { JComponent component = lastSelected.get(); if (component != null && !(component instanceof JPanel) && !(component instanceof JLabel)) { IdeFocusManager.getGlobalInstance().requestFocus(component, false); } }); }; String title = myMain != null ? IdeBundle.message("popup.title.add.group.options", myMain.getGroup()) : IdeBundle.message("popup.title.add.run.options"); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(title, group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true, callback, -1); popup.setHandleAutoSelectionBeforeShow(true); popup.addListSelectionListener(e -> { JBPopup jbPopup = PopupUtil.getPopupContainerFor((Component)e.getSource()); Object selectedItem = PlatformCoreDataKeys.SELECTED_ITEM.getData((DataProvider)e.getSource()); if (selectedItem instanceof AnActionHolder) { jbPopup.setAdText(getHint(((AnActionHolder)selectedItem).getAction()), SwingConstants.LEFT); } }); return popup; }
showOptions
278,591
void (String configId) { myConfigId = configId; }
setConfigId
278,592
DefaultActionGroup (List<? extends SettingsEditorFragment<Settings, ?>> fragments, Ref<? super JComponent> lastSelected) { fragments.sort(Comparator.comparingInt(SettingsEditorFragment::getMenuPosition)); DefaultActionGroup actionGroup = new DefaultActionGroup(); String group = null; for (SettingsEditorFragment<Settings, ?> fragment : restoreGroups(fragments)) { if (fragment.isRemovable() && !Objects.equals(group, fragment.getGroup())) { group = fragment.getGroup(); actionGroup.add(new Separator(group)); } ActionGroup customGroup = fragment.getCustomActionGroup(); if (customGroup != null) { actionGroup.add(customGroup); continue; } List<SettingsEditorFragment<Settings, ?>> children = fragment.getChildren(); if (children.isEmpty()) { ToggleFragmentAction action = new ToggleFragmentAction(fragment, lastSelected); ShortcutSet shortcutSet = ActionUtil.getMnemonicAsShortcut(action); if (shortcutSet != null) { action.registerCustomShortcutSet(shortcutSet, null); } actionGroup.add(action); } else { DefaultActionGroup childGroup = buildGroup(children, lastSelected); childGroup.getTemplatePresentation().setText(fragment.getChildrenGroupName()); actionGroup.add(childGroup); } } return actionGroup; }
buildGroup
278,593
DefaultActionGroup (Ref<? super JComponent> lastSelected) { return buildGroup(ContainerUtil.filter(myFragments, fragment -> fragment.getName() != null), lastSelected); }
buildGroup
278,594
void (@NotNull List<? extends SettingsEditorFragment<Settings, ?>> commandLine) { if (!commandLine.isEmpty()) { CommandLinePanel panel = new CommandLinePanel(commandLine, myConfigId, this); addLine(panel, 0, -panel.getLeftInset(), TOP_INSET); } }
addCommandLinePanel
278,595
int (JComponent component) { if (component.getBorder() != null) { return component.getBorder().getBorderInsets(component).left; } JComponent wrapped = (JComponent)ContainerUtil.find(component.getComponents(), co -> co.isVisible()); return wrapped != null ? getLeftInset(wrapped) : 0; }
getLeftInset
278,596
boolean (@NotNull AnActionEvent e) { return myFragment.isSelected(); }
isSelected
278,597
void (@NotNull AnActionEvent e, boolean state) { myFragment.toggle(state, e); if (state) { myLastSelected.set(myFragment.getEditorComponent()); } }
setSelected
278,598
void (@NotNull AnActionEvent e) { super.update(e); e.getPresentation().setVisible(myFragment.isRemovable()); }
update
278,599
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread