congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
IPath.segmentCount
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Returns the value associated with the given key
 */
public T get(IPath key) {
  Node<T> node = this.root.getMostSpecificNode(key);
  if (!node.exists || node.depth < key.segmentCount()) {
    return null;
  }
  return node.value;
}
origin: org.eclipse.tycho/org.eclipse.jdt.core

public static boolean hasDotDot(IPath path) {
  for (int i = 0, length = path.segmentCount(); i < length; i++) {
    if (DOT_DOT.equals(path.segment(i)))
      return true;
  }
  return false;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

protected boolean isNonProjectSpecificContainer(IPath containerPath) {
  if (containerPath.segmentCount() > 0) {
    String id= containerPath.segment(0);
    if (id.equals(JavaCore.USER_LIBRARY_CONTAINER_ID) || id.equals(JavaRuntime.JRE_CONTAINER)) {
      return true;
    }
  }
  return false;
}
origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * @param path full absolute workspace path
 */
private static boolean isInternalFilePath(IPath path) {
  IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
  // in case this is full workspace path it should start with project segment
  if(path.segmentCount() > 1 && wsRoot.getFile(path).exists()) {
    return true;
  }
  return false;
}
origin: org.eclipse.platform/org.eclipse.core.filesystem

/**
 * @deprecated use {@link #getFileStore(IPath)} instead
 */
@Deprecated
@Override
public IFileStore getChild(IPath path) {
  IFileStore result = this;
  for (int i = 0, imax = path.segmentCount(); i < imax; i++)
    result = result.getChild(path.segment(i));
  return result;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Gets the source attachment path chosen by the user
 * @return the source attachment path
 */
public IPath getSourceAttachmentPath() {
  return (getFilePath().segmentCount() == 0) ? null : getFilePath();
}
origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * Returns true if this resource represents the project description file, and
 * false otherwise.
 */
protected boolean isProjectDescriptionFile(IResource resource) {
  return resource.getType() == IResource.FILE && resource.getFullPath().segmentCount() == 2 && resource.getName().equals(IProjectDescription.DESCRIPTION_FILE_NAME);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

/**
 * Gets the description file (as workspace resource).
 *
 * @return a file which points to the description
 */
public IFile getDescriptionFile() {
  IPath path= getDescriptionLocation();
  if (path.isValidPath(path.toString()) && path.segmentCount() >= 2)
    return JavaPlugin.getWorkspace().getRoot().getFile(path);
  else
    return null;
}
origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * The path is known to match a source/library folder entry.
 * @param path IPath
 * @return IPackageFragmentRoot
 */
public IPackageFragmentRoot getFolderPackageFragmentRoot(IPath path) {
  if (path.segmentCount() == 1) { // default project root
    return getPackageFragmentRoot(this.project);
  }
  return getPackageFragmentRoot(this.project.getWorkspace().getRoot().getFolder(path));
}
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.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.tycho/org.eclipse.jdt.core

Node<T> createNode(IPath key) {
  if (this.depth == key.segmentCount()) {
    this.exists = true;
    return this;
  }
  String nextSegment = getSegment(key);
  Node<T> next = createChild(nextSegment);
  return next.createNode(key);
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private IPackageFragmentRoot findPackageFragmentRoot(IJavaProject jProject, IPath path) throws JavaModelException {
  if (jProject == null || path == null || path.segmentCount() <= 0)
    return null;
  IPackageFragmentRoot pkgRoot= jProject.findPackageFragmentRoot(path);
  if (pkgRoot != null)
    return pkgRoot;
  else
    return findPackageFragmentRoot(jProject, path.removeLastSegments(1));
}
origin: org.eclipse.platform/org.eclipse.core.resources

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

@Override
public IClasspathAttribute performEdit(Shell shell, ClasspathAttributeAccess attribute) {
  String initialLocation= attribute.getClasspathAttribute().getValue();
  IPath locationPath= initialLocation == null ? null : new Path(initialLocation);
  IPath newPath= BuildPathDialogAccess.configureExternalAnnotationsAttachment(shell, locationPath);
  if(null == newPath)	// Was the dialog cancelled?
    return null;
  return JavaCore.newClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH, newPath.segmentCount() == 0 ? null : newPath.toPortableString());
}
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.jst.j2ee

protected void mkdirs(IPath path, IWorkspaceRoot root) throws CoreException {
  if (path.segmentCount() <= 1)
    return;
  IFolder folder = root.getFolder(path);
  if (!folder.exists()) {
    mkdirs(path.removeLastSegments(1), root);
    folder.create(true, true, null);
  }
}
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: eclipse/eclipse.jdt.ls

protected IPath createNewPath(IPackageFragment oldPackage) {
  IPath oldPackagePath= createPath(oldPackage.getElementName());
  IPath newPackagePath= createPath(getNewName(oldPackage));
  return oldPackage.getPath().removeLastSegments(oldPackagePath.segmentCount()).append(newPackagePath);
}
org.eclipse.core.runtimeIPathsegmentCount

Javadoc

Returns the number of segments in this path.

Note that both root and empty paths have 0 segments.

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
  • 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.
  • removeFirstSegments
    Returns a copy of this path with the given number of segments removed from the beginning. The device
  • 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

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ImageIO (javax.imageio)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now