public static void verifyRelative(IPath archiveRelativePath) { if (archiveRelativePath.isAbsolute() && !archiveRelativePath.equals(IArchive.EMPTY_MODEL_PATH)) { throw new RuntimeException(archiveRelativePath + " must be relative."); //$NON-NLS-1$ } }
public static String makeRelative(String original, String rootPath) { IPath path = new Path(original); // ensure we have an absolute path to start with if (!path.isAbsolute()) return original; //Returns the original string if no relativization has been done String result = makeRelative(path, new Path(rootPath)); return path.toOSString().equals(result) ? original : result; }
public static String makeRelative(String original, String rootPath) { IPath path = new Path(original); // ensure we have an absolute path to start with if (!path.isAbsolute()) return original; //Returns the original string if no relativization has been done IPath result = path.makeRelativeTo(new Path(rootPath)); return path.equals(result) ? original : result.toString(); }
public static String makeRelative(String original, String rootPath) { IPath path = new Path(original); // ensure we have an absolute path to start with if (!path.isAbsolute()) return original; //Returns the original string if no relativization has been done IPath result = path.makeRelativeTo(new Path(rootPath)); return path.equals(result) ? original : result.toString(); }
private static File relativePathToProjectRoot(IPath projectPath, String path) { IPath pathToRoot = new Path(path); IPath absolutePathToRoot = pathToRoot.isAbsolute() ? pathToRoot : RelativePathUtils.getAbsolutePath(projectPath, pathToRoot); return canonicalize(absolutePathToRoot.toFile()); }
/** * @see IPathVariableManager#validateValue(IPath) */ @Override public IStatus validateValue(IPath value) { if (value != null && (!value.isValidPath(value.toString()) || !value.isAbsolute())) { String message = Messages.pathvar_invalidValue; return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); } return Status.OK_STATUS; }
public static String makeAbsolute(String original, String rootPath) { IPath path = new Path(original); // ensure we have a relative path to start with if (path.isAbsolute()) return original; IPath root = new Path(rootPath); return root.addTrailingSeparator().append(original.replace(':', '}')).toOSString().replace('}', ':'); }
/** * @see IPathVariableManager#validateValue(IPath) */ @Override public IStatus validateValue(IPath value) { if (value != null && (!value.isValidPath(value.toString()) || !value.isAbsolute())) { String message = Messages.pathvar_invalidValue; return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); } return Status.OK_STATUS; }
public static String makeAbsolute(String original, String rootPath) { IPath path = new Path(original); // ensure we have a relative path to start with if (path.isAbsolute()) return original; IPath root = new Path(rootPath); return root.addTrailingSeparator().append(original.replace(':', '}')).toOSString().replace('}', ':'); }
public static IPath handleToResourcePath(final String project, final String handle) { final IPath path= Path.fromPortableString(handle); if (project != null && project.length() > 0 && !path.isAbsolute()) return new Path(project).append(path).makeAbsolute(); return path; }
public static IPath handleToResourcePath(final String project, final String handle) { final IPath path= Path.fromPortableString(handle); if (project != null && project.length() > 0 && !path.isAbsolute()) return new Path(project).append(path).makeAbsolute(); return path; }
URI toURI(IPath path) { if (path.isAbsolute()) return org.eclipse.core.filesystem.URIUtil.toURI(path); try { return new URI(null, null, path.toPortableString(), null); } catch (URISyntaxException e) { return org.eclipse.core.filesystem.URIUtil.toURI(path); } }
public String getComponentName(){ IResource resource = getResourceFromInitialSelection(); if (resource!=null) { IPath absolutePath = resource.getFullPath(); if (absolutePath.isAbsolute()) { return absolutePath.segment(1); } } return null; }
protected IPath makePathAbsolute(IPath target) { if (target.isAbsolute()) return target; return getParent().getFullPath().append(target); }
protected IPath makePathAbsolute(IPath target) { if (target.isAbsolute()) return target; return getParent().getFullPath().append(target); }
/** * @deprecated use {@link #resolveURI(URI)} instead. */ @Override @Deprecated public IPath resolvePath(IPath path) { if (path == null || path.segmentCount() == 0 || path.isAbsolute() || path.getDevice() != null) return path; URI value = resolveURI(URIUtil.toURI(path)); return value == null ? path : URIUtil.toPath(value); }
/** * @see org.eclipse.core.resources.IPathVariableManager#resolvePath(IPath) */ @Deprecated @Override public IPath resolvePath(IPath path) { if (path == null || path.segmentCount() == 0 || path.isAbsolute() || path.getDevice() != null) return path; IPath value = getValue(path.segment(0)); return value == null ? path : value.append(path.removeFirstSegments(1)); }
/** * @see org.eclipse.core.resources.IPathVariableManager#resolvePath(IPath) */ @Deprecated @Override public IPath resolvePath(IPath path) { if (path == null || path.segmentCount() == 0 || path.isAbsolute() || path.getDevice() != null) return path; IPath value = getValue(path.segment(0)); return value == null ? path : value.append(path.removeFirstSegments(1)); }
public void setLinkLocation(IPath location, int updateFlags, IProgressMonitor monitor) throws CoreException { if (location.isAbsolute()) { setLinkLocation(URIUtil.toURI(location.toPortableString()), updateFlags, monitor); } else { try { setLinkLocation(new URI(null, null, location.toPortableString(), null), updateFlags, monitor); } catch (URISyntaxException e) { setLinkLocation(URIUtil.toURI(location.toPortableString()), updateFlags, monitor); } } } }
public void setLinkLocation(IPath location, int updateFlags, IProgressMonitor monitor) throws CoreException { if (location.isAbsolute()) { setLinkLocation(URIUtil.toURI(location.toPortableString()), updateFlags, monitor); } else { try { setLinkLocation(new URI(null, null, location.toPortableString(), null), updateFlags, monitor); } catch (URISyntaxException e) { setLinkLocation(URIUtil.toURI(location.toPortableString()), updateFlags, monitor); } } } }