Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Path.removeFirstSegments()


   * @return the image descriptor
   */
  public static ImageDescriptor findImageDescriptor(String path) {
    final IPath p = new Path(path);
    if (p.isAbsolute() && p.segmentCount() > 1) {
      return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p
          .removeFirstSegments(1).makeAbsolute().toString());
    } else {
      return getBundledImageDescriptor(p.makeAbsolute().toString());
    }
  }
View Full Code Here


                    //No good: try to get it relative to the project
                    String curr = currentPath;
                    IPath path = new Path(curr.trim());
                    if (project.getFullPath().isPrefixOf(path)) {
                        path = path.removeFirstSegments(1);
                        if (FileTypesPreferencesPage.isValidZipFile(curr)) {
                            r = project.getFile(path);

                        } else {
                            //get it relative to the project
View Full Code Here

                    IPath p = new Path(path);
                    if (p.isEmpty()) {
                        continue; //go to the next...
                    }
                    if (projectPath != null && !projectPath.isPrefixOf(p)) {
                        p = p.removeFirstSegments(1);
                        p = projectPath.append(p);
                        restore = true;
                    }
                    buffer.append(p.toString());
                }
View Full Code Here

      IPath workspaceLocation = workspace.getRoot().getRawLocation();
      IPath relLocation = null;
      if (location.toOSString().toLowerCase().startsWith(
            workspaceLocation.toOSString().toLowerCase()))
      {
        relLocation = location.removeFirstSegments(
            location.matchingFirstSegments(workspaceLocation));
      }

      // project is outside the workspace otherwise not at the top of the
      // workspace
View Full Code Here

      // to force eclipse to move the project to the default location in the
      // workspace. Also, take the last segment as the new project name.
      if (location.toOSString().toLowerCase().startsWith(
            workspaceLocation.toOSString().toLowerCase()))
      {
        String name = location.removeFirstSegments(
            location.matchingFirstSegments(workspaceLocation)).toString();
        // hack for windows... manually remove drive letter
        name = name.replaceFirst("^[A-Z]:", "");
        name = name.replaceFirst("/$", "");
View Full Code Here

  for (int i = 0; i < length; i++) {
    String resName = (String) entryNames.get(i);
    // consider that a .java file is not a non-java resource (see bug 12246 Packages view shows .class and .java files when JAR has source)
    if (!Util.isJavaLikeFileName(resName)) {
      IPath filePath = new Path(resName);
      IPath childPath = filePath.removeFirstSegments(this.names.length);
      if (jarEntries.containsKey(childPath)) {
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=222665
        continue;
      }
      JarEntryFile file = new JarEntryFile(filePath.lastSegment());
View Full Code Here

                    .getLocationURI().getPath());
                IPath filePath = new Path(localFile
                    .toLocalFile(EFS.NONE, null)
                    .getAbsolutePath());
                if (linkPath.isPrefixOf(filePath)) {
                  filePath = filePath.removeFirstSegments(
                      linkPath.segmentCount()).setDevice(
                      null);
                  relativePath = relativePath
                      .append(filePath);
View Full Code Here

      IPath remotePath = new Path(remoteFile);
      int size = remotePath.segmentCount();
      for (int j = 0; j < size; j++) {
        String segment = remotePath.segment(j);
        if (segment.equals(projectName)) {
          remotePath = remotePath.removeFirstSegments(j);
          size = remotePath.segmentCount();
          for (int i = 0; i < size; i++) {
            remotePath = remotePath.removeFirstSegments(1);
            if (remotePath.segmentCount() > 0) {
              IResource res = project.getFile(remotePath);
View Full Code Here

        String segment = remotePath.segment(j);
        if (segment.equals(projectName)) {
          remotePath = remotePath.removeFirstSegments(j);
          size = remotePath.segmentCount();
          for (int i = 0; i < size; i++) {
            remotePath = remotePath.removeFirstSegments(1);
            if (remotePath.segmentCount() > 0) {
              IResource res = project.getFile(remotePath);
              if (res != null && res.exists()) {
                return project.getFullPath().append(remotePath)
                    .toString();
View Full Code Here

          File file = includePath.append(remotePath).toFile();
          if (file.exists()) {
            return file.toString();
          }
        }
        remotePath = remotePath.removeFirstSegments(1);
      }
    }
    return remoteFile;
  }
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.