public void fixFolder(CharSequence path){ if (path != null) { projectRoots.put(FilePathCache.getManager().getString(path), Integer.MAX_VALUE / 2); } }
public static List<CharSequence> asList(Collection<? extends CharSequence> paths) { List<CharSequence> out = new ArrayList<CharSequence>(paths.size()); for (CharSequence path : paths) { out.add(FilePathCache.getManager().getString(path)); } return out; }
private void addPath(CharSequence path) { CharSequence parent = findParent(path); if (parent != null) { path = parent; } CharSequence added = FilePathCache.getManager().getString(path); Integer integer = projectRoots.get(added); if (integer == null) { projectRoots.put(added, 1); } else { projectRoots.put(added, integer + 1); } }
private CharSequence getCanonicalKey(CharSequence fileKey) { try { CharSequence res = CndFileSystemProvider.getCanonicalPath(fileSystem, fileKey); res = FilePathCache.getManager().getString(res); if (fileKey.equals(res)) { return fileKey; } return res; } catch (IOException e) { // skip exception return fileKey; } }
private static CharSequence getCanonicalKey(FileObject fileObject, CharSequence fileKey) { try { CharSequence res = CndFileUtils.getCanonicalPath(fileObject); res = FilePathCache.getManager().getString(res); if (fileKey.equals(res)) { return fileKey; } return res; } catch (IOException e) { // skip exception return fileKey; } }
public StartEntry(FileSystem fs, String startFile, Key startFileProject) { Parameters.notNull("startFileProject", startFileProject); //NOI18N this.fileSystem = fs; this.startFile = FilePathCache.getManager().getString(startFile); this.startFileProject = startFileProject; }
private LibProjectImpl(ModelImpl model, FileSystem fs, CharSequence includePathName, int sourceUnitId) { super(model, fs, includePathName, includePathName, sourceUnitId); this.includePath = FilePathCache.getManager().getString(includePathName); this.projectRoots.fixFolder(includePathName); assert this.includePath != null; }
FileBufferImpl(FileSystem fileSystem, CharSequence absPath, FileImpl fileImpl) { this.absPath = FilePathCache.getManager().getString(absPath); this.fileSystem = fileSystem; this.fileImpl = fileImpl; this.bufType = (fileImpl.getFileType() == FileImpl.FileType.HEADER_FILE) ? APTFileBuffer.BufferType.INCLUDED : APTFileBuffer.BufferType.START_FILE; }
/*package*/static void invalidateFileBasedCache(String file) { final CharSequence key = FilePathCache.getManager().getString(file); Map<CharSequence, IncludeDirEntry> delegate = storage.getDelegate(key); synchronized (delegate) { IncludeDirEntry prev = delegate.remove(key); if (prev != null) { prev.invalidateDirExistence(); } } ResolverResultsCache.clearCache(); }
/*package*/ static void readStringToFileEntryMap( FileSystem fs, int unitIndex, RepositoryDataInput input, Map<CharSequence, FileEntry> aMap) throws IOException { assert input != null; assert aMap != null; final APTStringManager pathManager = FilePathCache.getManager(); aMap.clear(); final int size = input.readInt(); for (int i = 0; i < size; i++) { CharSequence key = PersistentUtils.readFileNameIndex(input, pathManager, unitIndex); FileEntry value = new FileEntry(fs, input, unitIndex); assert key != null; assert value != null; aMap.put(key, value); } }
public StartEntry(FileSystem fs, RepositoryDataInput input, int unitIndex) throws IOException { assert input != null; fileSystem = fs; startFileProject = KeyFactory.getDefaultFactory().readKey(input); startFile = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitIndex); }
public LibProjectImpl(RepositoryDataInput aStream) throws IOException { super(aStream); this.includePath = APTSerializeUtils.readFileNameIndex(aStream, FilePathCache.getManager(), getUnitId()); assert this.includePath != null; setPlatformProject(this.includePath); } }
public static CharSequence getFileKey(CharSequence file, boolean sharedText) { return sharedText ? FilePathCache.getManager().getString(file) : DefaultCache.getManager().getString(file); }
protected AbstractFileBuffer(RepositoryDataInput input, int unitId) throws IOException { this.absPath = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitId); this.fileSystem = PersistentUtils.readFileSystem(input); assert this.absPath != null; fileObject = new WeakReference<>(null); bufType = BufferType.values()[input.readByte()]; }
protected AbstractFileBuffer(FileObject fileObject) { this.absPath = FilePathCache.getManager().getString(CndFileUtils.normalizePath(fileObject)); assert this.absPath != null : "no path for " + fileObject; this.fileSystem = getFileSystem(fileObject); this.fileObject = new WeakReference<>(fileObject); this.bufType = MIMENames.isCppOrCOrFortran(fileObject.getMIMEType()) ? APTFileBuffer.BufferType.START_FILE : APTFileBuffer.BufferType.INCLUDED; // remote link file objects are just lightweight delegating wrappers, so they have multiple instances // if (CndUtils.isDebugMode()) { // FileObject fo2 = fileSystem.findResource(absPath.toString()); // CndUtils.assertTrue(fileObject == fo2, "File objects differ: " + fileObject + " vs " + fo2); //NOI18N // } }
/** Creates a new instance of APTFileNode */ public APTFileNode(FileSystem fileSystem, CharSequence path) { Parameters.notNull("null fileSystem", fileSystem); //NOI18N this.fileSystem = fileSystem; this.path = FilePathCache.getManager().getString(path); this.guard = TextCache.getManager().getString(guard); tokenized = true; }
public IncludeInfoImpl(final RepositoryDataInput input, int unitIndex) throws IOException { assert input != null; this.path = APTSerializeUtils.readFileNameIndex(input, FilePathCache.getManager(), unitIndex); directiveLine = input.readInt(); directiveOffset = input.readInt(); resolvedDirIndex = input.readInt(); }
public static ResolvedPath resolveAbsFilePath(FileSystem fs, String absFile) { if (APTTraceFlags.APT_ABSOLUTE_INCLUDES) { if (CndPathUtilities.isPathAbsolute(absFile) && isExistingFile(fs, absFile) ) { absFile = normalize(fs, absFile); String parent = CndPathUtilities.getDirName(absFile); return new ResolvedPath(fs, FilePathCache.getManager().getString(parent), absFile, false, 0); } } return null; }
/** * finds file relatively to the baseFile * caller must check that resolved path is not the same as base file * to prevent recursive inclusions */ public static ResolvedPath resolveFilePath(FileSystem fs, String inclString, CharSequence baseFile) { if (baseFile != null) { String folder = CndPathUtilities.getDirName(baseFile.toString()); String absolutePath = folder + CndFileUtils.getFileSeparatorChar(fs) + inclString; if (isExistingFile(fs, absolutePath)) { absolutePath = normalize(fs, absolutePath); folder = normalize(fs, folder); return new ResolvedPath(fs, FilePathCache.getManager().getString(folder), absolutePath, true, 0); } } return null; }
private void cleanCaches() { TextCache.getManager().dispose(); FilePathCache.getManager().dispose(); QualifiedNameCache.getManager().dispose(); NameCache.getManager().dispose(); UniqueNameCache.getManager().dispose(); FileNameCache.getManager().dispose(); ProjectNameCache.getManager().dispose(); APTDriver.close(); APTFileCacheManager.close(); UIDManager.instance().dispose(); KeyManager.instance().dispose(); CndFileUtils.clearFileExistenceCache(); APTFileCacheManager.invalidateAll(); APTSystemStorage.dispose(); }