Package org.eclipse.core.runtime

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


    } else if (_selectedElement instanceof IFile) {
      result = ((IFile) _selectedElement).getFullPath();
    }
    if (result != null) {
      if (result.segmentCount() > 2) {
        result = result.removeFirstSegments(2);
      }
    }
    return result;
  }
}
View Full Code Here


      IVirtualFolder webContentFolder = getWebContentFolder(file.getProject());
      if (webContentFolder != null) {
        IPath webContentPath = webContentFolder.getProjectRelativePath();
        IPath filePath = file.getProjectRelativePath();
        int matchingFirstSegments = webContentPath.matchingFirstSegments(filePath);
        path = filePath.removeFirstSegments(matchingFirstSegments);
      }
    }
    return path;
  }
View Full Code Here

        } else {
          IPath webContentPath = webRoot.getUnderlyingFolder().getFullPath();
          IPath filePath = jsp.getFullPath();
          if (filePath.matchingFirstSegments(webContentPath) == webContentPath.segmentCount()) {
            String extension = filePath.getFileExtension();
            filePath = filePath.removeFirstSegments(webContentPath.segmentCount());
            filePath = filePath.removeLastSegments(1);
            filePath = filePath.append(value);
            if (filePath.getFileExtension() == null && extension != null) {
              filePath = filePath.addFileExtension(extension);
            }
View Full Code Here

   */
  private static final String getTypeName(IResource res) {
    IPath path = res.getFullPath();
    // Assume under Web Content folder if more than 2 segments
    if (path.segmentCount() > 2) {
      path = path.removeFirstSegments(2);
    }
    else {
      path = path.removeFirstSegments(1);
    }
    String typeName = path.toString().replace(IPath.SEPARATOR, '.');
View Full Code Here

    // Assume under Web Content folder if more than 2 segments
    if (path.segmentCount() > 2) {
      path = path.removeFirstSegments(2);
    }
    else {
      path = path.removeFirstSegments(1);
    }
    String typeName = path.toString().replace(IPath.SEPARATOR, '.');
    if (res.getFileExtension() != null) {
      typeName = typeName.substring(0, typeName.lastIndexOf('.'));
    }
View Full Code Here

        IPath srcPath = new Path(newSourceLocation);
        if (workspaceRoot.findMember(srcPath) != null) {
          sourceLocation = newSourceLocation;
        } else if (wsRootPath.isPrefixOf(srcPath)) {
          int segmentsMatched = wsRootPath.matchingFirstSegments(srcPath);
          srcPath = srcPath.removeFirstSegments(segmentsMatched).setDevice(null);
          sourceLocation = srcPath.toOSString();
        } else {
          sourceLocation = newSourceLocation;
          relativeToWorkspace = false;
        }
View Full Code Here

    dialog.showClosedProjects(false);
    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
      IPath path = (IPath) results[0];
      path = path.removeFirstSegments(1);
      String containerName = path.makeRelative().toString();
      fWebAppDirText.setText(containerName);
    }
  }
View Full Code Here

    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0)
        && (results[0] instanceof IPath)) {
      IPath path = (IPath) results[0];
      path = path.removeFirstSegments(1);
      String containerName = path.makeRelative().toString();
      fWebAppDirText.setText(containerName);
    }
  }
View Full Code Here

    dialog.open();
    Object[] results = dialog.getResult();
    if ((results != null) && (results.length > 0)
        && (results[0] instanceof IPath)) {
      IPath path = (IPath) results[0];
      path = path.removeFirstSegments(1);
      String containerName = path.makeRelative().toString();
      fWebAppDirText.setText(containerName);
    }
  }
View Full Code Here

   * @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

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.