Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IPath.segment()


    SourceIndexerRequestor requestor = new SourceIndexerRequestor(this);
    String documentPath = this.document.getPath();
    SourceElementParser parser = this.document.getParser();
    if (parser == null) {
      IPath path = new Path(documentPath);
      IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
      parser = JavaModelManager.getJavaModelManager().indexManager.getSourceElementParser(JavaCore.create(project), requestor);
    } else {
      parser.setRequestor(requestor);
    }
View Full Code Here


    IPath xmlPath = this.path;
    if (this.entryKind != IClasspathEntry.CPE_VARIABLE && this.entryKind != IClasspathEntry.CPE_CONTAINER) {
      // translate to project relative from absolute (unless a device path)
      if (xmlPath.isAbsolute()) {
        if (projectPath != null && projectPath.isPrefixOf(xmlPath)) {
          if (xmlPath.segment(0).equals(projectPath.segment(0))) {
            xmlPath = xmlPath.removeFirstSegments(1);
            xmlPath = xmlPath.makeRelative();
          } else {
            xmlPath = xmlPath.makeAbsolute();
          }
View Full Code Here

    if (this.sourceAttachmentPath != null) {
      xmlPath = this.sourceAttachmentPath;
      // translate to project relative from absolute
      if (this.entryKind != IClasspathEntry.CPE_VARIABLE && projectPath != null && projectPath.isPrefixOf(xmlPath)) {
        if (xmlPath.segment(0).equals(projectPath.segment(0))) {
          xmlPath = xmlPath.removeFirstSegments(1);
          xmlPath = xmlPath.makeRelative();
        }
      }
      parameters.put(TAG_SOURCEPATH, String.valueOf(xmlPath));
View Full Code Here

    // ensure path is absolute
    IPath path = new Path(pathAttr);
    int kind = kindFromString(kindAttr);
    if (kind != IClasspathEntry.CPE_VARIABLE && kind != IClasspathEntry.CPE_CONTAINER && !path.isAbsolute()) {
      if (!(path.segmentCount() > 0 && path.segment(0).equals(ClasspathEntry.DOT_DOT))) {
        path = projectPath.append(path);
      }
    }
    // source attachment info (optional)
    IPath sourceAttachmentPath =
View Full Code Here

    int rawLength = rawClasspath.length;
    HashSet pathes = new HashSet(rawLength);
    for (int i = 0 ; i < rawLength; i++) {
      IPath entryPath = rawClasspath[i].getPath();
      if (!pathes.add(entryPath)){
        String entryPathMsg = projectName.equals(entryPath.segment(0)) ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();
        return new JavaModelStatus(IJavaModelStatusConstants.NAME_COLLISION, Messages.bind(Messages.classpath_duplicateEntryPath, new String[] {entryPathMsg, projectName}));
      }
    }

    // retrieve resolved classpath
View Full Code Here

  int resourceSegmentCount = fullPath.segmentCount();
  int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  resourceSegmentCount--; // deal with the last segment separately
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
    charCount += fullPath.segment(i).length();
  String lastSegment = fullPath.segment(resourceSegmentCount);
  int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  charCount += extensionIndex;

  char[] result = new char[charCount];
View Full Code Here

  int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  resourceSegmentCount--; // deal with the last segment separately
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
    charCount += fullPath.segment(i).length();
  String lastSegment = fullPath.segment(resourceSegmentCount);
  int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  charCount += extensionIndex;

  char[] result = new char[charCount];
  int offset = 0;
View Full Code Here

  charCount += extensionIndex;

  char[] result = new char[charCount];
  int offset = 0;
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++) {
    String segment = fullPath.segment(i);
    int size = segment.length();
    segment.getChars(0, size, result, offset);
    offset += size;
    result[offset++] = '/';
  }
View Full Code Here

            if (!entry.isDirectory() && org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(entryName = entry.getName())) {
              IPath path = new Path(entryName);
              int segmentCount = path.segmentCount();
              if (segmentCount > 1) {
                for (int i = 0, max = path.segmentCount() - 1; i < max; i++) {
                  if (firstLevelPackageNames.contains(path.segment(i))) {
                    tempRoots.add(path.uptoSegment(i));
                    // don't break here as this path could contain other first level package names (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=74014)
                  }
                  if (i == max - 1 && containsADefaultPackage) {
                    tempRoots.add(path.uptoSegment(max));
View Full Code Here

      if (entry == null) continue;
      IPath entryPath = entry.getPath();
      int kind = entry.getEntryKind();

      // Build some common strings for status message
      boolean isProjectRelative = projectName.equals(entryPath.segment(0));
      String entryPathMsg = isProjectRelative ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();

      if (kind == IClasspathEntry.CPE_SOURCE) {
        IPath output = entry.getOutputLocation();
        if (output == null) continue; // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.