Codota Logo
IPath.removeFirstSegments
Code IndexAdd Codota to your IDE (free)

How to use
removeFirstSegments
method
in
org.eclipse.core.runtime.IPath

Best Java code snippets using org.eclipse.core.runtime.IPath.removeFirstSegments (Showing top 20 results out of 828)

  • Common ways to obtain IPath
private void myMethod () {
IPath i =
  • Codota IconString fullPath;new Path(fullPath)
  • Codota IconIResource resource;resource.getLocation()
  • Codota IconIResource resource;resource.getFullPath()
  • Smart code suggestions by Codota
}
origin: infinitest/infinitest

  private String relativePath(IPath path) {
    return path.removeFirstSegments(1).toPortableString();
  }
}
origin: org.eclipse.platform/org.eclipse.equinox.p2.core

@Override
public IPath computePath(File source) {
  IPath result = new Path(source.getAbsolutePath());
  IPath rootPath = new Path(root.getAbsolutePath());
  result = result.removeFirstSegments(rootPath.matchingFirstSegments(result));
  return result.setDevice(null);
}
origin: org.eclipse.equinox.p2/core

public IPath computePath(File source) {
  IPath sourcePath = new Path(source.getAbsolutePath());
  sourcePath = sourcePath.removeFirstSegments(Math.max(0, sourcePath.segmentCount() - segmentsToKeep));
  return sourcePath.setDevice(null);
}
origin: org.eclipse.pde/org.eclipse.pde.api.tools

  @Override
  public boolean visit(IResourceProxy proxy) throws CoreException {
    if (proxy.getType() == IResource.FOLDER) {
      String path = proxy.requestFullPath().removeFirstSegments(this.segmentcount).toString();
      return this.collector.add(path.replace(IPath.SEPARATOR, '.'));
    }
    return false;
  }
}
origin: org.eclipse.platform/org.eclipse.equinox.p2.core

@Override
public IPath computePath(File source) {
  IPath sourcePath = new Path(source.getAbsolutePath());
  sourcePath = sourcePath.removeFirstSegments(Math.max(0, sourcePath.segmentCount() - segmentsToKeep));
  return sourcePath.setDevice(null);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

@Override
public IPath getProjectRelativePath() {
  IPath full = getFullPath();
  int count = full.segmentCount();
  if (count < 0)
    return null;
  if (count <= 1) // 0 or 1
    return Path.EMPTY;
  return full.removeFirstSegments(1);
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Creates and returns the string that should be used as the name of the entry in the archive.
 * @param exportResource the resource to export
 * @param leadupDepth the number of resource levels to be included in the path including the resourse itself.
 */
private String createDestinationName(int leadupDepth, IResource exportResource) {
  IPath fullPath = exportResource.getFullPath();
  if (createLeadupStructure) {
    return fullPath.makeRelative().toString();
  }
  return fullPath.removeFirstSegments(fullPath.segmentCount() - leadupDepth).makeRelative().toString();
}
origin: org.eclipse.platform/org.eclipse.core.resources

  @Override
  public int visit(Entry entry) {
    PropertyEntry sourceEntry = (PropertyEntry) entry;
    IPath destinationPath = destination.append(sourceEntry.getPath().removeFirstSegments(source.segmentCount()));
    PropertyEntry destinationEntry = new PropertyEntry(destinationPath, sourceEntry);
    changes.add(destinationEntry);
    return CONTINUE;
  }
}
origin: org.eclipse.platform/org.eclipse.core.resources

  @Override
  public int visit(Entry sourceEntry) {
    IPath destinationPath = destination.append(sourceEntry.getPath().removeFirstSegments(source.segmentCount()));
    HistoryEntry destinationEntry = new HistoryEntry(destinationPath, (HistoryEntry) sourceEntry);
    // we may be copying to the same source bucket, collect to make change effective later
    // since we cannot make changes to it while iterating
    changes.add(destinationEntry);
    return CONTINUE;
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private IPath getResolvedPath(IPath path) {
  if (path != null) {
    String varName= path.segment(0);
    if (varName != null) {
      IPath varPath= JavaCore.getClasspathVariable(varName);
      if (varPath != null) {
        return varPath.append(path.removeFirstSegments(1));
      }
    }
  }
  return null;
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

  @Override
  public int visit(Entry entry) {
    PropertyEntry sourceEntry = (PropertyEntry) entry;
    IPath destinationPath = destination.append(sourceEntry.getPath().removeFirstSegments(source.segmentCount()));
    PropertyEntry destinationEntry = new PropertyEntry(destinationPath, sourceEntry);
    changes.add(destinationEntry);
    return CONTINUE;
  }
}
origin: org.eclipse/org.eclipse.jdt.ui

private IPath getFolderPath(IPath packPath, IPath relpath) {
  int remainingSegments= packPath.segmentCount() - relpath.segmentCount();
  if (remainingSegments >= 0) {
    IPath common= packPath.removeFirstSegments(remainingSegments);
    if (common.equals(relpath)) {
      return packPath.uptoSegment(remainingSegments);
    }
  }
  return null;
}
origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * @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));
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private static boolean addToExclusions(IPath entryPath, CPListElement curr) {
  IPath[] exclusionFilters= (IPath[]) curr.getAttribute(CPListElement.EXCLUSION);
  if (!JavaModelUtil.isExcludedPath(entryPath, exclusionFilters)) {
    IPath pathToExclude= entryPath.removeFirstSegments(curr.getPath().segmentCount()).addTrailingSeparator();
    IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1];
    System.arraycopy(exclusionFilters, 0, newExclusionFilters, 0, exclusionFilters.length);
    newExclusionFilters[exclusionFilters.length]= pathToExclude;
    curr.setAttribute(CPListElement.EXCLUSION, newExclusionFilters);
    return true;
  }
  return false;
}
origin: org.eclipse/org.eclipse.jdt.ui

