public static boolean isContainedIn(IPath location, Collection<IPath> paths) { for (IPath path : paths) { if (path.isPrefixOf(location)) { return true; } } return false; }
@Override public boolean startsWith(IPath path) { try { return path.isPrefixOf(new Path(this.indexFile.getCanonicalPath())); } catch (IOException e) { return false; } }
public static int indexOfNestedPath(IPath checkedPath, IPath[] paths, int pathCount) { for (int i = 0; i < pathCount; i++){ if (checkedPath.equals(paths[i])) continue; if (checkedPath.isPrefixOf(paths[i])) return i; } return -1; } /**
public static int indexOfNestedPath(IPath checkedPath, IPath[] paths, int pathCount) { for (int i = 0; i < pathCount; i++){ if (checkedPath.equals(paths[i])) continue; if (checkedPath.isPrefixOf(paths[i])) return i; } return -1; } /**
public static Set<IJavaProject> parseProjects(URI rootFolderURI) { final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); final IProject[] projects = workspaceRoot.getProjects(); final IPath parent = filePathFromURI(rootFolderURI); return Arrays.stream(projects) .filter(p -> parent.isPrefixOf(p.getLocation())) .map(p -> getJavaProject(p)) .filter(p -> p != null) .collect(Collectors.toSet()); }
private void ensureResourceCovered(IResource resource, List<IResource> list) { IPath path = resource.getFullPath(); for (IResource root : list) { if (root.getFullPath().isPrefixOf(path)) { return; } } list.add(resource); }
private boolean isDescendantOfRoot(IResource resource, IResource[] roots) { for (int i = 0; i < roots.length; i++) { IResource root = roots[i]; if (root.getFullPath().isPrefixOf(resource.getFullPath())) { return true; } } return false; } }
public static boolean isNotInOutputFolder(IFile file, IJavaProject jp) { try { IPath out = jp.getOutputLocation(); return !out.isPrefixOf(file.getFullPath()); } catch (JavaModelException e) { return true; } }
public static List<IProject> getVisibleProjects(IPath workspaceRoot) { List<IProject> projects = new ArrayList<>(); for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { if (project.exists() && isVisibleProject(project) && workspaceRoot.isPrefixOf(project.getLocation())) { projects.add(project); } } return projects; }
private static boolean sourceDirHasNestedOutputLocation(Iterable<? extends EclipseSourceDirectory> sourceDirs, String outputLocation) { IPath outputPath = new Path(outputLocation); for (EclipseSourceDirectory sourceDir : sourceDirs) { if (sourceDir.getOutput() != null) { IPath sourceDirPath = new Path(sourceDir.getOutput()); if (!outputPath.equals(sourceDirPath) && outputPath.isPrefixOf(sourceDirPath)) { return true; } } } return false; } }
public static IPath findBelongedWorkspaceRoot(IPath filePath) { PreferenceManager manager = JavaLanguageServerPlugin.getPreferencesManager(); Collection<IPath> rootPaths = manager.getPreferences().getRootPaths(); if (rootPaths != null) { for (IPath rootPath : rootPaths) { if (rootPath.isPrefixOf(filePath)) { return rootPath; } } } return null; }
@Override public boolean contains(ResourceMapping mapping) { if (mapping instanceof JavaElementResourceMapping) { JavaElementResourceMapping javaMapping = (JavaElementResourceMapping) mapping; IJavaElement element = getJavaElement(); IJavaElement other = javaMapping.getJavaElement(); if (other != null && element != null) { return element.getPath().isPrefixOf(other.getPath()); } } return false; }
@Override public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { IFile manifestFile = PDEProject.getManifest(project); if (manifestFile != null && manifestFile.exists()) { for (IPath ignoredDirectory : ignoredDirectories) { if (ignoredDirectory.isPrefixOf(manifestFile.getLocation())) { return false; } } } return hasOSGiManifest(project); }
private boolean hasChildrenInScope(ISynchronizationScope scope, Object object, IResource resource) { if (!resource.isAccessible()) return false; IResource[] roots = scope.getRoots(); for (int i = 0; i < roots.length; i++) { IResource root = roots[i]; if (resource.getFullPath().isPrefixOf(root.getFullPath())) return true; } return false; }
@Override public boolean contains(ResourceMapping mapping) { if (mapping instanceof JavaElementResourceMapping) { JavaElementResourceMapping javaMapping = (JavaElementResourceMapping) mapping; IJavaElement element = getJavaElement(); IJavaElement other = javaMapping.getJavaElement(); if (other != null && element != null) return element.getPath().isPrefixOf(other.getPath()); } return false; }
private static IResource tryFindWorkspaceFile(InternalGradleBuild gradleBuild, Path filePath) { for (IProject project : getWorkspaceProjectsFor(gradleBuild)) { IPath projectLocation = project.getLocation(); if (projectLocation.isPrefixOf(filePath)) { IFile file = project.getFile(filePath.makeRelativeTo(projectLocation)); if (file.exists()) { return file; } } } return null; }
private boolean contains(IResource resource, IResource child) { if (resource.equals(child)) return true; if (depth == IResource.DEPTH_ZERO) return false; if (child.getParent().equals(resource)) return true; if (depth == IResource.DEPTH_INFINITE) return resource.getFullPath().isPrefixOf(child.getFullPath()); return false; }
private static IPath getWorkspacePath(IPath path) { PreferenceManager manager = JavaLanguageServerPlugin.getPreferencesManager(); Collection<IPath> rootPaths = manager.getPreferences().getRootPaths(); if (rootPaths != null) { for (IPath rootPath : rootPaths) { if (rootPath.isPrefixOf(path)) { return path.makeRelativeTo(rootPath.append("..")); } } } return path; }
private boolean contains(IResource resource, IResource child) { if (resource.equals(child)) return true; if (depth == IResource.DEPTH_ZERO) return false; if (child.getParent().equals(resource)) return true; if (depth == IResource.DEPTH_INFINITE) return resource.getFullPath().isPrefixOf(child.getFullPath()); return false; }
public static class ClasspathResolutionBreakpointListener { public void breakpoint(int bp) { // override in listener implementation } }