boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
boolean hasTrailingSeparator = fullPath.hasTrailingSeparator(); String[] segments = fullPath.segments();
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
private IPath[] renamePatterns(IPath rootPath, IPath[] patterns) { IPath[] newPatterns = null; int newPatternsIndex = -1; for (int i = 0, length = patterns.length; i < length; i++) { IPath pattern = patterns[i]; if (pattern.equals(rootPath)) { if (newPatterns == null) { newPatterns = new IPath[length]; System.arraycopy(patterns, 0, newPatterns, 0, i); newPatternsIndex = i; } IPath newPattern = this.destination.removeFirstSegments(1); if (pattern.hasTrailingSeparator()) newPattern = newPattern.addTrailingSeparator(); newPatterns[newPatternsIndex++] = newPattern; } } return newPatterns; }
if (externalPath.hasTrailingSeparator()) { result = result.addTrailingSeparator();
/** * Returns a new name for a copy of the resource at the given path in the * given workspace. This name is determined automatically. * * @param originalName * the full path of the resource * @param workspace * the workspace * @return the new full path for the copy */ static IPath getAutoNewNameFor(IPath originalName, IWorkspace workspace) { String resourceName = originalName.lastSegment(); IPath leadupSegment = originalName.removeLastSegments(1); boolean isFile = !originalName.hasTrailingSeparator(); String newName = computeNewName(resourceName, isFile); while (true) { IPath pathToTry = leadupSegment.append(newName); if (!workspace.getRoot().exists(pathToTry)) { return pathToTry; } newName = computeNewName(newName, isFile); } }
protected void save(IArchiveResource resource) throws ArchiveSaveFailureException { try { IPath path = resource.getPath(); if(resource.getType() == IArchiveResource.DIRECTORY_TYPE && !path.hasTrailingSeparator()){ path = path.addTrailingSeparator(); } ZipEntry entry = new ZipEntry(path.toString()); if (resource.getLastModified() > 0) entry.setTime(resource.getLastModified()); getZipOutputStream().putNextEntry(entry); if (resource.getType() != IArchiveResource.DIRECTORY_TYPE) { ArchiveUtil.copy(resource.getInputStream(), getZipOutputStream()); } getZipOutputStream().closeEntry(); } catch (IOException e) { throw new ArchiveSaveFailureException(e); } }
public IPath append(IPath tail) { //optimize some easy cases if (tail == null || tail.segmentCount() == 0) return this; //these call chains look expensive, but in most cases they are no-ops if (this.isEmpty()) return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot()) return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); //concatenate the two segment arrays int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } //use my leading separators and the tail's trailing separator Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$ result.canonicalize(); } return result; }
public IPath append(IPath tail) { //optimize some easy cases if (tail == null || tail.segmentCount() == 0) return this; //these call chains look expensive, but in most cases they are no-ops if (this.isEmpty()) return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot()) return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); //concatenate the two segment arrays int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } //use my leading separators and the tail's trailing separator Path result = new Path(device, newSegments, (separators & (HAS_LEADING | IS_UNC)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$ result.canonicalize(); } return result; }
@Override public IPath append(IPath tail) { //optimize some easy cases if (tail == null || tail.segmentCount() == 0) return this; //these call chains look expensive, but in most cases they are no-ops //the tail must be for the same platform as this instance if (this.isEmpty() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$ return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$ return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); //concatenate the two segment arrays int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } //use my leading separators and the tail's trailing separator Path result = new Path(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$ result.canonicalize(); } return result; }
@Override public IPath append(IPath tail) { //optimize some easy cases if (tail == null || tail.segmentCount() == 0) return this; //these call chains look expensive, but in most cases they are no-ops //the tail must be for the same platform as this instance if (this.isEmpty() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$ return tail.setDevice(device).makeRelative().makeUNC(isUNC()); if (this.isRoot() && ((flags & IS_FOR_WINDOWS) == 0) == tail.isValidSegment(":")) //$NON-NLS-1$ return tail.setDevice(device).makeAbsolute().makeUNC(isUNC()); //concatenate the two segment arrays int myLen = segments.length; int tailLen = tail.segmentCount(); String[] newSegments = new String[myLen + tailLen]; System.arraycopy(segments, 0, newSegments, 0, myLen); for (int i = 0; i < tailLen; i++) { newSegments[myLen + i] = tail.segment(i); } //use my leading separators and the tail's trailing separator Path result = new Path(device, newSegments, (flags & (HAS_LEADING | IS_UNC | IS_FOR_WINDOWS)) | (tail.hasTrailingSeparator() ? HAS_TRAILING : 0)); String tailFirstSegment = newSegments[myLen]; if (tailFirstSegment.equals("..") || tailFirstSegment.equals(".")) { //$NON-NLS-1$ //$NON-NLS-2$ result.canonicalize(); } return result; }