Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
246,000
void () { if (ourConnection != null) { ourConnection.disconnect(); } ourConnection = null; // NOTE: all registered project actions will 'unregister' in manager.clearAll // no necessity to do it here }
disable
246,001
void (@NotNull Project project) { if (project.isDisposed()) { return; } final JFrame frame = WindowManager.getInstance().getFrame(project); if (frame == null) { LOG.debug("null frame for project: %s", project); return; } final @Nullable Pair<Map<Long, ActionGroup>, Customizer> defaultGroup = ActionsLoader.getProjectDef...
registerTouchbarActionsImpl
246,002
void (@NotNull Project project) { StartupManager.getInstance(project).runAfterOpened(() -> { if (project.isDisposed()) { return; } LOG.debug("register touchbar actions for project %s", project); registerTouchbarActionsImpl(project); }); }
registerTouchbarActions
246,003
void () { for (Project project : ProjectUtil.getOpenProjects()) { registerTouchbarActionsImpl(project); } }
reloadAllActions
246,004
void () { final ActionManager actionManager = ApplicationManager.getApplication().getServiceIfCreated(ActionManager.class); if (actionManager == null) { LOG.debug("service ActionManager wasn't cerated, schedule next try after 500ms"); SimpleTimer.getInstance().setUp(() -> fillRunDebugGroup(), 500); return; } AnAction r...
fillRunDebugGroup
246,005
void () { if (ourEditors != null) return; ourEditors = new WeakHashMap<>(); ourEditorSearchActions = ActionsLoader.getActionGroup("EditorSearch"); if (ourEditorSearchActions == null) { Logger.getInstance(CtxEditors.class).debug("null action group for editor-search"); return; } EditorFactory.getInstance().addEditorFacto...
initialize
246,006
void (@NotNull EditorFactoryEvent event) { final WeakReference<Component> cmpRef = ourEditors.remove(event.getEditor()); final Component cmp = cmpRef != null ? cmpRef.get() : null; if (cmp != null) { TouchBarsManager.unregister(cmp); } }
editorReleased
246,007
void (@NotNull Editor editor) { initialize(); if (ourEditorSearchActions == null) { return; } // register editor final @Nullable Component newCmp = editor.getHeaderComponent(); final @Nullable WeakReference<Component> oldCmpRef = ourEditors.put(editor, new WeakReference<>(newCmp)); final @Nullable Component oldCmp = ol...
onUpdateEditorHeader
246,008
int (byte prio) { return (prio + 128) << BUTTON_PRIORITY_SHIFT; }
priority2mask
246,009
int (byte margin) { return ((int)margin & 0xFF) << LAYOUT_MARGIN_SHIFT; }
margin2mask
246,010
int (byte border) { return ((int)border & 0xFF) << LAYOUT_BORDER_SHIFT; }
border2mask
246,011
void () { if (isInitialized) { return; } synchronized (TouchbarSupport.class) { if (isInitialized) { return; } try { if (GraphicsEnvironment.isHeadless()) { LOG.info("touchbar disabled: the graphics environment is headless"); } else if (!Registry.is(IS_ENABLED_KEY, true)) { LOG.info("touchbar disabled: registry"); } el...
initialize
246,012
void () { isEnabled = true; // initialize keyboard listener Toolkit.getDefaultToolkit().addAWTEventListener(ourAWTEventListener, ourEventMask); // initialize default and tool-window contexts CtxDefault.initialize(); CtxToolWindows.initialize(); // listen plugins ourConnection = ApplicationManager.getApplication().getMe...
enableSupport
246,013
void (@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) { reloadAllActions(); }
pluginUnloaded
246,014
void (boolean enable) { if (!isInitialized || !isAvailable()) { return; } if (!enable) { if (isEnabled) { Toolkit.getDefaultToolkit().removeAWTEventListener(ourAWTEventListener); TouchBarsManager.clearAll(); CtxDefault.disable(); CtxToolWindows.disable(); if (ourConnection != null) { ourConnection.disconnect(); } ourCo...
enable
246,015
void () { initialize(); }
onApplicationLoaded
246,016
boolean () { return SystemInfoRt.isMac && NST.isAvailable(); }
isAvailable
246,017
boolean () { return isAvailable() && isEnabled && Registry.is(IS_ENABLED_KEY); }
isEnabled
246,018
void (@NotNull Editor editor) { if (!isInitialized || !isEnabled()) { return; } CtxEditors.onUpdateEditorHeader(editor); }
onUpdateEditorHeader
246,019
void (@NotNull JBPopup popup, @NotNull JComponent popupComponent) { if (!isInitialized || !isEnabled()) { return; } final Disposable tb = CtxPopup.showPopupItems(popup, popupComponent); if (tb != null) { Disposer.register(popup, tb); } }
showPopupItems
246,020
void (@NotNull Disposable parent, @NotNull Component contentPane) { Disposable tb = showWindowActions(contentPane); if (tb != null) { Disposer.register(parent, tb); } }
showWindowActions
246,021
void () { if (!isInitialized || !isEnabled()) { return; } CtxDefault.reloadAllActions(); CtxToolWindows.reloadAllActions(); }
reloadAllActions
246,022
void (@NotNull ActionGroupInfo actionGroupInfo) { @NotNull ActionGroup actionGroup = actionGroupInfo.group; AnAction[] actions = actionGroup.getChildren(null); for (AnAction childAction : actions) { if (childAction == null) { continue; } if (childAction instanceof ActionGroup) { fillAct2Parent(new ActionGroupInfo((Acti...
fillAct2Parent
246,023
String[] (@NotNull String toolWindowId) { if (toolWindowId.isEmpty()) { return null; } // TODO: read setting from proper place (think where) final String propVal = System.getProperty(SETTINS_AUTOCLOSE_KEY + '.' + toolWindowId); if (propVal == null || propVal.isEmpty()) { return getAutoCloseActionsDefault(toolWindowId);...
getAutoCloseActions
246,024
long (@NotNull String modifierId) { if (!modifierId.contains(".")) { if (modifierId.equalsIgnoreCase("alt")) { return InputEvent.ALT_DOWN_MASK; } if (modifierId.equalsIgnoreCase("cmd")) { return InputEvent.META_DOWN_MASK; } if (modifierId.equalsIgnoreCase("ctrl")) { return InputEvent.CTRL_DOWN_MASK; } if (modifierId.eq...
_str2mask
246,025
String[] (@NotNull String toolWindowId) { if ( toolWindowId.equals(ToolWindowId.DEBUG) || toolWindowId.equals(ToolWindowId.RUN) || toolWindowId.equals(ToolWindowId.SERVICES) ) { return new String[]{ "Stop" }; } return null; }
getAutoCloseActionsDefault
246,026
List<ItemData> () { return myItems; }
getItems
246,027
ID () { myNativeItemsCount = myItems.isEmpty() ? 0 : Math.min(30, myItems.size()); final ID result = NST.createScrubber(getUid(), myWidth, this, myUpdater, myItems, myNativeItemsCount, myStats); NST.enableScrubberItems(result, _getDisabledIndices(), false); if (myNativeItemsCount > 0 && result != ID.NIL) { final @NotNu...
_createNativePeer
246,028
void (int itemIndex) { if (myItems.isEmpty() || itemIndex < 0 || itemIndex >= myItems.size()) return; final ItemData id = myItems.get(itemIndex); if (id != null && id.myAction != null) id.myAction.run(); }
execute
246,029
List<Integer> () { final List<Integer> disabled = new ArrayList<>(); for (int c = 0; c < myItems.size(); ++c) { if (!myItems.get(c).myEnabled) disabled.add(c); } return disabled; }
_getDisabledIndices
246,030
ID () { if (myGroupItems.isEmpty()) return ID.NIL; final ID[] ids = myGroupItems.getNativePeers(); return NST.createGroupItem(getUid(), ids); }
_createNativePeer
246,031
Disposable (@NotNull Component contentPane) { DefaultActionGroup actions = new DefaultActionGroup(); // // Collect touchbar actions from component hierarchy. // List<AnAction> actionList = findAllTouchbarActions(contentPane); if (actionList != null) { actions.addAll(actionList); } if (LOG.isDebugEnabled()) { if (action...
showWindowActions
246,032
boolean (@NotNull ActionGroup group) { for (AnAction child : group.getChildren(null)) { TouchbarActionCustomizations customizations = TouchbarActionCustomizations.getCustomizations(child); if (customizations == null || !customizations.isCrossEsc()) { return false; } } return true; }
isCrossEscGroup
246,033
void (InputEvent e) { final int usedKeyMask = InputEvent.ALT_DOWN_MASK | InputEvent.META_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK | InputEvent.ALT_GRAPH_DOWN_MASK; final int oldLastModifiersEx = lastModifiersEx; lastModifiersEx = e.getModifiersEx() & usedKeyMask; final boolean areModifiersChan...
processInputEvent
246,034
void (AWTEvent e) { if (!(e.getSource() instanceof Component src)) { return; } // NOTE: WindowEvent.WINDOW_GAINED_FOCUS can be fired when frame focused if (e.getID() == FocusEvent.FOCUS_GAINED) { // find current (showing) component/touchbar corresponding to event window final Window windowOfEvent = getWindow(src); fina...
processFocusEvent
246,035
int () { return lastModifiersEx; }
getLastModifiersEx
246,036
void (@NotNull ComponentActions componentActions) { componentActions.setCurrent(lastModifiersEx); getWindowStack(getWindow(componentActions.component.get())).push(componentActions); }
showTouchbar
246,037
Stack (@Nullable Window window) { Stack stack = ourStacks.get(window); if (stack == null) { stack = new Stack(window); ourStacks.put(window, stack); if (window != null) { window.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { ourStacks.remove(window); } }); } } return stack; ...
getWindowStack
246,038
void (WindowEvent e) { ourStacks.remove(window); }
windowClosed
246,039
void (WindowEvent e) { final @Nullable ComponentActions ca = getTopActions(); if (ca != null && ca.getCurrent() instanceof TBPanelActionGroup) { ((TBPanelActionGroup)ca.getCurrent()).startUpdateTimer(); } }
windowActivated
246,040
void (WindowEvent e) { final @Nullable ComponentActions ca = getTopActions(); if (ca != null && ca.getCurrent() instanceof TBPanelActionGroup) { ((TBPanelActionGroup)ca.getCurrent()).stopUpdateTimer(); } }
windowDeactivated
246,041
void () { // cancel prev task if (myNativeUpdateTask != null) { myNativeUpdateTask.cancel(); } // ensure that top of stack has current touchbar final @Nullable ComponentActions ca = myStack.peek(); if (ca == null) { // stack is empty myLastShownTouchbar = null; NST.setTouchBar(myWindow != null ? myWindow.get() : null, ...
_scheduleUpdateNative
246,042
TouchBarStats (@NotNull String touchbarName) { return ourStats.computeIfAbsent(touchbarName, s -> new TouchBarStats(touchbarName)); }
getStats
246,043
void (@NotNull PrintStream out) { for (TouchBarStats tbs: ourStats.values()) { tbs.print(out); } }
printAll
246,044
AnActionStats (@NotNull String actionId) { return actionStats.computeIfAbsent(actionId, s -> new AnActionStats(s)); }
getActionStats
246,045
AnActionStats (@NotNull AnAction action) { final String actId = Helpers.getActionId(action); return actionStats.computeIfAbsent(actId, s -> new AnActionStats(s)); }
getActionStats
246,046
void (@NotNull PrintStream out, @NotNull String name, long val) { if (val == 0) // skip non-informative counters return; if (name.endsWith("DurationNs") || name.endsWith("Ns")) { if (val < 1000) // skip non-informative counters return; name = name.replace("Ns", "Ms"); val /= 1000000L; } out.printf("\t%s=%d\n", name, va...
printSignificantValue
246,047
void (@NotNull List<? extends AnAction> actions) { // // clear all items // softClear(); // // fill items with actions // List<AnAction> principal = null; TBItemGroup principalGroup = null; if (myCustomizer != null) { myCustomizer.prepare(myActionGroup); // collect actions from principal group (NSTouchbarGroupItem must...
_rebuildButtons
246,048
AnAction (@NotNull List<AnAction> actions) { if (IS_AUTOCLOSE_DISABLED || myAutoCloseActions == null || myAutoCloseActions.isEmpty() || actions.isEmpty() ) { return null; } for (AnAction autocloseAction: myAutoCloseActions) { // 1. if some of autoclose actions doesn't exist in actions then we must close this touchbar i...
_checkAutoClose
246,049
void (List<AnAction> actions) { final long startNs = System.nanoTime(); if (actions == null) { return; } final AnAction autoCloseReason = _checkAutoClose(actions); if (autoCloseReason != null) { LOG.debug("touchbar '%s' was auto-closed because of: %s | %s", myName, autoCloseReason.getTemplateText(), autoCloseReason); _...
_applyPresentationChanges
246,050
TBItemAnActionButton (@NotNull AnAction action) { TBItemAnActionButton cached = myActionButtonPool.remove(action); if (cached != null) { cached.setAnAction(action); return cached; } // try find action with the same template-text for(Iterator<Map.Entry<AnAction, TBItemAnActionButton>> it = myActionButtonPool.entrySet()....
createActionButton
246,051
ModalityState () { return ModalityState.current(); }
getModalityState
246,052
void () { updateActionItems(); }
run
246,053
void (@NotNull ActionGroup actionGroup, @NotNull Collection<AnAction> autoCloseActions) { Collection<AnAction> actionsFromGroup = new HashSet<>(); Helpers.collectLeafActions(actionGroup, actionsFromGroup); if (!actionsFromGroup.containsAll(autoCloseActions)) { autoCloseActions.removeIf(a -> !actionsFromGroup.contains(a...
validateAutoCloseActions
246,054
void () { for (Project project : ProjectUtilCore.getOpenProjects()) { subscribeToolWindowTopic(project); } ourConnection = ApplicationManager.getApplication().getMessageBus().connect(); ourConnection.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() { @Override public void projectOpened(@NotNull Project proj...
initialize
246,055
void (@NotNull Project project) { subscribeToolWindowTopic(project); }
projectOpened
246,056
void (@NotNull Project project) { forEachToolWindow(project, tw -> { if (tw != null) TouchBarsManager.unregister(tw.getComponent()); }); }
projectClosed
246,057
void (@NotNull Project project, Consumer<? super ToolWindow> func) { ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project); for (ToolWindow window : toolWindowManager.getToolWindows()) { func.accept(window); } }
forEachToolWindow
246,058
void (@NotNull Project project) { if (project.isDisposed()) { return; } LOG.debug("subscribe for ToolWindow topic of project %s", project); MessageBusConnection pbc = project.getMessageBus().connect(); pbc.subscribe(ToolWindowManagerListener.TOPIC, new ToolWindowManagerListener() { @Override public void toolWindowsRegi...
subscribeToolWindowTopic
246,059
void (@NotNull List<String> ids, @NotNull ToolWindowManager toolWindowManager) { for (String id : ids) { final @Nullable Pair<Map<Long, ActionGroup>, Customizer> actions = ActionsLoader.getToolWindowActionGroup(id); if (actions == null || actions.first.get(0L) == null) { LOG.debug("null action group (or it doesn't cont...
toolWindowsRegistered
246,060
void (@NotNull String id, @NotNull ToolWindow toolWindow) { TouchBarsManager.unregister(toolWindow.getComponent()); }
toolWindowUnregistered
246,061
void () { for (Project p : ProjectUtilCore.getOpenProjects()) { if (p.isDisposed()) { continue; } forEachToolWindow(p, tw -> { if (tw == null) return; final @Nullable Pair<Map<Long, ActionGroup>, Customizer> actions = ActionsLoader.getToolWindowActionGroup(tw.getId()); if (actions == null || actions.first.get(0L) == nu...
reloadAllActions
246,062
void (int javaKeyEventCode) { EventQueue systemEventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); systemEventQueue.postEvent( new KeyEvent(new JPanel(), KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, javaKeyEventCode, KeyEvent.CHAR_UNDEFINED) ); systemEventQueue.postEvent( new KeyEvent(new JPanel(), ...
emulateKeyPress
246,063
boolean () { final GeneralCommandLine cmdLine = new GeneralCommandLine("pgrep", TB_SERVER_PROCESS) .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.SYSTEM); try { final ProcessOutput out = ExecUtil.execAndGetOutput(cmdLine); return !out.getStdout().isEmpty(); } catch (ExecutionException e) { LOG.debu...
isTouchBarServerRunning
246,064
boolean () { try { final GeneralCommandLine cmdLine = new GeneralCommandLine("pkill", TB_SERVER_PROCESS) .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.SYSTEM); final ProcessOutput out = ExecUtil.sudoAndGetOutput(cmdLine, ""); return out.getStderr().isEmpty(); } catch (ExecutionException | IOExcept...
restartTouchBarServer
246,065
String () { if (ApplicationManager.getApplication().isUnitTestMode()) { return null; } String appId; final ID nativePool = Foundation.invoke("NSAutoreleasePool", "new"); try { final ID bundle = Foundation.invoke("NSBundle", "mainBundle"); final ID dict = Foundation.invoke(bundle, "infoDictionary"); final ID nsAppID = F...
getAppId
246,066
boolean () { if (FORCE_PHYSICAL_ESC) { return true; } if (ourIsPhysicalEsc != null) { return ourIsPhysicalEsc; } if (ourIsPhysicalEscFuture != null) { if (!ourIsPhysicalEscFuture.isDone()) { return false; } ourIsPhysicalEscFuture = null; return ourIsPhysicalEsc; } // system_profiler SPHardwareDataType // // output exam...
isPhisycalEsc
246,067
String (@NotNull AnAction action) { String actionId = ActionManager.getInstance().getId(action instanceof CustomisedActionGroup ? ((CustomisedActionGroup)action).getOrigin() : action); return actionId == null ? action.toString() : actionId; }
getActionId
246,068
void (@NotNull ActionGroup actionGroup, @NotNull Collection<? super AnAction> out) { AnAction[] actions = actionGroup.getChildren(null); for (AnAction childAction : actions) { if (childAction == null) { continue; } if (childAction instanceof ActionGroup childGroup) { collectLeafActions(childGroup, out); continue; } if ...
collectLeafActions
246,069
String () { return String.format("%s [%s]", ActionManager.getInstance().getId(myAnAction), getUid()); }
toString
246,070
AnAction () { return myAnAction; }
getAnAction
246,071
void () { final ActionManagerEx actionManagerEx = ActionManagerEx.getInstanceEx(); final Component src = myComponent != null ? myComponent : Helpers.getCurrentFocusComponent(); if (src == null) // KeyEvent can't have null source object { return; } final InputEvent ie = new KeyEvent(src, COMPONENT_FIRST, System.currentT...
_performAction
246,072
TBItemButton (int nstLibFlag, boolean val) { final int flags = _applyFlag(myFlags, val, nstLibFlag); if (flags != myFlags) { myFlags = flags; updateOptions |= NSTLibrary.BUTTON_UPDATE_FLAGS; } return this; }
_setFlag
246,073
void () { if (TEST_DELAY_MS <= 0) { return; } ProgressIndicator progress = Objects.requireNonNull(ProgressIndicatorProvider.getGlobalProgressIndicator()); long start = System.currentTimeMillis(); while (true) { progress.checkCanceled(); if (System.currentTimeMillis() - start > TEST_DELAY_MS) { break; } TimeoutUtil.slee...
waitTheTestDelay
246,074
ID () { if (originIcon != null && rasterPromise == null) { updateLater(true); } final ID result = NST.createButton( getUid(), myLayoutBits, _validateFlags(), myText, myHint, myIsHintDisabled ? 1 : 0, rasterPromise == null || !rasterPromise.isSucceeded() ? null : rasterPromise.get(), nativeCallback); if (myHasArrowIcon)...
_createNativePeer
246,075
int () { int flags = myFlags; if ((flags & NSTLibrary.BUTTON_FLAG_COLORED) != 0 && (flags & NSTLibrary.BUTTON_FLAG_DISABLED) != 0) { return flags & ~NSTLibrary.BUTTON_FLAG_COLORED; } return flags; }
_validateFlags
246,076
int (int src, boolean include, int flag) { return include ? (src | flag) : (src & ~flag); }
_applyFlag
246,077
void (PropertyChangeEvent event) { Object oldValue = event.getOldValue(); if (oldValue instanceof TreeModel) ((TreeModel)oldValue).removeTreeModelListener(myTreeModelListener); Object newValue = event.getNewValue(); if (newValue instanceof TreeModel) ((TreeModel)newValue).addTreeModelListener(myTreeModelListener); }
propertyChange
246,078
void () { myTree.removePropertyChangeListener(JTree.TREE_MODEL_PROPERTY, myPropertyChangeListener); TreeModel model = myTree.getModel(); if (model != null) model.removeTreeModelListener(myTreeModelListener); super.dispose(); }
dispose
246,079
void (Painter painter, int index) { TreeUtil.selectRow(myTree, index); }
onSelect
246,080
void (Painter painter) { update(painter, myTree); }
update
246,081
void (Painter painter, JTree tree) { int count = tree.getRowCount(); painter.setErrorStripeCount(count); for (int index = 0; index < count; index++) { TreePath path = tree.getPathForRow(index); update(painter, index, path == null ? null : path.getLastPathComponent()); } }
update
246,082
boolean () { return myGroupSwap; }
isGroupSwap
246,083
int () { return myGroupGap != null ? myGroupGap : getMinimalThickness(); }
getGroupGap
246,084
void (int gap) { myGroupGap = gap; }
setGroupGap
246,085
void (int thickness) { super.setMaximalThickness(thickness); myPainter.setMaximalThickness(getMaximalThickness()); }
setMaximalThickness
246,086
void (int thickness) { super.setMinimalThickness(thickness); myPainter.setMinimalThickness(getMinimalThickness() + getErrorStripeGap()); }
setMinimalThickness
246,087
void (int gap) { super.setErrorStripeGap(gap); myPainter.setMinimalThickness(getMinimalThickness() + getErrorStripeGap()); }
setErrorStripeGap
246,088
void (int count) { super.setErrorStripeCount(count); myPainter.setErrorStripeCount(count); }
setErrorStripeCount
246,089
void (int index, ErrorStripe stripe) { myPainter.setErrorStripe(index, stripe); }
setExtraStripe
246,090
void (@NotNull Graphics2D g, int x, int y, int width, int height, Object object) { int min = getMinimalThickness(); int gap = myGroupGap == null ? min : myGroupGap; int pos = x; if (myGroupSwap) { pos += width - min; } else { x += gap + min; } myPainter.paint(g, pos, y, min, height, object); super.paint(g, x, y, width ...
paint
246,091
ErrorStripe (Color color, int layer) { return color == null ? null : new ErrorStripe(color, layer); }
create
246,092
Color () { return myColor; }
getColor
246,093
int () { return myLayer; }
getLayer
246,094
int () { return myLayer + myColor.hashCode(); }
hashCode
246,095
boolean (Object object) { if (object == this) return true; if (object instanceof ErrorStripe stripe) { return stripe.myLayer == myLayer && stripe.myColor.getRGB() == myColor.getRGB(); } return false; }
equals
246,096
int (ErrorStripe stripe) { if (stripe == this) return 0; if (stripe == null || stripe.myLayer < myLayer) return -1; if (stripe.myLayer > myLayer) return 1; int thisRGB = myColor.getRGB(); int thatRGB = stripe.myColor.getRGB(); if (thatRGB == thisRGB) return 0; return thatRGB < thisRGB ? -1 : 1; }
compareTo
246,097
void (int thickness) { if (myMax != thickness) { myMax = thickness; invalidate(); } }
setMaximalThickness
246,098
void (int thickness) { if (thickness < 1) thickness = 1; if (myMin != thickness) { myMin = thickness; invalidate(); } }
setMinimalThickness
246,099
void (int gap) { if (gap < 0) gap = 0; if (myGap != gap) { myGap = gap; invalidate(); } }
setErrorStripeGap