Java Code Examples for com.intellij.openapi.util.io.FileUtil#PATH_HASHING_STRATEGY
The following examples show how to use
com.intellij.openapi.util.io.FileUtil#PATH_HASHING_STRATEGY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArtifactCompilerUtil.java From consulo with Apache License 2.0 | 8 votes |
public static MultiMap<String, Artifact> createOutputToArtifactMap(final Project project) { final MultiMap<String, Artifact> result = new MultiMap<String, Artifact>() { @Nonnull @Override protected Map<String, Collection<Artifact>> createMap() { return new THashMap<String, Collection<Artifact>>(FileUtil.PATH_HASHING_STRATEGY); } }; AccessRule.read(() -> { for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) { String outputPath = artifact.getOutputFilePath(); if (!StringUtil.isEmpty(outputPath)) { result.putValue(outputPath, artifact); } } }); return result; }
Example 2
Source File: Win32FsCache.java From consulo with Apache License 2.0 | 6 votes |
@Nonnull String[] list(@Nonnull VirtualFile file) { String path = file.getPath(); FileInfo[] fileInfo = myKernel.listChildren(path); if (fileInfo == null || fileInfo.length == 0) { return ArrayUtil.EMPTY_STRING_ARRAY; } String[] names = new String[fileInfo.length]; TIntObjectHashMap<THashMap<String, FileAttributes>> map = getMap(); int parentId = ((VirtualFileWithId)file).getId(); THashMap<String, FileAttributes> nestedMap = map.get(parentId); if (nestedMap == null) { nestedMap = new THashMap<String, FileAttributes>(fileInfo.length, FileUtil.PATH_HASHING_STRATEGY); map.put(parentId, nestedMap); } for (int i = 0, length = fileInfo.length; i < length; i++) { FileInfo info = fileInfo[i]; String name = info.getName(); nestedMap.put(name, info.toFileAttributes()); names[i] = name; } return names; }
Example 3
Source File: Win32FsCache.java From consulo with Apache License 2.0 | 6 votes |
@Nullable FileAttributes getAttributes(@Nonnull VirtualFile file) { VirtualFile parent = file.getParent(); int parentId = parent instanceof VirtualFileWithId ? ((VirtualFileWithId)parent).getId() : -((VirtualFileWithId)file).getId(); TIntObjectHashMap<THashMap<String, FileAttributes>> map = getMap(); THashMap<String, FileAttributes> nestedMap = map.get(parentId); String name = file.getName(); FileAttributes attributes = nestedMap != null ? nestedMap.get(name) : null; if (attributes == null) { if (nestedMap != null && !(nestedMap instanceof IncompleteChildrenMap)) { return null; // our info from parent doesn't mention the child in this refresh session } FileInfo info = myKernel.getInfo(file.getPath()); if (info == null) { return null; } attributes = info.toFileAttributes(); if (nestedMap == null) { nestedMap = new IncompleteChildrenMap<>(FileUtil.PATH_HASHING_STRATEGY); map.put(parentId, nestedMap); } nestedMap.put(name, attributes); } return attributes; }
Example 4
Source File: ArtifactsCompilerInstance.java From consulo with Apache License 2.0 | 4 votes |
private static THashSet<String> createPathsHashSet() { return new THashSet<String>(FileUtil.PATH_HASHING_STRATEGY); }