protected boolean resourceExists(IResource underlyingResource) { if (underlyingResource == null) return false; IPath location = underlyingResource.getLocation(); if (location == null) return false; File file = location.toFile(); if (file == null) return false; return file.exists(); }
@Override public boolean exists() { IPath location = resource.getLocation(); return location == null ? false : location.toFile().exists(); }
protected boolean resourceExists(IResource underlyingResource) { if (underlyingResource == null) return false; IPath location = underlyingResource.getLocation(); if (location == null) return false; File file = location.toFile(); if (file == null) return false; return file.exists(); }
@Override public boolean exists() { IPath location = resource.getLocation(); return location == null ? false : location.toFile().exists(); }
protected boolean resourceExists(IResource underlyingResource) { if (underlyingResource == null) return false; IPath location = underlyingResource.getLocation(); if (location == null) return false; File file = location.toFile(); if (file == null) return false; return file.exists(); }
/** * On windows, returns whether or not we have a match regardless of * case - bug 82341 */ private static boolean caseInsensitiveMatch(String toMatch, IResource resource) { if((toMatch.charAt(1) == ':')) { return toMatch.toLowerCase().startsWith(resource.getLocation() .toString().toLowerCase()); } return false; }
private static void addFileName(Set<String> fileName, IResource resource){ if (resource == null) return; IPath location = resource.getLocation(); if (location != null) { fileName.add(location.toOSString()); } else { // not a file system path. skip file. } }
/** * @see #showPaths(List) * @param resource */ private void showResource(final IResource resource) { IPath location = resource.getLocation(); if (location != null) showPaths(Arrays.asList(location)); }
protected boolean isInResources(final IResource candidate) { final IPath location = candidate.getLocation(); for (IResource r : selection()) { if (r.getLocation().isPrefixOf(location)) { return true; } } return false; }
private String makeAbsolute(String input, ILaunchConfiguration configuration) throws CoreException { IResource member = ResourcesPlugin.getWorkspace().getRoot().findMember(input); if (member != null) { return member.getLocation().toPortableString(); } return input; }
@Override protected void setResource(IResource resource) { super.setResource(resource); text.setText(resource.getLocation().toOSString()); }
@Override protected void setResource(IResource resource) { super.setResource(resource); text.setText(resource.getLocation().toOSString()); }
private String getExpandedPath(String path) { if (path == null || path.length() == 0) return null; IResource resource = PDECore.getWorkspace().getRoot().findMember(new Path(path)); if (resource != null) { IPath fullPath = resource.getLocation(); return fullPath == null ? null : fullPath.toOSString(); } return null; }
private IPath externalPath(IResource res) { IPath resourcePath = res.getFullPath(); if (ExternalFoldersManager.isInternalPathForExternalFolder(resourcePath)) return res.getLocation(); return resourcePath; }
private IPath externalPath(IResource res) { IPath resourcePath = res.getFullPath(); if (ExternalFoldersManager.isInternalPathForExternalFolder(resourcePath)) return res.getLocation(); return resourcePath; }
private String buildLabel(IResource r) { // for a linked resource in a hidden project use its local file system location if (r.isLinked() && r.getProject().isHidden()) return r.getLocation().toString(); String n= r.getFullPath().toString(); if (n.charAt(0) == IPath.SEPARATOR) return n.substring(1); return n; }
private IPath externalPath(IResource res) { IPath resourcePath = res.getFullPath(); if (ExternalFoldersManager.isInternalPathForExternalFolder(resourcePath)) return res.getLocation(); return resourcePath; }
protected void openHandleOn(IResource resource) { IPath location = resource.getLocation(); if (location != null) { openHandleOn(location.toOSString(), true); } }
public String getRealPath() { if(entry == null) return null; if(entry.getType() == IRuntimeClasspathEntry.PROJECT){ return entry.getResource().getLocation().toOSString(); }else{ return entry.getLocation(); } }
private static void convertCUResourceChange(WorkspaceEdit edit, RenameCompilationUnitChange cuChange) { ICompilationUnit modifiedCU = (ICompilationUnit) cuChange.getModifiedElement(); RenameFile rf = new RenameFile(); String newCUName = cuChange.getNewName(); IPath currentPath = modifiedCU.getResource().getLocation(); rf.setOldUri(ResourceUtils.fixURI(modifiedCU.getResource().getRawLocationURI())); IPath newPath = currentPath.removeLastSegments(1).append(newCUName); rf.setNewUri(ResourceUtils.fixURI(newPath.toFile().toURI())); edit.getDocumentChanges().add(Either.forRight(rf)); }