/** * Returns a workspace path to this resource if possible and the absolute filesystem location if not. */ public IPath getPath() { IPath workspacePath = getFirstWorkspaceLocation(); if (workspacePath.isEmpty()) { return new Path(getLocation().getString()); } return workspacePath; }
/** * Returns a workspace path to this resource if possible and the absolute filesystem location if not. */ public IPath getPath() { IPath workspacePath = getFirstWorkspaceLocation(); if (workspacePath.isEmpty()) { return new Path(getLocation().getString()); } return workspacePath; }
/** * Returns the absolute path to the java root for this .jar or .class file. If this is a .jar file, it returns its * own filename. */ public IString getPackageFragmentRoot() { IString javaRoot = JAVA_ROOT.get(getNd(), this.address); if (javaRoot.length() == 0) { return getLocation(); } return javaRoot; }
/** * Returns the absolute path to the java root for this .jar or .class file. If this is a .jar file, it returns its * own filename. */ public IString getPackageFragmentRoot() { IString javaRoot = JAVA_ROOT.get(getNd(), this.address); if (javaRoot.length() == 0) { return getLocation(); } return javaRoot; }
/** * Given a NdType, returns its identifier in the form accepted by {@link IJavaSearchScope#encloses(String)} */ public static char[] getIndexPathFor(NdType type, IWorkspaceRoot root) { NdResourceFile resourceFile = type.getResourceFile(); char[] binaryName = type.getTypeId().getBinaryName(); char[] workspaceLocation = null; if (root != null) { workspaceLocation = resourceFile.getAnyOpenWorkspaceLocation(root).toString().toCharArray(); } if (workspaceLocation == null || workspaceLocation.length == 0) { workspaceLocation = resourceFile.getLocation().getChars(); } return CharArrayUtils.concat(workspaceLocation, JAR_FILE_ENTRY_SEPARATOR, binaryNameToResourceRelativePath(binaryName)); }
/** * Given a NdType, returns its identifier in the form accepted by {@link IJavaSearchScope#encloses(String)} */ public static char[] getIndexPathFor(NdType type, IWorkspaceRoot root) { NdResourceFile resourceFile = type.getResourceFile(); char[] binaryName = type.getTypeId().getBinaryName(); char[] workspaceLocation = null; if (root != null) { workspaceLocation = resourceFile.getAnyOpenWorkspaceLocation(root).toString().toCharArray(); } if (workspaceLocation == null || workspaceLocation.length == 0) { workspaceLocation = resourceFile.getLocation().getChars(); } return CharArrayUtils.concat(workspaceLocation, JAR_FILE_ENTRY_SEPARATOR, binaryNameToResourceRelativePath(binaryName)); }
garbage.add(next); } else { IPath nextPath = new Path(next.getLocation().toString()); long timeLastUsed = next.getTimeLastUsed(); long timeSinceLastUsed = currentTimeMillis - timeLastUsed;
garbage.add(next); } else { IPath nextPath = new Path(next.getLocation().toString()); long timeLastUsed = next.getTimeLastUsed(); long timeSinceLastUsed = currentTimeMillis - timeLastUsed;
private TypeRef(NdType type) { super(); this.fieldDescriptor = type.getTypeId().getRawType().getFieldDescriptor().getChars(); this.fileName = type.getResourceFile().getLocation().getChars(); this.ref = new DatabaseRef<NdType>(type.getNd(), this.typeSupplier, type); }
private TypeRef(NdType type) { super(); this.fieldDescriptor = type.getTypeId().getRawType().getFieldDescriptor().getChars(); this.fileName = type.getResourceFile().getLocation().getChars(); this.ref = new DatabaseRef<NdType>(type.getNd(), this.typeSupplier, type); }
/** * Returns true iff the given resource file is up-to-date with the filesystem. Returns false * if the argument is null or there is a possibility it being out-of-date with the file system. * * @param file the index file to look up or null * @throws CoreException */ public boolean isUpToDate(NdResourceFile file) throws CoreException { if (file != null && file.isDoneIndexing()) { String location = file.getLocation().getString(); FileStateCache cache = FileStateCache.getCache(getNd()); Boolean cachedResult = cache.isUpToDate(location); if (cachedResult != null) { return cachedResult; } Path locationPath = new Path(location); boolean result = file.getFingerprint().test(locationPath, null).matches(); cache.put(location, result); return result; } return false; }
/** * Returns true iff the given resource file is up-to-date with the filesystem. Returns false * if the argument is null or there is a possibility it being out-of-date with the file system. * * @param file the index file to look up or null * @throws CoreException */ public boolean isUpToDate(NdResourceFile file) throws CoreException { if (file != null && file.isDoneIndexing()) { String location = file.getLocation().getString(); FileStateCache cache = FileStateCache.getCache(getNd()); Boolean cachedResult = cache.isUpToDate(location); if (cachedResult != null) { return cachedResult; } Path locationPath = new Path(location); boolean result = file.getFingerprint().test(locationPath, null).matches(); cache.put(location, result); return result; } return false; }
@Override public NdType get() { NdTypeId typeId = JavaIndex.getIndex(TypeRef.this.ref.getNd()).findType(TypeRef.this.fieldDescriptor); if (typeId == null) { return null; } List<NdType> implementations = typeId.getTypes(); for (NdType next : implementations) { NdResourceFile nextResourceFile = next.getResourceFile(); if (nextResourceFile.getLocation().compare(TypeRef.this.fileName, false) == 0) { if (nextResourceFile.isDoneIndexing()) { return next; } } } return null; } }
@Override public NdType get() { NdTypeId typeId = JavaIndex.getIndex(TypeRef.this.ref.getNd()).findType(TypeRef.this.fieldDescriptor); if (typeId == null) { return null; } List<NdType> implementations = typeId.getTypes(); for (NdType next : implementations) { NdResourceFile nextResourceFile = next.getResourceFile(); if (nextResourceFile.getLocation().compare(TypeRef.this.fileName, false) == 0) { if (nextResourceFile.isDoneIndexing()) { return next; } } } return null; } }
if (DEBUG_INSERTIONS) { Package.logInfo("Inserting " + new String(fieldDescriptor) + " into " //$NON-NLS-1$//$NON-NLS-2$ + resourceFile.getLocation().getString() + " " + resourceFile.address); //$NON-NLS-1$
if (DEBUG_INSERTIONS) { Package.logInfo("Inserting " + new String(fieldDescriptor) + " into " //$NON-NLS-1$//$NON-NLS-2$ + resourceFile.getLocation().getString() + " " + resourceFile.address); //$NON-NLS-1$
this.fileStateCache.remove(resourceFile.getLocation().getString());
this.fileStateCache.remove(resourceFile.getLocation().getString());
if (DEBUG_INSERTIONS) { Package.logInfo("Deleting " + nextDeletion.getTypeId().getFieldDescriptor().getString() + " from " //$NON-NLS-1$//$NON-NLS-2$ + new String(toDelete.getLocation().getString()) + " " + toDelete.address); //$NON-NLS-1$
if (DEBUG_INSERTIONS) { Package.logInfo("Deleting " + nextDeletion.getTypeId().getFieldDescriptor().getString() + " from " //$NON-NLS-1$//$NON-NLS-2$ + toDelete.getLocation().getString() + " " + toDelete.address); //$NON-NLS-1$