Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
288,500
Path () { Path path = getFileSystem().getNioPath(this); if (path == null) { throw new UnsupportedOperationException("Failed to map " + this + " (filesystem " + getFileSystem() + ") into nio Path"); } return path; }
toNioPath
288,501
String () { return VirtualFileManager.constructUrl(getFileSystem().getProtocol(), getPath()); }
getUrl
288,502
boolean (@NotNull VFileProperty property) { return false; }
is
288,503
FileType () { return FileTypeRegistry.getInstance().getFileTypeByFile(this); }
getFileType
288,504
Charset () { Charset charset = getStoredCharset(); if (charset == null) { charset = EncodingRegistry.getInstance().getDefaultCharset(); setCharset(charset); } return charset; }
getCharset
288,505
void (Charset charset) { putUserData(CHARSET_KEY, charset); }
storeCharset
288,506
void (final Charset charset) { setCharset(charset, null); }
setCharset
288,507
void (final Charset charset, @Nullable Runnable whenChanged) { setCharset(charset, whenChanged, true); }
setCharset
288,508
void (final Charset charset, @Nullable Runnable whenChanged, boolean fireEventsWhenChanged) { final Charset old = getStoredCharset(); storeCharset(charset); if (Comparing.equal(charset, old)) return; byte[] bom = charset == null ? null : CharsetToolkit.getMandatoryBom(charset); byte[] existingBOM = getBOM(); if (bom == null && charset != null && existingBOM != null) { bom = CharsetToolkit.canHaveBom(charset, existingBOM) ? existingBOM : null; } setBOM(bom); if (old != null) { //do not send on detect if (whenChanged != null) whenChanged.run(); if (fireEventsWhenChanged) { VirtualFileManager.getInstance().notifyPropertyChanged(this, PROP_ENCODING, old, charset); } } }
setCharset
288,509
boolean () { return getStoredCharset() != null; }
isCharsetSet
288,510
long () { throw new UnsupportedOperationException(getClass().getName()); }
getModificationStamp
288,511
void (boolean asynchronous, boolean recursive) { refresh(asynchronous, recursive, null); }
refresh
288,512
long () { return isValid() ? getTimeStamp() : -1; }
getModificationCount
288,513
boolean (@NotNull @NonNls String name) { return Comparing.equal(getNameSequence(), name); }
nameEquals
288,514
void (byte @Nullable [] BOM) { putUserData(BOM_KEY, BOM); }
setBOM
288,515
String () { return "VirtualFile: " + getPresentableUrl(); }
toString
288,516
boolean () { return isValid(); }
exists
288,517
boolean () { return false; }
isInLocalFileSystem
288,518
void (@Nullable String separator) { putUserData(DETECTED_LINE_SEPARATOR_KEY, separator); }
setDetectedLineSeparator
288,519
boolean () { if (!is(VFileProperty.SYMLINK)) return false; VirtualFile resolved = getCanonicalFile(); // invalid symlink if (resolved == null) return false; // if it's recursive if (VfsUtilCore.isAncestor(resolved, this, false)) return true; // check if it's circular - any symlink above resolves to my target too for (VirtualFile p = getParent(); p != null ; p = p.getParent()) { if (p.is(VFileProperty.SYMLINK)) { VirtualFile parentResolved = p.getCanonicalFile(); if (resolved.equals(parentResolved)) return true; } } return false; }
isRecursiveOrCircularSymlink
288,520
boolean () { return getFileSystem().isCaseSensitive(); }
isCaseSensitive
288,521
boolean (@NotNull VirtualFile ancestor, @NotNull VirtualFile file, boolean strict) { if (!file.getFileSystem().equals(ancestor.getFileSystem())) return false; VirtualFile parent = strict ? file.getParent() : file; while (true) { if (parent == null) return false; if (parent.equals(ancestor)) return true; parent = parent.getParent(); } }
isAncestor
288,522
boolean (@NotNull VirtualFile file, @Nullable Set<? extends VirtualFile> roots) { return isUnderFiles(file, roots); }
isUnder
288,523
boolean (@NotNull VirtualFile file, @Nullable Collection<? extends VirtualFile> roots) { if (roots == null || roots.isEmpty()) return false; VirtualFile parent = file; while (parent != null) { if (roots.contains(parent)) { return true; } parent = parent.getParent(); } return false; }
isUnderFiles
288,524
boolean (@NotNull @NonNls String url, @Nullable @NonNls Collection<String> rootUrls) { if (rootUrls == null || rootUrls.isEmpty()) return false; for (String excludesUrl : rootUrls) { if (isEqualOrAncestor(excludesUrl, url)) { return true; } } return false; }
isUnder
288,525
boolean (@NotNull @NonNls String ancestorUrl, @NotNull @NonNls String fileUrl) { if (ancestorUrl.equals(fileUrl)) return true; if (StringUtil.endsWithChar(ancestorUrl, '/')) { return fileUrl.startsWith(ancestorUrl); } return StringUtil.startsWithConcatenation(fileUrl, ancestorUrl, "/"); }
isEqualOrAncestor
288,526
boolean (@NotNull File ancestor, @NotNull File file, boolean strict) { return FileUtil.isAncestor(ancestor, file, strict); }
isAncestor
288,527
boolean (@NotNull VirtualFile root, @Nullable VirtualFileFilter filter, @NotNull ContentIterator iterator) { return iterateChildrenRecursively(root, filter, iterator, new VirtualFileVisitor.Option[0]); }
iterateChildrenRecursively
288,528
boolean (@NotNull VirtualFile root, @Nullable VirtualFileFilter filter, @NotNull ContentIterator iterator, VirtualFileVisitor.Option @NotNull ... options) { VirtualFileVisitor.Result result = visitChildrenRecursively(root, new VirtualFileVisitor<Void>(options) { @Override public @NotNull Result visitFileEx(@NotNull VirtualFile file) { if (filter != null && !filter.accept(file)) return SKIP_CHILDREN; if (!iterator.processFile(file)) return skipTo(root); return CONTINUE; } }); return !Comparing.equal(result.skipToParent, root); }
iterateChildrenRecursively
288,529
Result (@NotNull VirtualFile file) { if (filter != null && !filter.accept(file)) return SKIP_CHILDREN; if (!iterator.processFile(file)) return skipTo(root); return CONTINUE; }
visitFileEx
288,530
boolean (@NotNull VirtualFile file) { return file.is(VFileProperty.SYMLINK) && file.getCanonicalPath() == null; }
isBrokenLink
288,531
boolean (@NotNull VirtualFile link) { VirtualFile target = link.getCanonicalFile(); return target == null || target.equals(link) || isAncestor(target, link, true); }
isInvalidLink
288,532
File (@NotNull VirtualFile file) { return new File(PathUtil.toPresentableUrl(file.getUrl())); }
virtualToIoFile
288,533
String (@NotNull String path) { return VirtualFileManager.constructUrl(URLUtil.FILE_PROTOCOL, FileUtil.toSystemIndependentName(path)); }
pathToUrl
288,534
String (@NotNull File file) { return pathToUrl(file.getPath()); }
fileToUrl
288,535
List<File> (@NotNull Collection<? extends VirtualFile> files) { return ContainerUtil.map(files, file -> virtualToIoFile(file)); }
virtualToIoFiles
288,536
String (@NotNull String url) { return toIdeaUrl(url, true); }
toIdeaUrl
288,537
String (@NotNull String url, boolean removeLocalhostPrefix) { int index = url.indexOf(":/"); if (index < 0 || index + 2 >= url.length()) { return url; } if (url.charAt(index + 2) != '/') { String prefix = url.substring(0, index); String suffix = url.substring(index + 2); if (SystemInfoRt.isWindows) { return prefix + URLUtil.SCHEME_SEPARATOR + suffix; } else if (removeLocalhostPrefix && prefix.equals(URLUtil.FILE_PROTOCOL) && suffix.startsWith(LOCALHOST_URI_PATH_PREFIX)) { // sometimes (e.g., in Google Chrome for Mac) local file url is prefixed with 'localhost' so we need to remove it return prefix + ":///" + suffix.substring(LOCALHOST_URI_PATH_PREFIX.length()); } else { return prefix + ":///" + suffix; } } if (SystemInfoRt.isWindows && index + 3 < url.length() && url.charAt(index + 3) == '/' && url.regionMatches(0, StandardFileSystems.FILE_PROTOCOL_PREFIX, 0, StandardFileSystems.FILE_PROTOCOL_PREFIX.length())) { // file:///C:/test/file.js -> file://C:/test/file.js for (int i = index + 4; i < url.length(); i++) { char c = url.charAt(i); if (c == '/') { break; } else if (c == ':') { return StandardFileSystems.FILE_PROTOCOL_PREFIX + url.substring(index + 4); } } return url; } return url; }
toIdeaUrl
288,538
String (@NotNull String url) { // removeLocalhostPrefix - false due to backward compatibility reasons return toIdeaUrl(url, false); }
fixURLforIDEA
288,539
String (@NotNull URL url) { String protocol = url.getProtocol(); String path = url.getPath(); if (protocol.equals(URLUtil.JAR_PROTOCOL)) { if (StringUtil.startsWithConcatenation(path, URLUtil.FILE_PROTOCOL, PROTOCOL_DELIMITER)) { try { URL subURL = new URL(path); path = subURL.getPath(); } catch (MalformedURLException e) { throw new RuntimeException(CoreBundle.message("url.parse.unhandled.exception"), e); } } else { throw new RuntimeException(new IOException(CoreBundle.message("url.parse.error", url.toExternalForm()))); } } if (SystemInfoRt.isWindows) { while (!path.isEmpty() && path.charAt(0) == '/') { path = path.substring(1); } } path = URLUtil.unescapePercentSequences(path); return protocol + "://" + path; }
convertFromUrl
288,540
boolean (@NotNull VirtualFile root, @NotNull Processor<? super VirtualFile> processor) { Ref<Boolean> result = new Ref<>(true); visitChildrenRecursively(root, new VirtualFileVisitor<Void>() { @Override public @NotNull Result visitFileEx(@NotNull VirtualFile file) { if (!processor.process(file)) { result.set(Boolean.FALSE); return skipTo(root); } return CONTINUE; } }); return result.get(); }
processFilesRecursively
288,541
Result (@NotNull VirtualFile file) { if (!processor.process(file)) { result.set(Boolean.FALSE); return skipTo(root); } return CONTINUE; }
visitFileEx
288,542
int (VirtualFile file) { int depth = 0; while (file != null) { depth++; file = file.getParent(); } return depth; }
depth
288,543
int (@Nullable VirtualFile v1, @Nullable VirtualFile v2) { if (!Objects.equals(v1, v2)) { if (v1 == null) { return -1; } if (v2 == null) { return 1; } VirtualFile[] parents1 = getPathComponents(v1); VirtualFile[] parents2 = getPathComponents(v2); for (int i = 0; i < Math.min(parents1.length, parents2.length); i++) { if (!parents1[i].equals(parents2[i])) { return parents1[i].getName().compareTo(parents2[i].getName()); } } return v1.getName().compareTo(v2.getName()); } return 0; }
compareByPath
288,544
boolean (@NotNull Iterable<? extends VirtualFile> files) { for (VirtualFile file : files) { if (!file.isValid()) { return true; } } return false; }
hasInvalidFiles
288,545
boolean (@NotNull VirtualFile file, @NotNull @SystemIndependent String path) { path = FileUtil.toCanonicalPath(path); int li = path.length(); while (file != null && li != -1) { int sepIndex = path.lastIndexOf('/', li - 1); CharSequence fileName = file.getNameSequence(); int fileNameEnd = fileName.length() + (StringUtil.endsWithChar(fileName, '/') ? -1 : 0); if (sepIndex == 6 && StringUtil.startsWith(fileName, "//wsl$")) { sepIndex = -1; } if (!CharArrayUtil.regionMatches(fileName, 0, fileNameEnd, path, sepIndex + 1, li, file.isCaseSensitive())) { return false; } file = file.getParent(); li = sepIndex; } return li == -1 && file == null; }
pathEqualsTo
288,546
List<VirtualFile> (@NotNull VirtualFile file) { List<VirtualFile> result = new ArrayList<>(); while (file != null) { result.add(file); file = file.getParent(); } return result; }
getHierarchy
288,547
boolean (@NotNull @SystemIndependent String ancestorPath, @NotNull VirtualFile file) { ancestorPath = FileUtil.toCanonicalPath(ancestorPath); if (ancestorPath.isEmpty()) { return true; } List<VirtualFile> hierarchy = getHierarchy(file); int i = 0; boolean result = false; int j; for (j = hierarchy.size() - 1; j >= 0; j--) { VirtualFile part = hierarchy.get(j); String name = part.getName(); boolean matches = part.isCaseSensitive() ? StringUtil.startsWith(ancestorPath, i, name) : StringUtilRt.startsWithIgnoreCase(ancestorPath, i, name); if (!matches) { break; } i += name.length(); if (!name.endsWith("/")) { if (i != ancestorPath.length() && ancestorPath.charAt(i) != '/') { break; } i++; } if (i >= ancestorPath.length()) { result = true; break; } } return result; }
isAncestorOrSelf
288,548
boolean (@NotNull VirtualFile ancestor, @NotNull VirtualFile virtualFile) { return VfsUtilCore.isAncestor(ancestor, virtualFile, false); }
isAncestor
288,549
VirtualFile (@NotNull VirtualFile file) { while (true) { VirtualFile parent = file.getParent(); if (parent == null) { break; } file = parent; } return file; }
getRootFile
288,550
VirtualFileSet () { return VIRTUAL_FILE_SET_FACTORY.getValue().createCompactVirtualFileSet(); }
createCompactVirtualFileSet
288,551
VirtualFileSet (@NotNull Collection<? extends VirtualFile> files) { return VIRTUAL_FILE_SET_FACTORY.getValue().createCompactVirtualFileSet(files); }
createCompactVirtualFileSet
288,552
boolean (@NotNull VirtualFile file) { return ObjectUtils.doIfCast(file.getFileSystem(), VersionManagingFileSystem.class, fs -> fs.getVersioningType(file)) == VersioningType.ENFORCED_NON_LOCAL; }
isEnforcedNonLocal
288,553
boolean (@NotNull VirtualFile file) { return ObjectUtils.doIfCast(file.getFileSystem(), VersionManagingFileSystem.class, fs -> fs.getVersioningType(file)) == VersioningType.DISABLED; }
isDisabled
288,554
ReadonlyStatusHandler (@NotNull Project project) { return project.getService(ReadonlyStatusHandler.class); }
getInstance
288,555
boolean (@NotNull Project project, VirtualFile @NotNull ... files) { return !getInstance(project).ensureFilesWritable(Arrays.asList(files)).hasReadonlyFiles(); }
ensureFilesWritable
288,556
boolean (@NotNull Project project, @NotNull Document document) { final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document); boolean okWritable; if (psiFile == null) { okWritable = document.isWritable(); } else { final VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile != null) { okWritable = ensureFilesWritable(project, virtualFile); } else { okWritable = psiFile.isWritable(); } } return okWritable; }
ensureDocumentWritable
288,557
OperationStatus (VirtualFile @NotNull ... files) { return ensureFilesWritable(Arrays.asList(files)); }
ensureFilesWritable
288,558
Option (int maxDepth) { return new Option.LimitOption(maxDepth); }
limit
288,559
String () { return "(" + (skipChildren ? "skip," + skipToParent : "continue") + ")"; }
toString
288,560
Result (@NotNull VirtualFile parentToSkipTo) { return new Result(true, parentToSkipTo); }
skipTo
288,561
boolean (@NotNull VirtualFile file) { return true; }
visitFile
288,562
Result (@NotNull VirtualFile file) { return visitFile(file) ? CONTINUE : SKIP_CHILDREN; }
visitFileEx
288,563
void (@NotNull VirtualFile file) { }
afterChildrenVisited
288,564
void (@Nullable T value) { myValue = value; if (myValueStack == null) { myValueStack = new Stack<>(); } }
setValueForChildren
288,565
T () { return myValue; }
getCurrentValue
288,566
boolean (@NotNull VirtualFile file) { if (!file.is(VFileProperty.SYMLINK)) { return true; } if (!myFollowSymLinks) { return false; } // ignoring invalid and recursive symbolic links - to avoid visiting files twice return !file.isRecursiveOrCircularSymlink(); }
allowVisitChildren
288,567
boolean () { return myDepthLimit >= 0 && myLevel >= myDepthLimit; }
depthLimitReached
288,568
void () { ++myLevel; if (myValueStack != null) { myValueStack.push(myValue); } }
saveValue
288,569
void (boolean pushed) { if (pushed) { --myLevel; if (myValueStack != null && !myValueStack.isEmpty()) { myValueStack.pop(); } } if (myValueStack != null) { myValue = myValueStack.isEmpty() ? null : myValueStack.peek(); } }
restoreValue
288,570
VirtualFileManager () { return ourInstance.get(); }
getInstance
288,571
long () { return asyncRefresh(null); }
asyncRefresh
288,572
String (@NotNull String protocol, @NotNull String path) { return protocol + URLUtil.SCHEME_SEPARATOR + path; }
constructUrl
288,573
String (@NotNull String url) { return URLUtil.extractPath(url); }
extractPath
288,574
VirtualFile (int id) { return null; }
findFileById
288,575
int[] (int id) { return ArrayUtil.EMPTY_INT_ARRAY; }
listAllChildIds
288,576
HttpFileSystem () { return (HttpFileSystem)VirtualFileManager.getInstance().getFileSystem(URLUtil.HTTP_PROTOCOL); }
getInstance
288,577
EncodingRegistry () { return EncodingManager.getInstance(); }
getInstance
288,578
EncodingProjectManager (@NotNull Project project) { return project.getService(EncodingProjectManager.class); }
getInstance
288,579
EncodingManager () { return ApplicationManager.getApplication().getService(EncodingManager.class); }
getInstance
288,580
void (@NotNull String name) { throw new UnsupportedOperationException("Not implemented"); }
setDefaultCharsetName
288,581
boolean () { return false; }
shouldAddBOMForNewUtf8File
288,582
String () { return VirtualFileManager.getInstance().getVFileName(myChildNameId).toString(); }
getChildName
288,583
boolean () { return myDirectory; }
isDirectory
288,584
VirtualFile () { return myParent; }
getParent
288,585
boolean () { return isDirectory() && myChildren != null && myChildren.length == 0; }
isEmptyDirectory
288,586
String () { String parentPath = myParent.getPath(); // jar file returns "x.jar!/" return StringUtil.endsWithChar(parentPath, '/') ? parentPath + getChildName() : parentPath + "/" + getChildName(); }
computePath
288,587
VirtualFile () { VirtualFile createdFile = myCreatedFile; if (createdFile == null && myParent.isValid()) { myCreatedFile = createdFile = myParent.findChild(getChildName()); } return createdFile; }
getFile
288,588
void () { myCreatedFile = null; }
resetCache
288,589
VirtualFileSystem () { return myParent.getFileSystem(); }
getFileSystem
288,590
boolean () { return myParent.isValid() && myParent.findChild(getChildName()) == null; }
isValid
288,591
boolean (final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final VFileCreateEvent event = (VFileCreateEvent)o; return myDirectory == event.myDirectory && getChildName().equals(event.getChildName()) && myParent.equals(event.myParent); }
equals
288,592
int () { int result = myParent.hashCode(); result = 31 * result + (myDirectory ? 1 : 0); result = 31 * result + getChildName().hashCode(); return result; }
hashCode
288,593
String () { String kind = myDirectory ? (isEmptyDirectory() ? "(empty) " : "") + "dir " : "file "; return "VfsEvent[create " + kind + "'"+myParent.getUrl() + "/"+ getChildName() +"']" + (myChildren == null ? "" : " with "+myChildren.length+" children"); }
toString
288,594
int () { return myChildNameId; }
getChildNameId
288,595
VirtualFile () { return myFile; }
getFile
288,596
long () { return myNewModificationStamp; }
getModificationStamp
288,597
long () { return myOldModificationStamp; }
getOldModificationStamp
288,598
long () { return myOldTimestamp; }
getOldTimestamp
288,599
long () { return myNewTimestamp; }
getNewTimestamp