Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
279,800
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_SHOW_DIFF_COMMON); }
getDiff
279,801
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_FIND); }
getFind
279,802
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_CONTEXT_HELP); }
getContextHelp
279,803
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_CLOSE); }
getCloseActiveWindow
279,804
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_CARET_UP); }
getMoveUp
279,805
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN); }
getMoveDown
279,806
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_CARET_PAGE_UP); }
getMovePageUp
279,807
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_CARET_PAGE_DOWN); }
getMovePageDown
279,808
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_LINE_START); }
getMoveHome
279,809
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_EDITOR_MOVE_LINE_END); }
getMoveEnd
279,810
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_RECENT_FILES); }
getRecentFiles
279,811
ShortcutSet () { return getActiveKeymapShortcuts(IdeActions.ACTION_DELETE); }
getDelete
279,812
Object () { try { return super.clone(); } catch (CloneNotSupportedException exc) { throw new RuntimeException(exc.getMessage()); } }
clone
279,813
AbbreviationManager () { return ApplicationManager.getApplication().getService(AbbreviationManager.class); }
getInstance
279,814
boolean (@NotNull AnAction action) { return action instanceof PerformWithDocumentsCommitted && ((PerformWithDocumentsCommitted)action).isPerformWithDocumentsCommitted(); }
isPerformWithDocumentsCommitted
279,815
void (Presentation presentation, Function<Icon, Icon> iconTransformer) { PresentationIconUpdater updater = presentation.getClientProperty(UPDATER_KEY); if (updater == null) updater = DEFAULT; updater.performUpdate(presentation, iconTransformer); }
updateIcons
279,816
String () { return myText; }
toString
279,817
void (@NotNull AnActionEvent e) { //do nothing }
actionPerformed
279,818
JComponent (@NotNull Presentation presentation, @NotNull String place) { return myProducer.get(); }
createCustomComponent
279,819
Icon (boolean enabled) { if (myIcon != AllIcons.General.ArrowDown) { myIcon = UIManager.getIcon("ComboBoxButton.arrowIcon"); myDisabledIcon = UIManager.getIcon("ComboBoxButton.arrowIconDisabled"); if (myIcon == null) myIcon = AllIcons.General.ArrowDown; if (myDisabledIcon == null) myDisabledIcon = IconLoader.getDisabledIcon(AllIcons.General.ArrowDown); } return enabled ? myIcon : myDisabledIcon; }
getArrowIcon
279,820
void (@NotNull AnActionEvent e) { Project project = e.getProject(); if (project == null) return; JFrame frame = WindowManager.getInstance().getFrame(project); if (!(frame instanceof IdeFrame)) return; JBPopup popup = createActionPopup(e.getDataContext(), ((IdeFrame)frame).getComponent(), null); popup.showCenteredInCurrentWindow(project); }
actionPerformed
279,821
JBPopup (@NotNull DataContext context, @NotNull JComponent component, @Nullable Runnable disposeCallback) { return createActionPopup(createPopupActionGroup(component, context), context, disposeCallback); }
createActionPopup
279,822
JBPopup (DefaultActionGroup group, @NotNull DataContext context, @Nullable Runnable disposeCallback) { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup( myPopupTitle, group, context, false, shouldShowDisabledActions(), false, disposeCallback, getMaxRows(), getPreselectCondition()); popup.setMinimumSize(new Dimension(getMinWidth(), getMinHeight())); return popup; }
createActionPopup
279,823
JComponent (@NotNull Presentation presentation, @NotNull String place) { ComboBoxButton button = createComboBoxButton(presentation); if (isNoWrapping(place)) return button; JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints( 0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBInsets.create(0, 3), 0, 0); panel.add(button, constraints); return panel; }
createCustomComponent
279,824
boolean (@NotNull String place) { return ExperimentalUI.isNewUI() && ActionPlaces.isMainToolbar(place); }
isNoWrapping
279,825
ComboBoxButton (@NotNull Presentation presentation) { return new ComboBoxButton(presentation); }
createComboBoxButton
279,826
boolean () { return mySmallVariant; }
isSmallVariant
279,827
void (boolean smallVariant) { mySmallVariant = smallVariant; }
setSmallVariant
279,828
void (@NotNull @NlsContexts.PopupTitle String popupTitle) { myPopupTitle = popupTitle; }
setPopupTitle
279,829
boolean () { return false; }
shouldShowDisabledActions
279,830
DefaultActionGroup (JComponent button) { throw new UnsupportedOperationException(); }
createPopupActionGroup
279,831
DefaultActionGroup (@NotNull JComponent button, @NotNull DataContext dataContext) { return createPopupActionGroup(button); }
createPopupActionGroup
279,832
int () { return 30; }
getMaxRows
279,833
int () { return 1; }
getMinHeight
279,834
int () { return 1; }
getMinWidth
279,835
String () { return "ComboBoxButtonUI"; }
getUIClassID
279,836
void (final MouseEvent e) { if (performClickOnMousePress()) { if (SwingUtilities.isLeftMouseButton(e)) { e.consume(); if (e.isShiftDown()) { doShiftClick(); } else { doClick(); } } else if(SwingUtilities.isRightMouseButton(e)){ doRightClick(); } } }
mousePressed
279,837
void (MouseEvent e) { mouseMoved(MouseEventAdapter.convert(e, e.getComponent(), MouseEvent.MOUSE_MOVED, e.getWhen(), UIUtil.getAllModifiers(e), e.getX(), e.getY())); }
mouseDragged
279,838
void () { setMargin(JBUI.insets(0, 8, 0, 5)); }
setMargin
279,839
void (@NotNull JLabel label) { label.setLabelFor(this); ActionMap map = label.getActionMap(); String name = "release"; // BasicLabelUI.Actions.RELEASE Action old = map.get(name); map.put(name, new AbstractAction() { @Override public void actionPerformed(ActionEvent event) { if (old != null) old.actionPerformed(event); doClick(); } }); }
setLabel
279,840
void (ActionEvent event) { if (old != null) old.actionPerformed(event); doClick(); }
actionPerformed
279,841
void (PropertyChangeEvent event) { String propertyName = event.getPropertyName(); if (Presentation.PROP_TEXT.equals(propertyName)) { setText((String)event.getNewValue()); } else if (Presentation.PROP_DESCRIPTION.equals(propertyName)) { myTooltipText = (String)event.getNewValue(); updateTooltipText(); } else if (Presentation.PROP_ICON.equals(propertyName)) { setIcon((Icon)event.getNewValue()); } else if (Presentation.PROP_ENABLED.equals(propertyName)) { setEnabled((Boolean)event.getNewValue()); } }
presentationChanged
279,842
boolean () { return true; }
performClickOnMousePress
279,843
Presentation () { return myPresentation; }
getPresentation
279,844
void (ActionEvent event) { if (!myForcePressed) { IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> showPopup()); } }
fireActionPerformed
279,845
void (boolean forcePressed) { if (myForcePressed == forcePressed) return; myForcePressed = forcePressed; repaint(); }
setForcePressed
279,846
void () { // give the button a chance to handle action listener ApplicationManager.getApplication().invokeLater(() -> setForcePressed(false), ModalityState.any()); repaint(); fireStateChanged(); }
releaseForcePressed
279,847
void () { JBPopup popup = createPopup(this::releaseForcePressed); setForcePressed(true); if (Registry.is("ide.helptooltip.enabled")) { HelpTooltip.setMasterPopup(this, popup); } popup.showUnderneathOf(this); }
showPopup
279,848
JBPopup (@Nullable Runnable onDispose) { return createActionPopup(getDataContext(), this, onDispose); }
createPopup
279,849
DataContext () { return ActionToolbar.getDataContextFor(this); }
getDataContext
279,850
void () { HelpTooltip.dispose(this); super.removeNotify(); }
removeNotify
279,851
void () { super.addNotify(); updateTooltipText(); }
addNotify
279,852
void () { HelpTooltip.dispose(this); if (Registry.is("ide.helptooltip.enabled") && StringUtil.isNotEmpty(myTooltipText)) { String shortcut = KeymapUtil.getFirstKeyboardShortcutText(ComboBoxAction.this); new HelpTooltip().setTitle(myTooltipText).setShortcut(shortcut).installOn(this); } else { String tooltip = KeymapUtil.createTooltipText(myTooltipText, ComboBoxAction.this); setToolTipText(!tooltip.isEmpty() ? tooltip : null); } }
updateTooltipText
279,853
boolean () { return myForcePressed || super.isPressed(); }
isPressed
279,854
boolean () { return myForcePressed || super.isArmed(); }
isArmed
279,855
boolean () { return !isSmallVariant(); }
isOpaque
279,856
Font () { if (myFontSet && ExperimentalUI.isNewUI()) return super.getFont(); return isSmallVariant() ? UIUtil.getToolbarFont() : StartupUiUtil.getLabelFont(); }
getFont
279,857
void (Font font) { super.setFont(font); myFontSet = true; }
setFont
279,858
Graphics (Graphics graphics) { return JBSwingUtilities.runGlobalCGTransform(this, super.getComponentGraphics(graphics)); }
getComponentGraphics
279,859
int () { return 0; }
getArrowGap
279,860
boolean (@NotNull Presentation presentation) { return true; }
isArrowVisible
279,861
boolean () { return myPresentation != null && isArrowVisible(myPresentation); }
isArrowVisible
279,862
boolean () { return ComboBoxAction.this.isSmallVariant(); }
isSmallVariant
279,863
void () { Object uiClassName = UIManager.get(getUIClassID()); setUI(uiClassName == null ? BasicButtonUI.createUI(this) : UIManager.getUI(this)); setMargin(); }
updateUI
279,864
void () { doClick(); }
doShiftClick
279,865
void () {}
doRightClick
279,866
Condition<AnAction> () { return null; }
getPreselectCondition
279,867
JComponent (@NotNull Presentation presentation, @NotNull String place) { JBCheckBox checkBox = new JBCheckBox(); checkBox.setFocusable(false); return createCheckboxComponent(checkBox, this, place); }
createCustomComponent
279,868
void (@NotNull JComponent component, @NotNull Presentation presentation) { if (component instanceof JCheckBox checkBox) { updateCustomComponent(checkBox, presentation); } }
updateCustomComponent
279,869
void (JCheckBox checkBox, Presentation presentation) { updateCheckboxPresentation(checkBox, presentation); checkBox.setSelected(Toggleable.isSelected(presentation)); }
updateCustomComponent
279,870
void (JCheckBox checkBox, Presentation presentation) { checkBox.setText(presentation.getText(true)); checkBox.setToolTipText(presentation.getDescription()); checkBox.setMnemonic(presentation.getMnemonic()); checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex()); checkBox.setEnabled(presentation.isEnabled()); checkBox.setVisible(presentation.isVisible()); }
updateCheckboxPresentation
279,871
JComponent (@NotNull JCheckBox checkBox, @NotNull AnAction action, @NotNull String place) { // this component cannot be stored right in AnAction because of action system architecture: // one action can be shown on multiple toolbars simultaneously checkBox.setOpaque(false); checkBox.setBorder(JBUI.Borders.emptyRight(9)); checkBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox checkBox = (JCheckBox)e.getSource(); DataContext dataContext = ActionToolbar.getDataContextFor(checkBox); InputEvent inputEvent = new KeyEvent(checkBox, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_SPACE, ' '); AnActionEvent event = AnActionEvent.createFromAnAction(action, inputEvent, place, dataContext); ActionUtil.performActionDumbAwareWithCallbacks(action, event); } }); return checkBox; }
createCheckboxComponent
279,872
void (ActionEvent e) { JCheckBox checkBox = (JCheckBox)e.getSource(); DataContext dataContext = ActionToolbar.getDataContextFor(checkBox); InputEvent inputEvent = new KeyEvent(checkBox, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_SPACE, ' '); AnActionEvent event = AnActionEvent.createFromAnAction(action, inputEvent, place, dataContext); ActionUtil.performActionDumbAwareWithCallbacks(action, event); }
actionPerformed
279,873
void (final @NotNull AnActionEvent e) { ThreeStateCheckBox.State state = isSelected(e); Presentation presentation = e.getPresentation(); presentation.putClientProperty(STATE_PROPERTY, state); setSelected(e, ThreeStateCheckBox.nextState(state, true)); }
actionPerformed
279,874
void (final @NotNull AnActionEvent e) { ThreeStateCheckBox.State state = isSelected(e); Presentation presentation = e.getPresentation(); presentation.putClientProperty(STATE_PROPERTY, state); }
update
279,875
JComponent (@NotNull Presentation presentation, @NotNull String place) { // this component cannot be stored right here because of the action system architecture: // one action can be shown on multiple toolbars simultaneously ThreeStateCheckBox checkBox = new ThreeStateCheckBox(); return CheckboxAction.createCheckboxComponent(checkBox, this, place); }
createCustomComponent
279,876
void (@NotNull JComponent component, @NotNull Presentation presentation) { if (component instanceof ThreeStateCheckBox checkBox) { CheckboxAction.updateCheckboxPresentation(checkBox, presentation); ThreeStateCheckBox.State property = presentation.getClientProperty(STATE_PROPERTY); checkBox.setState(ObjectUtils.chooseNotNull(property, ThreeStateCheckBox.State.NOT_SELECTED)); } }
updateCustomComponent
279,877
void (@Nullable Project project, @NotNull AnAction action, AnActionEvent @NotNull ... events) { List<String> actionNames = new ArrayList<>(); for (AnActionEvent event : events) { String s = event.getPresentation().getText(); if (StringUtil.isNotEmpty(s)) { actionNames.add(s); } } if (LOG.isDebugEnabled()) { LOG.debug("Showing dumb mode warning for " + Arrays.asList(events), new Throwable()); } if (project == null) return; DumbService.getInstance(project).showDumbModeNotificationForAction(getActionUnavailableMessage(actionNames), ActionManager.getInstance().getId(action)); }
showDumbModeWarning
279,878
boolean (boolean isInModalContext, @NotNull AnAction action, @NotNull AnActionEvent e, boolean beforeActionPerformed) { return performDumbAwareUpdate(action, e, beforeActionPerformed); }
performDumbAwareUpdate
279,879
boolean (@NotNull AnAction action, @NotNull AnActionEvent e, boolean beforeActionPerformed) { Presentation presentation = e.getPresentation(); if (LightEdit.owns(e.getProject()) && !isActionLightEditCompatible(action)) { presentation.setEnabledAndVisible(false); presentation.putClientProperty(WOULD_BE_ENABLED_IF_NOT_DUMB_MODE, false); presentation.putClientProperty(WOULD_BE_VISIBLE_IF_NOT_DUMB_MODE, false); return false; } Boolean wasEnabledBefore = presentation.getClientProperty(WAS_ENABLED_BEFORE_DUMB); boolean dumbMode = isDumbMode(e.getProject()); if (wasEnabledBefore != null && !dumbMode) { presentation.putClientProperty(WAS_ENABLED_BEFORE_DUMB, null); presentation.setEnabled(wasEnabledBefore.booleanValue()); presentation.setVisible(true); } boolean enabledBeforeUpdate = presentation.isEnabled(); boolean allowed = !dumbMode || action.isDumbAware(); action.applyTextOverride(e); try { if (beforeActionPerformed && e.getUpdateSession() == UpdateSession.EMPTY) { IdeUiService.getInstance().initUpdateSession(e); } Runnable runnable = () -> { // init group flags from deprecated methods boolean isGroup = action instanceof ActionGroup; boolean wasPopup = isGroup && ((ActionGroup)action).isPopup(); boolean wasHideIfEmpty = isGroup && ((ActionGroup)action).hideIfNoVisibleChildren(); boolean wasDisableIfEmpty = isGroup && ((ActionGroup)action).disableIfNoVisibleChildren(); presentation.setPopupGroup(isGroup && (presentation.isPopupGroup() || wasPopup)); e.setInjectedContext(action.isInInjectedContext()); if (beforeActionPerformed) { action.beforeActionPerformedUpdate(e); } else { action.update(e); } if (!e.getPresentation().isEnabled() && e.isInInjectedContext()) { e.setInjectedContext(false); if (beforeActionPerformed) { action.beforeActionPerformedUpdate(e); } else { action.update(e); } } //to be removed when ActionGroup#canBePerformed is dropped e.getPresentation().setPerformGroup( isGroup && e.getPresentation().isPopupGroup() && (e.getPresentation().isPerformGroup() || ((ActionGroup)action).canBePerformed(e.getDataContext()))); if (isGroup) { assertDeprecatedActionGroupFlagsNotChanged((ActionGroup)action, e, wasPopup, wasHideIfEmpty, wasDisableIfEmpty); } }; boolean isLikeUpdate = !beforeActionPerformed; try (AccessToken ignore = SlowOperations.startSection(isLikeUpdate ? SlowOperations.ACTION_UPDATE : SlowOperations.ACTION_PERFORM)) { long startTime = System.nanoTime(); runnable.run(); long duration = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime); ActionsCollector.getInstance().recordUpdate(action, e, duration); } presentation.putClientProperty(WOULD_BE_ENABLED_IF_NOT_DUMB_MODE, !allowed && presentation.isEnabled()); presentation.putClientProperty(WOULD_BE_VISIBLE_IF_NOT_DUMB_MODE, !allowed && presentation.isVisible()); } catch (IndexNotReadyException e1) { if (!allowed) { return true; } throw e1; } finally { if (!allowed) { if (wasEnabledBefore == null) { presentation.putClientProperty(WAS_ENABLED_BEFORE_DUMB, enabledBeforeUpdate); } presentation.setEnabled(false); } } return false; }
performDumbAwareUpdate
279,880
boolean (@NotNull AnAction action) { if (action instanceof AnActionWrapper wrapper) return isActionLightEditCompatible(wrapper.getDelegate()); return (action instanceof ActionGroup) && action.isDumbAware() || action instanceof LightEditCompatible; }
isActionLightEditCompatible
279,881
void (@NotNull ActionGroup group, @NotNull AnActionEvent event, boolean wasPopup, boolean wasHideIfEmpty, boolean wasDisableIfEmpty) { boolean warnPopup = wasPopup != group.isPopup(); boolean warnHide = wasHideIfEmpty != group.hideIfNoVisibleChildren(); boolean warnDisable = wasDisableIfEmpty != group.disableIfNoVisibleChildren(); if (!(warnPopup || warnHide || warnDisable)) return; String operationName = group.getClass().getSimpleName() + "#update (" + group.getClass().getName() + ")"; if (warnPopup) { event.getPresentation().setPopupGroup(!wasPopup); // keep the old logic for a while String message = "Calling `setPopup()` in " + operationName + ". " + "Please use `event.getPresentation().setPopupGroup()` instead."; LOG.error(PluginException.createByClass(message, null, group.getClass())); } if (warnHide) { event.getPresentation().setHideGroupIfEmpty(!wasHideIfEmpty); // keep the old logic for a while String message = "Changing `hideIfNoVisibleChildren()` result in " + operationName + ". " + "Please use `event.getPresentation().setHideGroupIfEmpty()` instead."; LOG.error(PluginException.createByClass(message, null, group.getClass())); } if (warnHide) { event.getPresentation().setDisableGroupIfEmpty(!wasDisableIfEmpty); // keep the old logic for a while String message = "Changing `disableIfNoVisibleChildren()` result in " + operationName + ". " + "Please use `event.getPresentation().setHideGroupIfEmpty()` instead."; LOG.error(PluginException.createByClass(message, null, group.getClass())); } }
assertDeprecatedActionGroupFlagsNotChanged
279,882
boolean (@Nullable Project project) { if (project != null) { return DumbService.getInstance(project).isDumb(); } for (Project openProject : ProjectManager.getInstance().getOpenProjects()) { if (DumbService.getInstance(openProject).isDumb()) { return true; } } return false; }
isDumbMode
279,883
boolean (@NotNull AnAction action, @NotNull AnActionEvent e, boolean visibilityMatters) { Project project = e.getProject(); if (project != null && PerformWithDocumentsCommitted.isPerformWithDocumentsCommitted(action)) { try (AccessToken ignore = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { PsiDocumentManager.getInstance(project).commitAllDocuments(); } } performDumbAwareUpdate(action, e, true); if (project != null && DumbService.getInstance(project).isDumb() && !action.isDumbAware()) { if (Boolean.FALSE.equals(e.getPresentation().getClientProperty(WOULD_BE_ENABLED_IF_NOT_DUMB_MODE))) { return false; } if (visibilityMatters && Boolean.FALSE.equals(e.getPresentation().getClientProperty(WOULD_BE_VISIBLE_IF_NOT_DUMB_MODE))) { return false; } showDumbModeWarning(project, action, e); return false; } if (!e.getPresentation().isEnabled()) { return false; } return !visibilityMatters || e.getPresentation().isVisible(); }
lastUpdateAndCheckDumb
279,884
void (@NotNull AnAction action, @NotNull AnActionEvent e, @NotNull DataContext context) { LOG.assertTrue(e.getDataContext() == context, "event context does not match the argument"); performActionDumbAwareWithCallbacks(action, e); }
performActionDumbAwareWithCallbacks
279,885
void (@NotNull AnAction action, @NotNull AnActionEvent e) { performDumbAwareWithCallbacks(action, e, () -> doPerformActionOrShowPopup(action, e, null)); }
performActionDumbAwareWithCallbacks
279,886
void (@NotNull AnAction action, @NotNull AnActionEvent e, @Nullable Consumer<? super JBPopup> popupShow) { if (action instanceof ActionGroup group && !e.getPresentation().isPerformGroup()) { DataContext dataContext = e.getDataContext(); String place = ActionPlaces.getActionGroupPopupPlace(e.getPlace()); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup( e.getPresentation().getText(), group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, null, -1, null, place); var toolbarPopupLocation = CommonActionsPanel.getPreferredPopupPoint(action, dataContext.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT)); if (toolbarPopupLocation != null) { popup.show(toolbarPopupLocation); } else if (popupShow != null) { popupShow.accept(popup); } else { popup.showInBestPositionFor(dataContext); } } else { action.actionPerformed(e); } }
doPerformActionOrShowPopup
279,887
void (@NotNull InputEvent inputEvent, @NotNull Runnable runnable) { String place = inputEvent instanceof KeyEvent ? ActionPlaces.KEYBOARD_SHORTCUT : inputEvent instanceof MouseEvent ? ActionPlaces.MOUSE_SHORTCUT : ActionPlaces.UNKNOWN; AnActionEvent event = AnActionEvent.createFromInputEvent( inputEvent, place, InputEventDummyAction.INSTANCE.getTemplatePresentation().clone(), DataManager.getInstance().getDataContext(Objects.requireNonNull(inputEvent.getComponent()))); performDumbAwareWithCallbacks(InputEventDummyAction.INSTANCE, event, runnable); }
performInputEventHandlerWithCallbacks
279,888
void (@NotNull AnAction action, @NotNull AnActionEvent event, @NotNull Runnable performRunnable) { Project project = event.getProject(); IndexNotReadyException indexError = null; ActionManagerEx manager = ActionManagerEx.getInstanceEx(); manager.fireBeforeActionPerformed(action, event); Component component = event.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); String actionId = StringUtil.notNullize( event.getActionManager().getId(action), action == InputEventDummyAction.INSTANCE ? performRunnable.getClass().getName() : action.getClass().getName()); if (component != null && !UIUtil.isShowing(component) && !ActionPlaces.TOUCHBAR_GENERAL.equals(event.getPlace()) && !Boolean.TRUE.equals(ClientProperty.get(component, ALLOW_ACTION_PERFORM_WHEN_HIDDEN))) { LOG.warn("Action is not performed because target component is not showing: " + "action=" + actionId + ", component=" + component.getClass().getName()); manager.fireAfterActionPerformed(action, event, AnActionResult.IGNORED); return; } AnActionResult result = null; try (AccessToken ignore = SlowOperations.startSection(SlowOperations.ACTION_PERFORM); AccessToken ignore2 = withActionThreadContext(actionId, event.getPlace(), event.getInputEvent(), component)) { performRunnable.run(); result = AnActionResult.PERFORMED; } catch (IndexNotReadyException ex) { indexError = ex; result = AnActionResult.failed(ex); } catch (RuntimeException | Error ex) { result = AnActionResult.failed(ex); throw ex; } finally { if (result == null) result = AnActionResult.failed(new Throwable()); manager.fireAfterActionPerformed(action, event, result); } if (indexError != null) { LOG.info(indexError); showDumbModeWarning(project, action, event); } }
performDumbAwareWithCallbacks
279,889
void (@NotNull AnAction action, @NotNull AnActionEvent event) { Project project = event.getProject(); try { doPerformActionOrShowPopup(action, event, null); } catch (IndexNotReadyException ex) { LOG.info(ex); showDumbModeWarning(project, action, event); } }
performActionDumbAware
279,890
AnActionEvent () { return AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, DataContext.EMPTY_CONTEXT); }
createEmptyEvent
279,891
void (@NotNull List<AnAction> list, @NotNull String actionText, @NotNull String targetActionText, boolean before) { if (Objects.equals(actionText, targetActionText)) { return; } int actionIndex = -1; int targetIndex = -1; for (int i = 0; i < list.size(); i++) { AnAction action = list.get(i); if (actionIndex == -1 && Objects.equals(actionText, action.getTemplateText())) actionIndex = i; if (targetIndex == -1 && Objects.equals(targetActionText, action.getTemplateText())) targetIndex = i; if (actionIndex != -1 && targetIndex != -1) { if (actionIndex < targetIndex) targetIndex--; AnAction anAction = list.remove(actionIndex); list.add(before ? targetIndex : targetIndex + 1, anAction); return; } } }
moveActionTo
279,892
List<AnAction> (@NotNull JComponent component) { return ContainerUtil.notNullize(ClientProperty.get(component, AnAction.ACTIONS_KEY)); }
getActions
279,893
void (@NotNull JComponent component) { ClientProperty.put(component, AnAction.ACTIONS_KEY, null); }
clearActions
279,894
void (@NotNull JComponent to, @NotNull JComponent from) { for (AnAction anAction : getActions(from)) { anAction.registerCustomShortcutSet(anAction.getShortcutSet(), to); } }
copyRegisteredShortcuts
279,895
void (@NotNull JComponent component, @NotNull ActionListener action, @NotNull ShortcutSet shortcuts) { for (Shortcut shortcut : shortcuts.getShortcuts()) { if (shortcut instanceof KeyboardShortcut ks) { KeyStroke first = ks.getFirstKeyStroke(); KeyStroke second = ks.getSecondKeyStroke(); if (second == null) { component.registerKeyboardAction(action, first, JComponent.WHEN_IN_FOCUSED_WINDOW); } } } }
registerForEveryKeyboardShortcut
279,896
boolean (@NotNull ActionGroup group, @NotNull AnAction action) { return anyActionFromGroupMatches(group, true, Predicate.isEqual(action)); }
recursiveContainsAction
279,897
boolean (@NotNull ActionGroup group, boolean processPopupSubGroups, @NotNull Predicate<? super AnAction> condition) { for (AnAction child : group.getChildren(null)) { if (condition.test(child)) return true; if (child instanceof ActionGroup childGroup) { if ((processPopupSubGroups || !childGroup.isPopup()) && anyActionFromGroupMatches(childGroup, processPopupSubGroups, condition)) { return true; } } } return false; }
anyActionFromGroupMatches
279,898
AnAction (@NotNull AnAction action, @NotNull @NonNls String actionId) { AnAction from = ActionManager.getInstance().getAction(actionId); if (from != null) { action.copyFrom(from); } ActionsCollector.getInstance().onActionConfiguredByActionId(action, actionId); return action; }
copyFrom
279,899
AnAction (@NotNull AnAction action, @NotNull String actionId) { //noinspection UnnecessaryLocalVariable AnAction a1 = action; AnAction a2 = ActionManager.getInstance().getAction(actionId); Presentation p1 = a1.getTemplatePresentation(); Presentation p2 = a2.getTemplatePresentation(); p1.setIcon(ObjectUtils.chooseNotNull(p1.getIcon(), p2.getIcon())); p1.setDisabledIcon(ObjectUtils.chooseNotNull(p1.getDisabledIcon(), p2.getDisabledIcon())); p1.setSelectedIcon(ObjectUtils.chooseNotNull(p1.getSelectedIcon(), p2.getSelectedIcon())); p1.setHoveredIcon(ObjectUtils.chooseNotNull(p1.getHoveredIcon(), p2.getHoveredIcon())); if (StringUtil.isEmpty(p1.getText())) { p1.setTextWithMnemonic(p2.getTextWithPossibleMnemonic()); } p1.setDescription(ObjectUtils.chooseNotNull(p1.getDescription(), p2.getDescription())); ShortcutSet ss1 = a1.getShortcutSet(); if (ss1 == CustomShortcutSet.EMPTY) { a1.copyShortcutFrom(a2); } ActionsCollector.getInstance().onActionConfiguredByActionId(action, actionId); return a1; }
mergeFrom