Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
51,000
ShellStartupOptions (@NotNull ShellStartupOptions baseOptions) { String workingDir = getWorkingDirectory(baseOptions.getWorkingDirectory()); Map<String, String> envs = getTerminalEnvironment(workingDir); List<String> initialCommand = doGetInitialCommand(baseOptions, envs); ShellTerminalWidget widget = getShellTerminalW...
configureStartupOptions
51,001
ShellStartupOptions (@NotNull ShellStartupOptions options) { String[] command = ArrayUtil.toStringArray(options.getShellCommand()); Map<String, String> envs = ShellStartupOptionsKt.createEnvVariablesMap(options.getEnvVariables()); for (LocalTerminalCustomizer customizer : LocalTerminalCustomizer.EP_NAME.getExtensions()...
applyTerminalCustomizers
51,002
boolean () { return TerminalOptionsProvider.getInstance().getShellIntegration(); }
enableShellIntegration
51,003
List<String> (@NotNull ShellStartupOptions options, @NotNull Map<String, String> envs) { try { myStartupOptionsThreadLocal.set(options); return getInitialCommand(envs); } finally { myStartupOptionsThreadLocal.remove(); } }
doGetInitialCommand
51,004
List<String> (@NotNull String shellPath) { List<String> shellCommand = ParametersListUtil.parse(shellPath, false, !SystemInfo.isWindows); String shellExe = ContainerUtil.getFirstItem(shellCommand); if (shellExe == null) return shellCommand; String shellName = PathUtil.getFileName(shellExe); if (!containsLoginOrInteract...
convertShellPathToCommand
51,005
String (String @NotNull[] command, @NotNull String workingDirectory, @Nullable TermSize initialTermSize, @NotNull Map<String, String> environment, boolean envDiff) { String info = Arrays.toString(command) + " in " + workingDirectory + (isDirectory(workingDirectory) ? "" : " [no such directory]") + ", [" + initialTermSi...
stringifyProcessInfo
51,006
String (@Nullable String directory) { if (directory != null && isDirectory(directory)) { return directory; } String configuredWorkingDirectory = TerminalProjectOptionsProvider.getInstance(myProject).getStartingDirectory(); if (configuredWorkingDirectory != null && isDirectory(configuredWorkingDirectory)) { return confi...
getWorkingDirectory
51,007
boolean (@NotNull String directory) { try { boolean ok = Files.isDirectory(Path.of(directory)); if (!ok) { LOG.info("Cannot start local terminal in " + directory + ": no such directory"); } return ok; } catch (InvalidPathException e) { LOG.info("Cannot start local terminal in " + directory + ": invalid path", e); retur...
isDirectory
51,008
TtyConnector (@NotNull PtyProcess process) { return new PtyProcessTtyConnector(process, myDefaultCharset) { @Override public void close() { if (process instanceof UnixPtyProcess) { ((UnixPtyProcess)process).hangup(); AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> { if (process.isAlive()) { LOG.info("Te...
createTtyConnector
51,009
void () { if (process instanceof UnixPtyProcess) { ((UnixPtyProcess)process).hangup(); AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> { if (process.isAlive()) { LOG.info("Terminal hasn't been terminated by SIGHUP, performing default termination"); process.destroy(); } }, 1000, TimeUnit.MILLISECONDS); }...
close
51,010
void (@NotNull TermSize termSize) { if (LOG.isDebugEnabled()) { LOG.debug("resize to " + termSize); } super.resize(termSize); }
resize
51,011
String () { return TerminalOptionsProvider.getInstance().getTabName(); }
getDefaultTabTitle
51,012
List<String> (@NotNull Map<String, String> envs) { ShellStartupOptions startupOptions = myStartupOptionsThreadLocal.get(); List<String> shellCommand = startupOptions != null ? startupOptions.getShellCommand() : null; return shellCommand != null ? shellCommand : convertShellPathToCommand(getShellPath()); }
getInitialCommand
51,013
String () { return TerminalProjectOptionsProvider.getInstance(myProject).getShellPath(); }
getShellPath
51,014
List<String> (@NotNull String shellPath, @NotNull Map<String, String> envs, boolean shellIntegration) { List<String> command = convertShellPathToCommand(shellPath); if (shellIntegration) { ShellStartupOptions options = injectShellIntegration(command, envs); return Objects.requireNonNull(options.getShellCommand()); } re...
getCommand
51,015
ShellStartupOptions (@NotNull List<String> shellCommand, @NotNull Map<String, String> envs) { ShellStartupOptions options = new ShellStartupOptions.Builder().shellCommand(shellCommand).envVariables(envs).build(); return injectShellIntegration(options); }
injectShellIntegration
51,016
ShellStartupOptions (@NotNull ShellStartupOptions options) { List<String> shellCommand = options.getShellCommand(); String shellExe = ContainerUtil.getFirstItem(shellCommand); if (shellCommand == null || shellExe == null) return options; List<String> arguments = new ArrayList<>(shellCommand.subList(1, shellCommand.size...
injectShellIntegration
51,017
void (@NotNull ShellStartupOptions startupOptions, @NotNull Map<String, String> envs) { Function0<Path> commandHistoryFileProvider = startupOptions.getCommandHistoryFileProvider(); Path commandHistoryFile = commandHistoryFileProvider != null ? commandHistoryFileProvider.invoke() : null; if (commandHistoryFile != null) ...
setCommandHistoryFile
51,018
boolean (@NotNull String shellName) { return isBashZshFish(shellName); }
isLoginOptionAvailable
51,019
boolean (@NotNull String shellName) { return isBashZshFish(shellName); }
isInteractiveOptionAvailable
51,020
boolean (@NotNull String shellName) { return shellName.equals(BASH_NAME) || (SystemInfo.isMac && shellName.equals(SH_NAME)) || shellName.equals(ZSH_NAME) || shellName.equals(FISH_NAME); }
isBashZshFish
51,021
void (@NotNull Map<String, String> envs, boolean loginShell) { if (loginShell) { envs.put(LOGIN_SHELL, "1"); } }
setLoginShellEnv
51,022
void (Map<String, String> envs, List<String> arguments, List<String> result, String rcFilePath, String rcfileOption) { result.add(rcfileOption); result.add(rcFilePath); int idx = arguments.indexOf(rcfileOption); if (idx >= 0) { arguments.remove(idx); if (idx < arguments.size()) { envs.put(JEDITERM_USER_RCFILE, FileUtil...
addRcFileArgument
51,023
boolean (List<String> command) { return isLogin(command) || command.contains(INTERACTIVE_CLI_OPTION); }
containsLoginOrInteractiveOption
51,024
boolean (@NotNull List<String> command) { return ContainerUtil.exists(command, LOGIN_CLI_OPTIONS::contains); }
isLogin
51,025
boolean () { return (ExperimentalUI.isNewUI() || ApplicationManager.getApplication().isUnitTestMode()) && Registry.is(BLOCK_TERMINAL_REGISTRY, false); }
isBlockTerminalEnabled
51,026
void (@NotNull String shellCommand, @NotNull TerminalStarter terminalStarter) { StringBuilder result = new StringBuilder(); if (terminalStarter.isLastSentByteEscape()) { result.append((char)KeyEvent.VK_BACK_SPACE); // remove Escape first, workaround for IDEA-221031 } String enterCode = new String(terminalStarter.getTer...
sendCommandToExecute
51,027
ShellStartupOptions () { return new ShellStartupOptions.Builder().workingDirectory(myWorkingDirectory).initialTermSize(myInitialTermSize).build(); }
toStartupOptions
51,028
JComponent (@NotNull Project project, @NotNull TerminalOptionsProvider provider, @NotNull TerminalProjectOptionsProvider projectOptionsProvider) { myProject = project; myOptionsProvider = provider; myProjectOptionsProvider = projectOptionsProvider; myProjectSettingsPanel.setBorder(IdeBorderFactory.createTitledBorder(Te...
createPanel
51,029
void () { myStartDirectoryField.addBrowseFolderListener( "", TerminalBundle.message("settings.start.directory.browseFolder.description"), null, FileChooserDescriptorFactory.createSingleFolderDescriptor(), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT ); setupTextFieldDefaultValue(myStartDirectoryField.getTextField(), () ...
configureStartDirectoryField
51,030
void () { myShellPathField.addBrowseFolderListener( "", TerminalBundle.message("settings.terminal.shell.executable.path.browseFolder.description"), null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(), TextComponentAccessors.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT ); setupTextFieldDefaultValue(myShellPathFi...
configureShellPathField
51,031
void (@NotNull JTextField textField, @NotNull Supplier<@NlsSafe String> defaultValueSupplier) { String defaultShellPath = defaultValueSupplier.get(); if (StringUtil.isEmptyOrSpaces(defaultShellPath)) return; textField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNul...
setupTextFieldDefaultValue
51,032
void (@NotNull DocumentEvent e) { textField.setForeground(defaultShellPath.equals(textField.getText()) ? getDefaultValueColor() : getChangedValueColor()); }
textChanged
51,033
boolean () { return !Objects.equals(myShellPathField.getText(), myProjectOptionsProvider.getShellPath()) || !Objects.equals(myStartDirectoryField.getText(), StringUtil.notNullize(myProjectOptionsProvider.getStartingDirectory())) || !Objects.equals(myTabNameTextField.getText(), myOptionsProvider.getTabName()) || (myClos...
isModified
51,034
void () { myProjectOptionsProvider.setStartingDirectory(myStartDirectoryField.getText()); myProjectOptionsProvider.setShellPath(myShellPathField.getText()); myOptionsProvider.setTabName(myTabNameTextField.getText()); myOptionsProvider.setCloseSessionOnLogout(myCloseSessionCheckBox.isSelected()); myOptionsProvider.setMo...
apply
51,035
void () { myShellPathField.setText(myProjectOptionsProvider.getShellPath()); myStartDirectoryField.setText(myProjectOptionsProvider.getStartingDirectory()); myTabNameTextField.setText(myOptionsProvider.getTabName()); myCloseSessionCheckBox.setSelected(myOptionsProvider.getCloseSessionOnLogout()); myMouseReportCheckBox....
reset
51,036
Color () { return findColorByKey("TextField.inactiveForeground", "nimbusDisabledText"); }
getDefaultValueColor
51,037
void () { myConfigureTerminalKeybindingsActionLink = new ActionLink("", e -> { Settings settings = DataManager.getInstance().getDataContext((ActionLink)e.getSource()).getData(Settings.KEY); if (settings != null) { Configurable configurable = settings.find("preferences.keymap"); settings.select(configurable, "Terminal")...
createUIComponents
51,038
TextFieldWithHistoryWithBrowseButton () { TextFieldWithHistoryWithBrowseButton textFieldWithHistoryWithBrowseButton = new TextFieldWithHistoryWithBrowseButton(); final TextFieldWithHistory textFieldWithHistory = textFieldWithHistoryWithBrowseButton.getChildComponent(); textFieldWithHistory.setEditor(new BasicComboBoxEd...
createShellPath
51,039
JTextField () { return new JBTextField(); }
createEditorComponent
51,040
List<String> () { List<String> shells = new ArrayList<>(); if (SystemInfo.isUnix) { addIfExists(shells, "/bin/bash"); addIfExists(shells, "/usr/bin/zsh"); addIfExists(shells, "/usr/local/bin/zsh"); addIfExists(shells, "/usr/bin/fish"); addIfExists(shells, "/usr/local/bin/fish"); } else if (SystemInfo.isWindows) { File ...
detectShells
51,041
void (@NotNull List<String> shells, @NotNull String filePath) { if (Files.exists(Path.of(filePath))) { shells.add(filePath); } }
addIfExists
51,042
Color (String... colorKeys) { Color c = null; for (String key : colorKeys) { c = UIManager.getColor(key); if (c != null) { break; } } assert c != null : "Can't find color for keys " + Arrays.toString(colorKeys); return c; }
findColorByKey
51,043
Color () { return findColorByKey("TextField.foreground"); }
getChangedValueColor
51,044
ToolWindow () { return myToolWindow; }
getToolWindow
51,045
void () { }
dispose
51,046
Set<JBTerminalWidget> () { return ContainerUtil.map2SetNotNull(myContainerByWidgetMap.keySet(), widget -> JBTerminalWidget.asJediTermWidget(widget)); }
getWidgets
51,047
Set<TerminalWidget> () { return Collections.unmodifiableSet(myContainerByWidgetMap.keySet()); }
getTerminalWidgets
51,048
void (@NotNull Consumer<TerminalWidget> listener, @NotNull Disposable parentDisposable) { myTerminalSetupHandlers.add(listener); if (!Disposer.tryRegister(parentDisposable, () -> { myTerminalSetupHandlers.remove(listener); })) { myTerminalSetupHandlers.remove(listener); } }
addNewTerminalSetupHandler
51,049
TerminalToolWindowManager (@NotNull Project project) { return project.getService(TerminalToolWindowManager.class); }
getInstance
51,050
void (@NotNull ToolWindow toolWindow) { if (isTerminalToolWindow(toolWindow) && myToolWindow == toolWindow && toolWindow.isVisible() && toolWindow.getContentManager().isEmpty()) { // open a new session if all tabs were closed manually createNewSession(myTerminalRunner, null, true, true); } }
toolWindowShown
51,051
void (@NotNull AbstractTerminalRunner<?> terminalRunner) { createNewSession(terminalRunner, null); }
createNewSession
51,052
void (@NotNull AbstractTerminalRunner<?> terminalRunner, @Nullable TerminalTabState tabState) { createNewSession(terminalRunner, tabState, true); }
createNewSession
51,053
TerminalWidget () { return createNewSession(myTerminalRunner, null, true, true); }
createNewSession
51,054
ShellTerminalWidget (@Nullable String workingDirectory, @Nullable @Nls String tabName) { return ShellTerminalWidget.toShellJediTermWidgetOrThrow(createShellWidget(workingDirectory, tabName, true, true)); }
createLocalShellWidget
51,055
ShellTerminalWidget (@Nullable String workingDirectory, @Nullable @Nls String tabName, boolean requestFocus) { return ShellTerminalWidget.toShellJediTermWidgetOrThrow(createShellWidget(workingDirectory, tabName, requestFocus, true)); }
createLocalShellWidget
51,056
ShellTerminalWidget (@Nullable String workingDirectory, @Nullable @Nls String tabName, boolean requestFocus, boolean deferSessionStartUntilUiShown) { return ShellTerminalWidget.toShellJediTermWidgetOrThrow( createShellWidget(workingDirectory, tabName, requestFocus, deferSessionStartUntilUiShown)); }
createLocalShellWidget
51,057
TerminalWidget (@Nullable String workingDirectory, @Nullable @Nls String tabName, boolean requestFocus, boolean deferSessionStartUntilUiShown) { TerminalTabState tabState = new TerminalTabState(); tabState.myTabName = tabName; tabState.myWorkingDirectory = workingDirectory; return createNewSession(myTerminalRunner, tab...
createShellWidget
51,058
void (@NotNull AbstractTerminalRunner<?> terminalRunner, @Nullable TerminalTabState tabState, boolean requestFocus) { createNewSession(terminalRunner, tabState, requestFocus, true); }
createNewSession
51,059
TerminalWidget (@NotNull AbstractTerminalRunner<?> terminalRunner, @Nullable TerminalTabState tabState, boolean requestFocus, boolean deferSessionStartUntilUiShown) { ToolWindow toolWindow = getOrInitToolWindow(); Content content = createNewTab(null, terminalRunner, toolWindow, tabState, requestFocus, deferSessionStart...
createNewSession
51,060
ToolWindow () { ToolWindow toolWindow = myToolWindow; if (toolWindow == null) { toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID); Objects.requireNonNull(toolWindow).getContentManager(); // to call #initToolWindow LOG.assertTrue(toolWindow == myToolWindow); } ...
getOrInitToolWindow
51,061
Content (@NotNull ToolWindow toolWindow, @Nullable TerminalWidget terminalWidget) { return createNewTab(terminalWidget, myTerminalRunner, toolWindow, null, true, true); }
newTab
51,062
Content (@Nullable TerminalWidget terminalWidget, @NotNull AbstractTerminalRunner<?> terminalRunner, @NotNull ToolWindow toolWindow, @Nullable TerminalTabState tabState, boolean requestFocus, boolean deferSessionStartUntilUiShown) { final Content content = createTerminalContent(terminalRunner, toolWindow, terminalWidge...
createNewTab
51,063
Content (@NotNull AbstractTerminalRunner<?> terminalRunner, @NotNull ToolWindow toolWindow, @Nullable TerminalWidget terminalWidget, @Nullable TerminalTabState tabState, boolean deferSessionStartUntilUiShown) { TerminalToolWindowPanel panel = new TerminalToolWindowPanel(PropertiesComponent.getInstance(myProject), toolW...
createTerminalContent
51,064
void (@NotNull ToolWindow toolWindow, @NotNull TerminalWidget widget, @NotNull Content content) { MoveTerminalToolWindowTabLeftAction moveTabLeftAction = new MoveTerminalToolWindowTabLeftAction(); MoveTerminalToolWindowTabRightAction moveTabRightAction = new MoveTerminalToolWindowTabRightAction(); widget.getTerminalTit...
setupTerminalWidget
51,065
void (@NotNull TerminalTitle terminalTitle) { ApplicationManager.getApplication().invokeLater(() -> { updateTabTitle(terminalTitle, toolWindow, content); }, myProject.getDisposed()); }
onTitleChanged
51,066
void () { newTab(toolWindow, null); }
onNewSession
51,067
void () { }
onTerminalStarted
51,068
void () { if (toolWindow.getContentManager().getContentCount() > 1) { toolWindow.getContentManager().selectPreviousContent(); } }
onPreviousTabSelected
51,069
void () { if (toolWindow.getContentManager().getContentCount() > 1) { toolWindow.getContentManager().selectNextContent(); } }
onNextTabSelected
51,070
void () { getContainer(terminalWidget).closeAndHide(); }
onSessionClosed
51,071
void () { ShowContentAction action = new ShowContentAction(toolWindow, toolWindow.getComponent(), toolWindow.getContentManager()); DataContext dataContext = DataManager.getInstance().getDataContext(toolWindow.getComponent()); KeyEvent fakeKeyEvent = new KeyEvent(toolWindow.getComponent(), ActionEvent.ACTION_PERFORMED, ...
showTabs
51,072
void () { moveTabRightAction.move(content, myProject); }
moveTabRight
51,073
void () { moveTabLeftAction.move(content, myProject); }
moveTabLeft
51,074
boolean () { return moveTabRightAction.isAvailable(content); }
canMoveTabRight
51,075
boolean () { return moveTabLeftAction.isAvailable(content); }
canMoveTabLeft
51,076
boolean (boolean vertically) { return true; }
canSplit
51,077
void (boolean vertically) { TerminalToolWindowManager.this.split(widget, vertically); }
split
51,078
boolean () { return isSplitTerminal(terminalWidget); }
isGotoNextSplitTerminalAvailable
51,079
void (boolean forward) { TerminalToolWindowManager.this.gotoNextSplitTerminal(widget, forward); }
gotoNextSplitTerminal
51,080
void (@NotNull TerminalTitle terminalTitle, @NotNull ToolWindow toolWindow, @NotNull Content content) { String title = terminalTitle.buildTitle(); List<String> tabs = Arrays.stream(toolWindow.getContentManager().getContents()) .filter(c -> c!= content) .map(c -> c.getDisplayName()).toList(); content.setDisplayName(gene...
updateTabTitle
51,081
boolean (@NotNull JBTerminalWidget widget) { TerminalContainer container = getContainer(widget); return container.isSplitTerminal(); }
isSplitTerminal
51,082
boolean (@NotNull TerminalWidget widget) { TerminalContainer container = getContainer(widget); return container != null && container.isSplitTerminal(); }
isSplitTerminal
51,083
void (@NotNull TerminalWidget widget, boolean forward) { TerminalContainer container = getContainer(widget); if (container != null) { TerminalWidget next = container.getNextSplitTerminal(forward); if (next != null) { next.requestFocus(); } } }
gotoNextSplitTerminal
51,084
void (@NotNull TerminalWidget widget, boolean vertically) { TerminalContainer container = getContainer(widget); if (container != null) { String workingDirectory = TerminalWorkingDirectoryManager.getWorkingDirectory(widget); ShellStartupOptions startupOptions = ShellStartupOptionsKt.shellStartupOptions(workingDirectory)...
split
51,085
void (@NotNull TerminalContainer terminalContainer) { myContainerByWidgetMap.put(terminalContainer.getTerminalWidget(), terminalContainer); }
register
51,086
void (@NotNull TerminalContainer terminalContainer) { myContainerByWidgetMap.remove(terminalContainer.getTerminalWidget()); if (terminalContainer.getContent().getUserData(TERMINAL_WIDGET_KEY) == terminalContainer.getTerminalWidget()) { terminalContainer.getContent().putUserData(TERMINAL_WIDGET_KEY, findWidgetForContent...
unregister
51,087
TerminalContainer (@NotNull JBTerminalWidget terminalWidget) { return Objects.requireNonNull(getContainer(terminalWidget.asNewWidget())); }
getContainer
51,088
void (@NotNull Content content) { myToolWindow.getContentManager().removeContent(content, true, true, true); }
closeTab
51,089
FocusListener (@NotNull ToolWindow toolWindow) { return new FocusListener() { @Override public void focusGained(FocusEvent e) { JComponent component = getComponentToFocus(toolWindow); if (component != null) { component.requestFocusInWindow(); } } @Override public void focusLost(FocusEvent e) { } }; }
createFocusListener
51,090
void (FocusEvent e) { JComponent component = getComponentToFocus(toolWindow); if (component != null) { component.requestFocusInWindow(); } }
focusGained
51,091
void (FocusEvent e) { }
focusLost
51,092
JComponent (@NotNull ToolWindow toolWindow) { Content selectedContent = toolWindow.getContentManager().getSelectedContent(); if (selectedContent != null) { return selectedContent.getPreferredFocusableComponent(); } else { return toolWindow.getComponent(); } }
getComponentToFocus
51,093
void (@Nullable VirtualFile fileToOpen) { TerminalTabState state = new TerminalTabState(); VirtualFile parentDirectory = fileToOpen != null && !fileToOpen.isDirectory() ? fileToOpen.getParent() : fileToOpen; if (parentDirectory != null) { state.myWorkingDirectory = parentDirectory.getPath(); } createNewSession(myTermin...
openTerminalIn
51,094
JBTerminalWidget (@NotNull Content content) { TerminalWidget data = content.getUserData(TERMINAL_WIDGET_KEY); return data != null ? JBTerminalWidget.asJediTermWidget(data) : null; }
getWidgetByContent
51,095
void (@NotNull Content content) { ContentManager contentManager = myToolWindow.getContentManager(); LOG.assertTrue(contentManager.getIndexOfContent(content) >= 0, "Not a terminal content"); TerminalTabCloseListener.Companion.executeContentOperationSilently(content, () -> { contentManager.removeContent(content, true); r...
detachWidgetAndRemoveContent
51,096
boolean (@NotNull JBTerminalWidget widget) { DataContext dataContext = DataManager.getInstance().getDataContext(widget.getTerminalPanel()); ToolWindow toolWindow = dataContext.getData(PlatformDataKeys.TOOL_WINDOW); return isTerminalToolWindow(toolWindow); }
isInTerminalToolWindow
51,097
boolean (@Nullable ToolWindow toolWindow) { return toolWindow != null && TerminalToolWindowFactory.TOOL_WINDOW_ID.equals(toolWindow.getId()); }
isTerminalToolWindow
51,098
RelativeRectangle () { return new RelativeRectangle(myToolWindow.getComponent()); }
getAcceptArea
51,099
ContentResponse (@NotNull DockableContent content, RelativePoint point) { return isTerminalSessionContent(content) ? ContentResponse.ACCEPT_MOVE : ContentResponse.DENY; }
getContentResponse