private String getVariableString(IPath path) {
  String name= path.makeRelative().toString();
  IPath entryPath= JavaCore.getClasspathVariable(path.segment(0));
  if (entryPath != null) {
    String appended= entryPath.append(path.removeFirstSegments(1)).toOSString();
    return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { name, appended }); 
  } else {
    return name;
  }
}

origin: org.eclipse/org.eclipse.jdt.ui

private static boolean addToExclusions(IPath entryPath, CPListElement curr) {
  IPath[] exclusionFilters= (IPath[]) curr.getAttribute(CPListElement.EXCLUSION);
  if (!JavaModelUtil.isExcludedPath(entryPath, exclusionFilters)) {
    IPath pathToExclude= entryPath.removeFirstSegments(curr.getPath().segmentCount()).addTrailingSeparator();
    IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1];
    System.arraycopy(exclusionFilters, 0, newExclusionFilters, 0, exclusionFilters.length);
    newExclusionFilters[exclusionFilters.length]= pathToExclude;
    curr.setAttribute(CPListElement.EXCLUSION, newExclusionFilters);
    return true;
  }
  return false;
}

origin: org.eclipse.platform/org.eclipse.core.resources

protected boolean copy(UnifiedTreeNode node) {
  Resource source = (Resource) node.getResource();
  IPath sufix = source.getFullPath().removeFirstSegments(segmentsToDrop);
  Resource destination = getDestinationResource(source, sufix);
  if (!copyProperties(source, destination))
    return false;
  return copyContents(node, source, destination);
}
origin: eclipse/buildship

private IResource getUnderlyingDirectory(EclipseSourceDirectory directory) {
  IProject project = this.project.getProject();
  IPath path = project.getFullPath().append(directory.getPath());
  if (path.segmentCount() == 1) {
    return project;
  }
  return project.getFolder(path.removeFirstSegments(1));
}
origin: org.eclipse.pde/org.eclipse.pde.ui

public static boolean openSchema(IPath path) {
  String pluginId = path.segment(0);
  IPluginModelBase model = PluginRegistry.findModel(pluginId);
  if (model != null && model.getUnderlyingResource() != null) {
    IProject project = model.getUnderlyingResource().getProject();
    IFile file = project.getFile(path.removeFirstSegments(1));
    return openSchema(file);
  }
  return false;
}
origin: org.eclipse/org.eclipse.compare

private IPath getDiffPath(IFile file) {
  DiffProject project = getDiffProject(file.getProject());
  if (project != null) {
    return file.getProjectRelativePath();
  }
  return file.getFullPath().removeFirstSegments(getTarget().getFullPath().segmentCount());
}
org.eclipse.core.runtimeIPathremoveFirstSegments

Javadoc

Returns a copy of this path with the given number of segments removed from the beginning. The device id is preserved. The number must be greater or equal zero. If the count is zero, this path is returned. The resulting path will always be a relative path with respect to this path. If the number equals or exceeds the number of segments in this path, an empty relative path is returned.

Popular methods of IPath

  • toString
    Returns a string representation of this path, including its device id. The same separator, "/", is u
  • toFile
    Returns a java.io.File corresponding to this path.
  • toOSString
    Returns a string representation of this path which uses the platform-dependent path separator define
  • append
    Returns the canonicalized path obtained from the concatenation of the given path's segments to the e
  • segmentCount
    Returns the number of segments in this path. Note that both root and empty paths have 0 segments.
  • removeLastSegments
    Returns a copy of this path with the given number of segments removed from the end. The device id is
  • lastSegment
    Returns the last segment of this path, ornull if it does not have any segments.
  • segment
    Returns the specified segment of this path, ornull if the path does not have such a segment.
  • equals
    Returns whether this path equals the given object. Equality for paths is defined to be: same sequenc
  • isAbsolute
    Returns whether this path is an absolute path (ignoring any device id). Absolute paths start with a
  • isPrefixOf
    Returns whether this path is a prefix of the given path. To be a prefix, this path's segments must a
  • toPortableString
    Returns a platform-neutral string representation of this path. The format is not specified, except t
  • isPrefixOf,
  • toPortableString,
  • makeRelative,
  • makeAbsolute,
  • getDevice,
  • isEmpty,
  • addTrailingSeparator,
  • getFileExtension,
  • setDevice

Popular in Java

  • Reading from database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getExternalFilesDir (Context)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now