Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
291,400
void () { close(); }
dispose
291,401
JediTermSearchComponent () { JediTermSearchComponentProvider provider = ApplicationManager.getApplication().getService(JediTermSearchComponentProvider.class); return provider != null ? provider.createSearchComponent(this) : new DefaultJediTermSearchComponent(); }
createSearchComponent
291,402
void (@NotNull Filter filter) { myCompositeFilterWrapper.addFilter(filter); }
addMessageFilter
291,403
void (TtyConnector connector) { setTtyConnector(connector); start(); }
start
291,404
JBTerminalSystemSettingsProviderBase () { return (JBTerminalSystemSettingsProviderBase)mySettingsProvider; }
getSettingsProvider
291,405
void () { if (myListener != null) { myListener.onTerminalStarted(); } }
notifyStarted
291,406
String () { return getText(getTerminalPanel()); }
getText
291,407
String (@NotNull TerminalPanel terminalPanel) { TerminalTextBuffer buffer = terminalPanel.getTerminalTextBuffer(); buffer.lock(); try { TerminalSelection selection = new TerminalSelection( new Point(0, -buffer.getHistoryLinesCount()), new Point(buffer.getWidth(), buffer.getScreenLinesCount() - 1)); Pair<Point, Point> points = selection.pointsForRun(buffer.getWidth()); return SelectionUtil.getSelectionText(points.first, points.second, buffer); } finally { buffer.unlock(); } }
getText
291,408
void (@NotNull @Nls String message) { String str = StringUtil.convertLineSeparators(message, LineSeparator.LF.getSeparatorString()); List<String> lines = StringUtil.split(str, LineSeparator.LF.getSeparatorString(), true, false); boolean first = true; for (String line : lines) { if (!first) { myTerminal.carriageReturn(); myTerminal.newLine(); } myTerminal.writeCharacters(line); first = false; } }
writePlainMessage
291,409
TerminalTitle () { return myTerminalTitle; }
getTerminalTitle
291,410
TerminalWidget () { return myBridge; }
asNewWidget
291,411
JBTerminalWidget () { return JBTerminalWidget.this; }
widget
291,412
JComponent () { return widget().getComponent(); }
getComponent
291,413
JComponent () { return widget().getPreferredFocusableComponent(); }
getPreferredFocusableComponent
291,414
TerminalTitle () { return widget().myTerminalTitle; }
getTerminalTitle
291,415
void (@NotNull TtyConnector ttyConnector, @NotNull TermSize initialTermSize) { widget().getTerminal().resize(initialTermSize, RequestOrigin.User); widget().createTerminalSession(ttyConnector); widget().start(); widget().getComponent().revalidate(); widget().notifyStarted(); myTtyConnectorAccessor.setTtyConnector(ttyConnector); }
connectToTty
291,416
void (@NotNull @Nls String message) { widget().writePlainMessage(message); }
writePlainMessage
291,417
void (boolean visible) { ApplicationManager.getApplication().invokeLater(() -> { widget().getTerminalPanel().setCursorVisible(false); }, myProject.getDisposed()); }
setCursorVisible
291,418
void () { // JBTerminalWidget should be registered in Disposer independently }
dispose
291,419
TtyConnectorAccessor () { return myTtyConnectorAccessor; }
getTtyConnectorAccessor
291,420
boolean () { return widget().getTerminalPanel().hasFocus(); }
hasFocus
291,421
void () { IdeFocusManager.getInstance(myProject).requestFocus(widget().getTerminalPanel(), true); }
requestFocus
291,422
void (@NotNull Runnable onTerminated, @NotNull Disposable parentDisposable) { TerminalWidgetListener listener = new TerminalWidgetListener() { @Override public void allSessionsClosed(com.jediterm.terminal.ui.TerminalWidget widget) { onTerminated.run(); } }; widget().addListener(listener); Disposer.register(parentDisposable, () -> { widget().removeListener(listener); }); }
addTerminationCallback
291,423
void (com.jediterm.terminal.ui.TerminalWidget widget) { onTerminated.run(); }
allSessionsClosed
291,424
void (@NotNull JComponent notificationComponent, @NotNull Disposable disposable) { widget().add(notificationComponent, BorderLayout.NORTH); Disposer.register(disposable, () -> { widget().remove(notificationComponent); widget().revalidate(); }); }
addNotification
291,425
void (@NotNull String shellCommand) { try { widget().executeCommand(shellCommand); } catch (IOException e) { LOG.info("Cannot execute shell command: " + shellCommand); } }
sendCommandToExecute
291,426
JBTerminalSystemSettingsProviderBase () { return new JBTerminalSystemSettingsProviderBase() { @Override public HyperlinkStyle.HighlightMode getHyperlinkHighlightingMode() { return HyperlinkStyle.HighlightMode.ALWAYS; } }; }
getProvider
291,427
JBTerminalWidget () { return myTerminalWidget; }
getTerminalWidget
291,428
void (ChangeEvent e) { verticalScrollModel.removeChangeListener(this); UiNotifyConnector.doWhenFirstShown(myTerminalWidget.getTerminalPanel(), () -> { myTerminalWidget.getTerminalPanel().scrollToShowAllOutput(); }); }
stateChanged
291,429
void (@NotNull ChangeListener listener, @NotNull Disposable parent) { myContentHelper.addChangeListener(listener, parent); }
addChangeListener
291,430
String (@NotNull Color color) { return ((char)Ascii.ESC) + "[" + "38;2;" + color.getRed() + ";" + color.getGreen() + ";" + color.getBlue() + "m"; }
encodeColor
291,431
boolean (@NotNull String text) { // ConPTY will randomly send these commands at any time, so we should skip them: int offset = 0; while (text.startsWith(MAKE_CURSOR_INVISIBLE, offset) || text.startsWith(MAKE_CURSOR_VISIBLE, offset)) { offset += MAKE_CURSOR_INVISIBLE.length(); } return text.startsWith(CLEAR_SCREEN, offset); }
startsWithClearScreen
291,432
TerminalExecutionConsole (boolean enterKeyDefaultCodeEnabled) { myEnterKeyDefaultCodeEnabled = enterKeyDefaultCodeEnabled; return this; }
withEnterKeyDefaultCodeEnabled
291,433
TerminalExecutionConsole (boolean convertLfToCrlfForNonPtyProcess) { myConvertLfToCrlfForNonPtyProcess = convertLfToCrlfForNonPtyProcess; return this; }
withConvertLfToCrlfForNonPtyProcess
291,434
void (@NotNull String text, @NotNull ConsoleViewContentType contentType) { // Convert line separators to CRLF to behave like ConsoleViewImpl. // For example, stacktraces passed to com.intellij.execution.testframework.sm.runner.SMTestProxy.setTestFailed have // only LF line separators on Unix. String textCRLF = convertTextToCRLF(text); try { printText(textCRLF, contentType); } catch (IOException e) { LOG.info(e); } }
print
291,435
String (@NotNull String text) { if (text.isEmpty()) return text; // Handle the case when \r and \n are in different chunks: "text1 \r" and "\n text2" boolean preserveFirstLF = text.startsWith(LineSeparator.LF.getSeparatorString()) && myLastCR; boolean preserveLastCR = text.endsWith(LineSeparator.CR.getSeparatorString()); myLastCR = preserveLastCR; String textToConvert = text.substring(preserveFirstLF ? 1 : 0, preserveLastCR ? text.length() - 1 : text.length()); String textCRLF = StringUtil.convertLineSeparators(textToConvert, LineSeparator.CRLF.getSeparatorString()); if (preserveFirstLF) { textCRLF = LineSeparator.LF.getSeparatorString() + textCRLF; } if (preserveLastCR) { textCRLF += LineSeparator.CR.getSeparatorString(); } return textCRLF; }
convertTextToCRLF
291,436
void () { myLastCR = false; myTerminalWidget.getTerminalPanel().clearBuffer(); }
clear
291,437
void (int offset) { }
scrollTo
291,438
void (@NotNull ProcessHandler processHandler) { attachToProcess(processHandler, true); }
attachToProcess
291,439
void (@NotNull ProcessHandler processHandler, boolean attachToProcessOutput) { attachToProcess(processHandler, new ProcessHandlerTtyConnector(processHandler, EncodingProjectManager.getInstance(myProject).getDefaultCharset()), attachToProcessOutput); }
attachToProcess
291,440
void (@NotNull ProcessHandler processHandler, @NotNull TtyConnector ttyConnector, boolean attachToProcessOutput) { if (!myAttachedToProcess.compareAndSet(false, true)) { return; } myTerminalWidget.createTerminalSession(ttyConnector); myTerminalWidget.start(); processHandler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { if (attachToProcessOutput) { try { ConsoleViewContentType contentType = null; if (outputType != ProcessOutputTypes.STDOUT) { contentType = ConsoleViewContentType.getConsoleViewType(outputType); } String text = event.getText(); if (outputType == ProcessOutputTypes.SYSTEM) { text = StringUtil.convertLineSeparators(text, LineSeparator.CRLF.getSeparatorString()); } else if (shouldConvertLfToCrlf(processHandler)) { text = convertTextToCRLF(text); } printText(text, contentType); } catch (IOException e) { LOG.info(e); } } } @Override public void processTerminated(@NotNull ProcessEvent event) { myAttachedToProcess.set(false); ApplicationManager.getApplication().invokeLater(() -> { myTerminalWidget.getTerminalPanel().setCursorVisible(false); }, ModalityState.any()); } }); }
attachToProcess
291,441
void (@NotNull ProcessEvent event, @NotNull Key outputType) { if (attachToProcessOutput) { try { ConsoleViewContentType contentType = null; if (outputType != ProcessOutputTypes.STDOUT) { contentType = ConsoleViewContentType.getConsoleViewType(outputType); } String text = event.getText(); if (outputType == ProcessOutputTypes.SYSTEM) { text = StringUtil.convertLineSeparators(text, LineSeparator.CRLF.getSeparatorString()); } else if (shouldConvertLfToCrlf(processHandler)) { text = convertTextToCRLF(text); } printText(text, contentType); } catch (IOException e) { LOG.info(e); } } }
onTextAvailable
291,442
void (@NotNull ProcessEvent event) { myAttachedToProcess.set(false); ApplicationManager.getApplication().invokeLater(() -> { myTerminalWidget.getTerminalPanel().setCursorVisible(false); }, ModalityState.any()); }
processTerminated
291,443
boolean (@NotNull ProcessHandler processHandler) { return myConvertLfToCrlfForNonPtyProcess && isNonPtyProcess(processHandler); }
shouldConvertLfToCrlf
291,444
boolean (@NotNull ProcessHandler processHandler) { if (processHandler instanceof BaseProcessHandler) { Process process = ((BaseProcessHandler<?>)processHandler).getProcess(); return !(process instanceof PtyProcess); } return true; }
isNonPtyProcess
291,445
void (boolean value) { }
setOutputPaused
291,446
boolean () { return false; }
isOutputPaused
291,447
boolean () { return false; }
hasDeferredOutput
291,448
void (@NotNull Runnable runnable) { }
performWhenNoDeferredOutput
291,449
void (@NotNull String helpId) { }
setHelpId
291,450
void (@NotNull Filter filter) { myTerminalWidget.addMessageFilter(filter); }
addMessageFilter
291,451
void (@NotNull String hyperlinkText, @Nullable HyperlinkInfo info) { }
printHyperlink
291,452
int () { return 0; }
getContentSize
291,453
boolean () { return false; }
canPause
291,454
void () { }
allowHeavyFilters
291,455
JComponent () { return myTerminalWidget.getComponent(); }
getComponent
291,456
JComponent () { return myTerminalWidget.getComponent(); }
getPreferredFocusableComponent
291,457
void () { }
dispose
291,458
boolean (@NotNull ProcessHandler processHandler) { if (!(processHandler instanceof OSProcessHandler) || processHandler instanceof ColoredProcessHandler) { return false; } Process process = ((OSProcessHandler)processHandler).getProcess(); return process instanceof PtyProcess || (process instanceof PtyBasedProcess && ((PtyBasedProcess)process).hasPty()); }
isAcceptable
291,459
JBTerminalPanel (@NotNull SettingsProvider settingsProvider, @NotNull StyleState styleState, @NotNull TerminalTextBuffer textBuffer) { JBTerminalPanel panel = new JBTerminalPanel((JBTerminalSystemSettingsProviderBase)settingsProvider, textBuffer, styleState) { @Override public void clearBuffer() { super.clearBuffer(false); } }; Disposer.register(this, panel); return panel; }
createTerminalPanel
291,460
void () { super.clearBuffer(false); }
clearBuffer
291,461
TerminalStarter (@NotNull JediTerminal terminal, @NotNull TtyConnector connector) { return new TerminalStarter(terminal, connector, myDataStream, myTerminalWidget.getTypeAheadManager(), getExecutorServiceManager()) { @Override public byte[] getCode(int key, int modifiers) { if (key == KeyEvent.VK_ENTER && modifiers == 0 && myEnterKeyDefaultCodeEnabled) { PtyProcess process = getPtyProcess(); return process != null ? new byte[]{process.getEnterKeyCode()} : LineSeparator.CR.getSeparatorBytes(); } return super.getCode(key, modifiers); } }; }
createTerminalStarter
291,462
byte[] (int key, int modifiers) { if (key == KeyEvent.VK_ENTER && modifiers == 0 && myEnterKeyDefaultCodeEnabled) { PtyProcess process = getPtyProcess(); return process != null ? new byte[]{process.getEnterKeyCode()} : LineSeparator.CR.getSeparatorBytes(); } return super.getCode(key, modifiers); }
getCode
291,463
void (@NotNull AnActionEvent e) { e.getPresentation().setEnabled(true); }
update
291,464
ActionUpdateThread () { return ActionUpdateThread.BGT; }
getActionUpdateThread
291,465
void (@NotNull AnActionEvent e) { clear(); }
actionPerformed
291,466
void (@NotNull AnActionEvent e) { BoundedRangeModel verticalScrollModel = myTerminalWidget.getTerminalPanel().getVerticalScrollModel(); e.getPresentation().setEnabled(verticalScrollModel.getValue() != 0); }
update
291,467
ActionUpdateThread () { return ActionUpdateThread.EDT; }
getActionUpdateThread
291,468
void (@NotNull AnActionEvent e) { myTerminalWidget.getTerminalPanel().getVerticalScrollModel().setValue(0); }
actionPerformed
291,469
void (@NotNull ObservableConsoleView.ChangeListener listener, @NotNull Disposable parent) { myChangeListeners.add(listener); Disposer.register(parent, () -> myChangeListeners.remove(listener)); }
addChangeListener
291,470
void (@NotNull String text, @NotNull ConsoleViewContentType contentType) { myTextChunks.add(Pair.create(text, contentType)); if (myRequested.compareAndSet(false, true) && !myDisposed) { myAlarm.addRequest(this::flush, FLUSH_TIMEOUT); } }
onContentTypePrinted
291,471
void () { if (myDisposed) return; myRequested.set(false); List<Pair<String, ConsoleViewContentType>> textChunks = new ArrayList<>(myTextChunks.size()); myTextChunks.drainTo(textChunks); if (!textChunks.isEmpty()) { fireTextAdded(textChunks); } }
flush
291,472
void (@NotNull List<? extends Pair<String, ConsoleViewContentType>> textContentTypes) { for (ObservableConsoleView.ChangeListener listener : myChangeListeners) { for (Pair<String, ConsoleViewContentType> pair : textContentTypes) { listener.textAdded(pair.first, pair.second); } } }
fireTextAdded
291,473
void () { myDisposed = true; myAlarm.cancelAllRequests(); }
dispose
291,474
void (char c) { myPushBackQueue.addFirst(c); }
pushChar
291,475
String (int maxLength) { StringBuilder sb = new StringBuilder(); while (sb.length() < maxLength) { Character c = myPushBackQueue.peek(); if (c != null) { if (c.charValue() < 32) { break; } sb.append(myPushBackQueue.poll()); } else { c = myQueue.peek(); if (c == null || c.charValue() < 32) { break; } sb.append(myQueue.poll()); } } return sb.toString(); }
readNonControlCharacters
291,476
void (char[] chars, int length) { for (int i = length - 1; i >= 0; i--) { myPushBackQueue.addFirst(chars[i]); } }
pushBackBuffer
291,477
boolean () { return myPushBackQueue.isEmpty() && myQueue.isEmpty(); }
isEmpty
291,478
boolean (@Nullable Component component) { return component instanceof TerminalPanel; }
isTerminalComponent
291,479
boolean (@Nullable Component component) { return component instanceof TerminalPanel terminalPanel && terminalPanel.getSelection() != null; }
hasSelectionInTerminal
291,480
void () { // ProcessHandler shouldn't be disposed silently on TerminalExecutionConsole disposing. // Normally, an attempt to close a console attached to a running process should be handled by // BaseContentCloseListener which may ask user what do to. Alternatively, a client may handle it on its own. // Generally, ConsoleView doesn't own an attached ProcessHandler instance. }
close
291,481
void (@NotNull TermSize termSize) { if (myPtyProcess instanceof PtyProcess ptyProcess) { if (ptyProcess.isAlive()) { ptyProcess.setWinSize(new WinSize(termSize.getColumns(), termSize.getRows())); } } else if (myPtyProcess instanceof PtyBasedProcess ptyBasedProcess) { ptyBasedProcess.setWindowSize(termSize.getColumns(), termSize.getRows()); } else if (myPtyProcess instanceof RemoteProcess remoteProcess) { remoteProcess.setWindowSize(termSize.getColumns(), termSize.getRows()); } }
resize
291,482
String () { //noinspection HardCodedStringLiteral return "TtyConnector:" + myProcessHandler.toString(); }
getName
291,483
boolean () { return false; }
isConnected
291,484
ProcessHandler () { return myProcessHandler; }
getProcessHandler
291,485
void (@NotNull KeyEvent e) { if (e.getID() == KeyEvent.KEY_PRESSED && !e.isConsumed() && isMatched(e) && switchFocusToEditorIfSuitable()) { e.consume(); } }
handleKeyEvent
291,486
boolean (@NotNull KeyEvent e) { KeyStroke stroke = getKeyStroke(); return stroke != null && stroke.getKeyCode() == e.getKeyCode() && stroke.getModifiers() == UIUtil.getAllModifiers(e); }
isMatched
291,487
boolean () { if (shouldSwitchFocusToEditor()) { Project project = myTerminalPanel.getContextProject(); if (project != null && !project.isDisposed()) { // Repeat logic from com.intellij.openapi.wm.impl.InternalDecorator#processKeyBinding ToolWindowManager.getInstance(project).activateEditorComponent(); return true; } } return false; }
switchFocusToEditorIfSuitable
291,488
boolean () { if (myTerminalPanel.getTerminalTextBuffer().isUsingAlternateBuffer()) { return false; } ToolWindow toolWindow = myTerminalPanel.getContextToolWindow(); if (toolWindow == null) { return false; } if (JBTerminalWidget.isTerminalToolWindow(toolWindow) && !AdvancedSettings.getBoolean("terminal.escape.moves.focus.to.editor")) { return false; // For example, vi key bindings configured in terminal } return true; }
shouldSwitchFocusToEditor
291,489
void (@NotNull String text) { CopyPasteManager.getInstance().setContents(new StringSelection(text)); }
setSystemClipboardContents
291,490
Dimension () { if (isMinimumSizeSet()) { return super.getMinimumSize(); } return JBUI.emptySize(); }
getMinimumSize
291,491
boolean (@NotNull KeyEvent e) { return skipAction(e, myActionsToSkip); }
skipKeyEvent
291,492
boolean (@NotNull KeyEvent e, @Nullable List<? extends AnAction> actionsToSkip) { if (actionsToSkip != null) { final KeyboardShortcut eventShortcut = new KeyboardShortcut(KeyStroke.getKeyStrokeForEvent(e), null); for (AnAction action : actionsToSkip) { for (Shortcut sc : action.getShortcutSet().getShortcuts()) { if (sc.isKeyboard() && sc.startsWith(eventShortcut)) { if (!Registry.is("terminal.Ctrl-E.opens.RecentFiles.popup", false) && IdeActions.ACTION_RECENT_FILES.equals(ActionManager.getInstance().getId(action))) { if (e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK && e.getKeyCode() == KeyEvent.VK_E) { return false; } } return true; } } } } return false; }
skipAction
291,493
void (@NotNull KeyEvent e) { for (Consumer<? super KeyEvent> preKeyEventConsumer : myPreKeyEventConsumers) { preKeyEventConsumer.accept(e); } myEscapeKeyListener.handleKeyEvent(e); if (!e.isConsumed()) { super.handleKeyEvent(e); } }
handleKeyEvent
291,494
void (@NotNull Consumer<? super KeyEvent> preKeyEventHandler) { myPreKeyEventConsumers.add(preKeyEventHandler); }
addPreKeyEventHandler
291,495
List<TerminalAction> () { List<TerminalAction> actions = super.getActions(); String clearBufferActionName = mySettingsProvider.getClearBufferActionPresentation().getName(); TerminalAction clearBufferAction = ContainerUtil.find(actions, action -> action.getName().equals(clearBufferActionName)); if (clearBufferAction != null) { clearBufferAction.withEnabledSupplier(() -> { if (getTerminalTextBuffer().isUsingAlternateBuffer()) { return false; } JBTerminalWidget terminalWidget = DataManager.getInstance().getDataContext(this).getData(JBTerminalWidget.TERMINAL_DATA_KEY); if (terminalWidget == null || terminalWidget.getTerminalPanel() != this) { return false; } ProcessTtyConnector connector = terminalWidget.getProcessTtyConnector(); WinConPtyProcess winConPtyProcess = connector != null ? ObjectUtils.tryCast(connector.getProcess(), WinConPtyProcess.class) : null; return winConPtyProcess == null; }); } return actions; }
getActions
291,496
void (Graphics graphics) { UIUtil.setupComposite((Graphics2D)graphics); UISettings.setupAntialiasing(graphics); }
setupAntialiasing
291,497
TerminalCopyPasteHandler () { return new IdeTerminalCopyPasteHandler(); }
createCopyPasteHandler
291,498
JPopupMenu (@NotNull TerminalActionProvider actionProvider) { return ActionManager.getInstance().createActionPopupMenu( ActionPlaces.TOOLWINDOW_POPUP, wrapTerminalActions(actionProvider) ).getComponent(); }
createPopupMenu
291,499
ActionGroup (@NotNull TerminalActionProvider provider) { var result = new DefaultActionGroup(); TerminalAction.buildMenu(provider, new TerminalActionMenuBuilder() { @Override public void addAction(@NotNull TerminalAction action) { result.add(new TerminalActionWrapper(action)); } @Override public void addSeparator() { result.addSeparator(); } }); return result; }
wrapTerminalActions