Package org.eclipse.core.runtime

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


    Path p = new Path(path);
    if (p.segment(1).equals("file")) { //$NON-NLS-1$
      // expected path: /gitapi/remote/{remote}/file/{path}
      String remoteName = p.segment(0);

      File gitDir = GitUtils.getGitDir(p.removeFirstSegments(1));
      Repository db = null;
      try {
        db = FileRepositoryBuilder.create(gitDir);
        StoredConfig config = db.getConfig();
        config.unsetSection(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName);
View Full Code Here


  @PropertyDescription(name = GitConstants.KEY_DIFF)
  private URI getDiffLocation() throws URISyntaxException {
    Assert.isNotNull(cloneLocation);
    IPath basePath = new Path(cloneLocation.getPath());
    IPath p = new Path(GitServlet.GIT_URI).append(Diff.RESOURCE).append(getName(false, true)).append(basePath.removeFirstSegments(2));
    return new URI(cloneLocation.getScheme(), cloneLocation.getUserInfo(), cloneLocation.getHost(), cloneLocation.getPort(), p.toString(),
        cloneLocation.getQuery(), cloneLocation.getFragment());
  }

  @PropertyDescription(name = ProtocolConstants.KEY_NAME)
View Full Code Here

     * Dispatch the request.
     */
    IPath path = new Path(pathInfo);
    if (FileAppenderResource.RESOURCE.equals(path.segment(0)))
      return fileAppenderHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

    if (RollingFileAppenderResource.RESOURCE.equals(path.segment(0)))
      return rollingFileAppenderHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

View Full Code Here

      return fileAppenderHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

    if (RollingFileAppenderResource.RESOURCE.equals(path.segment(0)))
      return rollingFileAppenderHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

    if (LoggerResource.RESOURCE.equals(path.segment(0)))
      return loggerHandler.handleRequest(request, response,
          path.removeFirstSegments(1));
View Full Code Here

      return rollingFileAppenderHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

    if (LoggerResource.RESOURCE.equals(path.segment(0)))
      return loggerHandler.handleRequest(request, response,
          path.removeFirstSegments(1));

    /* unsupported request */
    return false;
  }
}
View Full Code Here

  @Override
  protected URI getLocation() throws URISyntaxException {
    if (tagLocation == null) {
      IPath p = new Path(cloneLocation.getPath());
      p = p.uptoSegment(1).append(RESOURCE).append(getName(false, true)).addTrailingSeparator().append(p.removeFirstSegments(2));
      tagLocation = new URI(cloneLocation.getScheme(), cloneLocation.getUserInfo(), cloneLocation.getHost(), cloneLocation.getPort(), p.toString(),
          cloneLocation.getQuery(), cloneLocation.getFragment());
    }
    return tagLocation;
  }
View Full Code Here

  @PropertyDescription(name = GitConstants.KEY_COMMIT)
  private URI getCommitLocation() throws URISyntaxException {
    if (commitLocation == null) {
      IPath p = new Path(cloneLocation.getPath());
      p = p.uptoSegment(1).append(Commit.RESOURCE).append(parseCommit().getName()).addTrailingSeparator().append(p.removeFirstSegments(2));
      commitLocation = new URI(cloneLocation.getScheme(), cloneLocation.getUserInfo(), cloneLocation.getHost(), cloneLocation.getPort(), p.toString(),
          cloneLocation.getQuery(), cloneLocation.getFragment());
    }
    return commitLocation;
  }
View Full Code Here

  }

  private URI createLocation(String resource) throws URISyntaxException {
    String shortName = getName(false, true);
    IPath basePath = new Path(cloneLocation.getPath());
    IPath newPath = new Path(GitServlet.GIT_URI).append(resource).append(shortName).append(basePath.removeFirstSegments(2));
    return new URI(cloneLocation.getScheme(), cloneLocation.getUserInfo(), cloneLocation.getHost(), cloneLocation.getPort(), newPath.toString(),
        cloneLocation.getQuery(), cloneLocation.getFragment());
  }

  // TODO: expandable
View Full Code Here

    try {
      IPath p = new Path(path);
      String gitSegment = null;
      if (p.segment(1).equals("file")) { //$NON-NLS-1$
        gitSegment = GitUtils.decode(p.segment(0));
        p = p.removeFirstSegments(1);
      }
      IPath filePath = p;
      if (!AuthorizationService.checkRights(request.getRemoteUser(), "/" + filePath.toString(), request.getMethod())) {
        response.sendError(HttpServletResponse.SC_FORBIDDEN);
        return true;
View Full Code Here

        OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
        return true;
      }

      gitSegment = GitUtils.decode(filterPath.segment(0));
      filterPath = filterPath.removeFirstSegments(1);
      pattern = filterPath.toPortableString();
      ObjectId head = repo.resolve(gitSegment);
      if (head == null) {
        throw new Exception("Missing ref in git segment");
      }
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.