Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
51,200
Future<String> (@NotNull Process process) { if (process.isAlive()) { return POOL.submit(() -> doGetCwd(process)); } return Futures.immediateFuture(null); }
getCurrentWorkingDirectory
51,201
String (int pid) { String procPath = "/proc/" + pid + "/cwd"; try { File dir = Paths.get(procPath).toRealPath().toFile(); if (dir.isDirectory()) { return dir.getAbsolutePath(); } } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot resolve cwd from " + procPath + ", fallback to lsof -a -d cwd -p " + pi...
tryGetCwdFastOnUnix
51,202
String (@NotNull List<String> stdoutLines, int pid) { boolean pidEncountered = false; for (String line : stdoutLines) { if (line.startsWith("p")) { int p = StringUtil.parseInt(line.substring(1), -1); pidEncountered |= p == pid; } else if (pidEncountered && line.startsWith("n")) { return line.substring(1); } } return nu...
parseWorkingDirectory
51,203
CommandHistoryFileInfo (@NotNull String filename, @NotNull String projectPath) { CommandHistoryFileInfo info = new CommandHistoryFileInfo(); info.myFilename = filename; info.myProjectPath = projectPath; info.myAccessTime = now(); return info; }
createFileInfo
51,204
long () { return System.currentTimeMillis(); }
now
51,205
void () { Path dir = PathManager.getConfigDir().resolve("terminal/history"); if (Files.isDirectory(dir)) { try { FileUtil.delete(dir); LOG.info("Old config/terminal/history/ deleted: " + dir); } catch (IOException e) { LOG.warn("Cannot delete old terminal/history/", e); } } Path parentDir = dir.getParent(); if (!Files....
deleteOldHistoryDir
51,206
void (@NotNull List<String> historyFileNamesToKeep, @NotNull Project project) { String projectPath = Objects.requireNonNull(project.getBasePath()); List<String> toRemove = new ArrayList<>(); for (CommandHistoryFileInfo info : myMap.values()) { if (projectPath.equals(info.myProjectPath) && !historyFileNamesToKeep.contai...
retainCommandHistoryFiles
51,207
void (@NotNull List<String> historyFileNamesToRemove, @NotNull String reason) { Path historyDir = historyFileNamesToRemove.isEmpty() ? null : getCommandHistoryDir(); if (historyDir == null) { return; } LOG.info("Deleting " + historyFileNamesToRemove + " (" + reason + ")"); for (String historyFileName : historyFileNames...
deleteHistoryFiles
51,208
void (@NotNull State state) { myMap.clear(); for (CommandHistoryFileInfo info : state.myHistoryFileInfoList) { myMap.put(info.myFilename, info); } }
loadState
51,209
TerminalCommandHistoryManager () { if (PRUNE_SCHEDULED.compareAndSet(false, true)) { JobScheduler.getScheduler().schedule(() -> pruneOutdated(), 4, TimeUnit.MINUTES); } return ApplicationManager.getApplication().getService(TerminalCommandHistoryManager.class); }
getInstance
51,210
void () { Path historyDir = getCommandHistoryDir(); if (historyDir != null) { try (Stream<Path> s = Files.list(historyDir)) { getInstance().doPruneOutdated(s.collect(Collectors.toList())); } catch (IOException e) { LOG.warn("Cannot list files in " + historyDir, e); } } }
pruneOutdated
51,211
void (@NotNull List<Path> existingHistoryFiles) { Set<String> existingHistoryFilenames = ContainerUtil.map2Set(existingHistoryFiles, TerminalCommandHistoryManager::getFilename); long allowed = now() - TimeUnit.DAYS.toMillis(30); List<String> toRemove = new ArrayList<>(); for (CommandHistoryFileInfo info : myMap.values(...
doPruneOutdated
51,212
String (@NotNull Path path) { return PathUtil.getFileName(path.toString()); }
getFilename
51,213
TerminalWidget () { return myTerminalWidget; }
getTerminalWidget
51,214
Content () { return myContent; }
getContent
51,215
void () { myForceHideUiWhenSessionEnds = true; TtyConnector connector = myTerminalWidget.getTtyConnector(); if (connector != null && connector.isConnected()) { connector.close(); } else { // When "Close session when it ends" is off, terminal session is shown even with terminated process. processSessionCompleted(); } }
closeAndHide
51,216
TerminalWrapperPanel () { if (myWrapperPanel == null) { myWrapperPanel = new TerminalWrapperPanel(this); } return myWrapperPanel; }
getWrapperPanel
51,217
void (boolean vertically, @NotNull TerminalWidget newTerminalWidget) { boolean hasFocus = myTerminalWidget.hasFocus(); TerminalWrapperPanel newParent = getWrapperPanel(); myWrapperPanel = new TerminalWrapperPanel(this); TerminalContainer newContainer = new TerminalContainer(myProject, myContent, newTerminalWidget, myTe...
split
51,218
Splitter (boolean vertically, @NotNull JComponent firstComponent, @NotNull JComponent secondComponent) { Splitter splitter = new OnePixelSplitter(vertically, 0.5f, 0.1f, 0.9f); splitter.setDividerWidth(JBUI.scale(1)); EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); Color color = scheme....
createSplitter
51,219
void () { TerminalWrapperPanel thisPanel = getWrapperPanel(); if (thisPanel.getParent() instanceof Splitter splitter) { TerminalWidget nextToFocus = myTerminalWidget.hasFocus() ? getNextSplitTerminal(true) : null; TerminalWrapperPanel parent = getSplitterParent(splitter); TerminalWrapperPanel otherPanel = splitter.getF...
processSessionCompleted
51,220
void () { myTerminalToolWindowManager.unregister(this); }
cleanup
51,221
void () { if (myForceHideUiWhenSessionEnds || TerminalOptionsProvider.getInstance().getCloseSessionOnLogout()) { myTerminalToolWindowManager.closeTab(myContent); } else { String text = getSessionCompletedMessage(myTerminalWidget); myTerminalWidget.writePlainMessage("\n" + text + "\n"); myTerminalWidget.setCursorVisible...
processSingleTerminalCompleted
51,222
boolean () { return getParentSplitter(myWrapperPanel) != null; }
isSplitTerminal
51,223
List<TerminalWidget> () { Splitter rootSplitter = findRootSplitter(); if (rootSplitter == null) { return List.of(myTerminalWidget); } List<TerminalWidget> terminals = new ArrayList<>(); traverseSplitters(rootSplitter, terminals); return terminals; }
listTerminals
51,224
void (@NotNull Splitter splitter, @NotNull List<TerminalWidget> terminals) { traverseWrapperPanel((TerminalWrapperPanel)splitter.getFirstComponent(), terminals); traverseWrapperPanel((TerminalWrapperPanel)splitter.getSecondComponent(), terminals); }
traverseSplitters
51,225
void (@NotNull TerminalWrapperPanel panel, @NotNull List<TerminalWidget> terminals) { Object child = panel.validateAndGetChild(); if (child instanceof Splitter splitter) { traverseSplitters(splitter, terminals); } else { terminals.add(((TerminalContainer)child).myTerminalWidget); } }
traverseWrapperPanel
51,226
TerminalWrapperPanel (@NotNull Splitter splitter) { return (TerminalWrapperPanel)splitter.getParent(); }
getSplitterParent
51,227
void (@NotNull TerminalContainer terminal) { if (myTerminal != null) { throw new IllegalStateException("Cannot set a new terminal when another terminal is still set"); } myTerminal = terminal; myTerminal.myWrapperPanel = this; setChildComponent(terminal.myTerminalWidget.getComponent()); }
setChildTerminal
51,228
void (@NotNull Splitter splitter) { myTerminal = null; setChildComponent(splitter); }
setChildSplitter
51,229
void (@NotNull Component childComponent) { Container parent = childComponent.getParent(); if (parent != null) { parent.remove(childComponent); } removeAll(); add(childComponent, BorderLayout.CENTER); revalidate(); }
setChildComponent
51,230
void (@NotNull TerminalWrapperPanel other) { Object childObj = other.validateAndGetChild(); if (childObj instanceof TerminalContainer otherTerminal) { setChildTerminal(otherTerminal); } else { setChildSplitter((Splitter)childObj); } }
transferChildFrom
51,231
TerminalHandlerBase (@NotNull String presentableName, @NotNull Project project, @NotNull InputStream terminalOutput, @NotNull OutputStream terminalInput) { return new TerminalHandlerImpl(presentableName, project, terminalOutput, terminalInput); }
createTerminal
51,232
boolean () { return true; }
isTtySupported
51,233
JComponent () { return myTerminalWidget.getComponent(); }
getComponent
51,234
JComponent () { return myTerminalWidget.getPreferredFocusableComponent(); }
getPreferredFocusableComponent
51,235
void () { myTerminalWidget.setCursorVisible(false); Objects.requireNonNull(myTerminalWidget.getTtyConnector()).close(); super.close(); }
close
51,236
boolean () { return false; }
isTerminalSessionPersistent
51,237
TtyConnector (@NotNull CloudTerminalProcess process) { return new ProcessTtyConnector(process, StandardCharsets.UTF_8) { @Override public void resize(@NotNull TermSize termSize) { if (myTtyResizeHandler != null) { myTtyResizeHandler.onTtyResizeRequest(termSize.getColumns(), termSize.getRows()); } } @Override public Str...
createTtyConnector
51,238
void (@NotNull TermSize termSize) { if (myTtyResizeHandler != null) { myTtyResizeHandler.onTtyResizeRequest(termSize.getColumns(), termSize.getRows()); } }
resize
51,239
String () { return "Connector: " + myPipeName; }
getName
51,240
boolean () { return true; }
isConnected
51,241
String () { return "Cloud terminal"; }
getDefaultTabTitle
51,242
OutputStream () { return myOutputStream; }
getOutputStream
51,243
InputStream () { return myInputStream; }
getInputStream
51,244
InputStream () { return null; }
getErrorStream
51,245
int () { return 0; }
exitValue
51,246
void () { mySemaphore.up(); }
destroy
51,247
String () { return "Terminal Session"; }
getName
51,248
String () { return getName() + " Fake File Type"; //NON-NLS }
getDescription
51,249
Icon () { return TerminalIcons.OpenTerminal_13x13; }
getIcon
51,250
boolean (@NotNull VirtualFile file) { return file instanceof TerminalSessionVirtualFileImpl; }
isMyFileType
51,251
void (@NotNull TerminalTitle terminalTitle) { try { terminalFile.rename(null, terminalTitle.buildTitle()); } catch (IOException exception) { throw new RuntimeException("Cannot rename"); } FileEditorManager.getInstance(project).updateFilePresentation(terminalFile); }
onTitleChanged
51,252
JComponent () { return myFile.getTerminalWidget().getComponent(); }
getComponent
51,253
JComponent () { return myFile.getTerminalWidget().getPreferredFocusableComponent(); }
getPreferredFocusedComponent
51,254
String () { return myFile.getName(); }
getName
51,255
void (@NotNull FileEditorState state) { }
setState
51,256
boolean () { return false; }
isModified
51,257
boolean () { return true; }
isValid
51,258
void (@NotNull PropertyChangeListener listener) { }
addPropertyChangeListener
51,259
void (@NotNull PropertyChangeListener listener) { }
removePropertyChangeListener
51,260
VirtualFile () { return myFile; }
getFile
51,261
void () { JBTerminalWidget termWidget = JBTerminalWidget.asJediTermWidget(myFile.getTerminalWidget()); if (termWidget != null) { termWidget.removeListener(myListener); } if (Boolean.TRUE.equals(myFile.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN))) { ApplicationManager.getApplication().invokeLater(() -> { boolea...
dispose
51,262
TerminalWidget () { return myTerminalWidget; }
getTerminalWidget
51,263
SettingsProvider () { return mySettingsProvider; }
getSettingsProvider
51,264
boolean (@NotNull Project project, @NotNull VirtualFile file) { return file instanceof TerminalSessionVirtualFileImpl; }
accept
51,265
boolean () { return false; }
acceptRequiresReadAction
51,266
FileEditor (@NotNull Project project, @NotNull VirtualFile file) { TerminalSessionVirtualFileImpl terminalFile = (TerminalSessionVirtualFileImpl)file; if (file.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN) != null) { return new TerminalSessionEditor(project, terminalFile); } else { TerminalWidget widget = termin...
createEditor
51,267
String () { return "terminal-session-editor"; }
getEditorTypeId
51,268
FileEditorPolicy () { return FileEditorPolicy.HIDE_DEFAULT_EDITOR; }
getPolicy
51,269
void () { super.setUp(); myFixture.setTestDataPath(DEBUGGER_TESTDATA_PATH_BASE); }
setUp
51,270
LightProjectDescriptor () { return KotlinWithJdkAndRuntimeLightProjectDescriptor.getInstance(); }
getProjectDescriptor
51,271
KotlinPositionManager (@NotNull DebugProcess process) { KotlinPositionManager positionManager = (KotlinPositionManager) new KotlinPositionManagerFactory().createPositionManager(process); assertNotNull(positionManager); return positionManager; }
createPositionManager
51,272
void (@NotNull String fileName) { String path = getPath(fileName); if (fileName.endsWith(".kt")) { myFixture.configureByFile(path); } else { SequencesKt.forEach(FilesKt.walkTopDown(new File(path)), file -> { String fileName1 = file.getName(); String path1 = getPath(fileName1); myFixture.configureByFile(path1); return n...
doTest
51,273
String (@NotNull String fileName) { String path; try { path = new File(fileName).getCanonicalPath(); } catch (IOException e) { throw new RuntimeException(e); } return StringsKt.substringAfter(path, DEBUGGER_TESTDATA_PATH_BASE, path); }
getPath
51,274
void () { Project project = getProject(); List<KtFile> files = new ArrayList<>(KotlinLightCodeInsightFixtureTestCaseKt.allKotlinFiles(project)); if (files.isEmpty()) return; List<Breakpoint> breakpoints = Lists.newArrayList(); for (KtFile file : files) { breakpoints.addAll(extractBreakpointsInfo(file, file.getText()));...
performTest
51,275
GenerationState (List<KtFile> files, CompilerConfiguration configuration) { return GenerationUtils.compileFiles(files, configuration, ClassBuilderFactories.TEST, scope -> PackagePartProvider.Empty.INSTANCE); }
getCompileFiles
51,276
void () { RunAll.runAll( () -> { if (debugProcess != null) { debugProcess.stop(true); } }, () -> { if (debugProcess != null) { debugProcess.dispose(); debugProcess = null; } }, () -> super.tearDown() ); }
tearDown
51,277
Collection<Breakpoint> (KtFile file, String fileContent) { Collection<Breakpoint> breakpoints = Lists.newArrayList(); String[] lines = StringUtil.convertLineSeparators(fileContent).split("\n"); for (int i = 0; i < lines.length; i++) { Matcher matcher = BREAKPOINT_PATTERN.matcher(lines[i]); if (matcher.matches()) { brea...
extractBreakpointsInfo
51,278
DebugProcessEvents (Map<String, ReferenceType> referencesByName) { return new DebugProcessEvents(getProject()) { private VirtualMachineProxyImpl virtualMachineProxy; @NotNull @Override public VirtualMachineProxyImpl getVirtualMachineProxy() { if (virtualMachineProxy == null) { virtualMachineProxy = new MockVirtualMachi...
createDebugProcess
51,279
VirtualMachineProxyImpl () { if (virtualMachineProxy == null) { virtualMachineProxy = new MockVirtualMachineProxy(this, referencesByName); } return virtualMachineProxy; }
getVirtualMachineProxy
51,280
GlobalSearchScope () { return GlobalSearchScope.allScope(getProject()); }
getSearchScope
51,281
List<ReferenceType> () { return new ArrayList<>(referencesByName.values()); }
allClasses
51,282
List<ReferenceType> (@NotNull String name) { return CollectionsKt.listOfNotNull(referencesByName.get(name)); }
classesByName
51,283
void (List<? extends T> children, boolean last) { myChildren.addAll(children); if (last) myFinished.release(); }
addChildren
51,284
void (int remaining) { myFinished.release(); }
tooManyChildren
51,285
void (@NotNull String message, Icon icon, @NotNull final SimpleTextAttributes attributes, @Nullable XDebuggerTreeNodeHyperlink link) { }
setMessage
51,286
void (@NotNull String message, @Nullable XDebuggerTreeNodeHyperlink link) { setErrorMessage(message); }
setErrorMessage
51,287
void (@NotNull String errorMessage) { myErrorMessage = errorMessage; myFinished.release(); }
setErrorMessage
51,288
void (@NotNull XValueChildrenList children, boolean last) { final List<XValue> list = new ArrayList<>(); for (int i = 0; i < children.size(); i++) { list.add(children.getValue(i)); } addChildren(list, last); }
addChildren
51,289
void (boolean alreadySorted) { }
setAlreadySorted
51,290
List<XStackFrame> (@NotNull XExecutionStack thread) { return collectFrames(thread, TIMEOUT_MS * 2); }
collectFrames
51,291
List<XStackFrame> (XExecutionStack thread, long timeout) { return collectFrames(thread, timeout, XDebuggerTestUtil::waitFor); }
collectFrames
51,292
List<XStackFrame> (XExecutionStack thread, long timeout, BiFunction<Semaphore, Long, Boolean> waitFunction) { return collectFramesWithError(thread, timeout, waitFunction).first; }
collectFrames
51,293
String (XStackFrame frame) { TextTransferable.ColoredStringBuilder builder = new TextTransferable.ColoredStringBuilder(); frame.customizePresentation(builder); return builder.getBuilder().toString(); }
getFramePresentation
51,294
boolean (Semaphore semaphore, long timeoutInMillis) { long end = System.currentTimeMillis() + timeoutInMillis; long remaining = timeoutInMillis; do { try { return semaphore.tryAcquire(remaining, TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { remaining = end - System.currentTimeMillis(); } } while (rem...
waitFor
51,295
void (@NotNull List<? extends XStackFrame> stackFrames, boolean last) { addChildren(stackFrames, last); }
addStackFrames
51,296
void (@NotNull List<? extends XStackFrame> stackFrames, @Nullable XStackFrame toSelect, boolean last) { if (toSelect != null) frameToSelect = toSelect; addChildren(stackFrames, last); }
addStackFrames
51,297
void (@NotNull String errorMessage) { setErrorMessage(errorMessage); }
errorOccurred
51,298
List<XValue> (XValueContainer value) { return collectChildren(value, XDebuggerTestUtil::waitFor); }
collectChildren
51,299
List<XValue> (XValueContainer value, BiFunction<Semaphore, Long, Boolean> waitFunction) { final Pair<List<XValue>, String> childrenWithError = collectChildrenWithError(value, waitFunction); final String error = childrenWithError.second; assertNull("Error getting children: " + error, error); return childrenWithError.fir...
collectChildren