Package org.eclipse.core.runtime

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


          // we've got a source path
          // remove the first segment, since that's the project folder.
          srcPath = pfr.getPath().removeFirstSegments(1);
          if (!oneFound && srcPath.isPrefixOf(onePath)) {
            // remove the sourcepath from this path
            onePath = onePath.removeFirstSegments(srcPath.segmentCount());
            oneFound = true;
          }
          if (!otherFound && srcPath.isPrefixOf(otherPath)) {
            // remove the sourcepath from this path
            otherPath = otherPath.removeFirstSegments(srcPath.segmentCount());
View Full Code Here


            onePath = onePath.removeFirstSegments(srcPath.segmentCount());
            oneFound = true;
          }
          if (!otherFound && srcPath.isPrefixOf(otherPath)) {
            // remove the sourcepath from this path
            otherPath = otherPath.removeFirstSegments(srcPath.segmentCount());
            otherFound = true;
          }
        }
        if (oneFound && otherFound) {
          break;
View Full Code Here

  public static IFile getFile(final String filename) {
    IFile file = null;

    if (filename != null) {
      final IPath filePath = new Path(filename);
      if ((filePath.segmentCount() > 1) && (ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).exists())) {
        return ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
      }
      final IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(URIUtil.toURI(filePath.makeAbsolute()));
      for (int i = 0; (i < files.length) && (file == null); ++i) {
        if (files[i].exists()) {
View Full Code Here

        if (classpathEntries[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
          continue;// we are interested only in source folders
        IPath path = classpathEntries[i].getPath();
        if (path.isPrefixOf(file.getFullPath())) {
          removeCount = path.segmentCount() - 1;
        }

      }
    } catch (Throwable e) {
      Activator.logException(new Exception(e));
View Full Code Here

        if(classpathEntries[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
          continue;// we are interested only in source folders
        IPath path = classpathEntries[i].getPath();
        // Ugly way to ensure the right source folder when many are present.
        // Should work anyway
        removeCount = path.segmentCount()-1;
       
      }
    } catch (Throwable e) {
      Activator.logException(new Exception(e));
    }
View Full Code Here

        if (classpathEntries[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
          continue;// we are interested only in source folders
        IPath path = classpathEntries[i].getPath();
        if (path.isPrefixOf(iResource.getFullPath())) {
          removeCount = path.segmentCount() - 1;
        }

      }
    } catch (Throwable e) {
      Activator.logException(new Exception(e));
View Full Code Here

    for (int i = 0, length = projects.length; i < length; i++) {
      IPath path = projects[i].getLocation();
      path = path.makeAbsolute();
      if (path != null && path.isPrefixOf(includedPath)) {
        // -1 so we still have the project path
        includedPath = includedPath.removeFirstSegments(path
            .segmentCount() - 1);
        return ResourcesPlugin.getWorkspace().getRoot().getFile(
            includedPath);
      }
    }
View Full Code Here

    for (int i = 0, length = projects.length; i < length; i++) {
      IPath path = projects[i].getLocation();
      path = path.makeAbsolute();
      if (path != null && path.isPrefixOf(includedPath)) {
        // -1 so we still have the project path
        includedPath = includedPath.removeFirstSegments(path
            .segmentCount() - 1);
        return ResourcesPlugin.getWorkspace().getRoot().getFile(
            includedPath);
      }
    }
View Full Code Here

        if(classpathEntries[i].getEntryKind() != IClasspathEntry.CPE_SOURCE)
          continue;// we are interested only in source folders
        IPath path = classpathEntries[i].getPath();
        // Ugly way to ensure the right source folder when many are present.
        // Should work anyway
        removeCount = path.segmentCount()-1;
       
      }
    } catch (Throwable e) {
      Activator.logException(new Exception(e));
    }
View Full Code Here

  private IFile getFile(IStructuredModel model) {
    IFile result = null;
    String location = model.getBaseLocation();
    if (location != null) {
      IPath path = new Path(location);
      if (path.segmentCount() > 1) {
        result = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      }
    }
    return result;
  }
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.