Package org.eclipse.core.runtime

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


    for (int i = 0; i < max; i++) {
      String resName = resNames[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);
        JarEntryFile file = new JarEntryFile(filePath.lastSegment());
        jarEntries.put(childPath, file);
        if (childPath.segmentCount() == 1) {
          file.setParent(pkg);
          topJarEntries.add(file);
View Full Code Here


      File file = files[i];
      if (file.isDirectory()) {
        hasSubDirectories = true;
        if (firstLevelPackageNames.contains(file.getName())) {
          IPath fullPath = new Path(file.getParentFile().getPath());
          IPath rootPathEntry = fullPath.removeFirstSegments(this.sourcePath.segmentCount()).setDevice(null);
          set.add(rootPathEntry);
          break loop;
        } else {
          computeRootPath(file, firstLevelPackageNames, hasDefaultPackage, set);
        }
View Full Code Here

        }
      } else if (i == max - 1 && !hasSubDirectories && hasDefaultPackage) {
        File parentDir = file.getParentFile();
        if (parentDir.list(FILENAME_FILTER).length != 0) {
          IPath fullPath = new Path(parentDir.getPath());
          IPath rootPathEntry = fullPath.removeFirstSegments(this.sourcePath.segmentCount()).setDevice(null);
          set.add(rootPathEntry);
        }
      }
    }
  } 
View Full Code Here

        final IWorkspace workspace = ResourcesPlugin.getWorkspace();
        final IWorkspaceRoot workspaceRoot = workspace.getRoot();
        IPath workspacePath = workspaceRoot.getLocation();

        if (workspacePath.isPrefixOf(path)) {
            final IPath relativePath = path.removeFirstSegments(workspacePath.segmentCount());
            IResource resource;
            if (file.isDirectory()) {
                resource = workspaceRoot.getFolder(relativePath);
            } else {
                resource = workspaceRoot.getFile(relativePath);
View Full Code Here

   */
  public IStorage create(String name) {
    IPath path = new Path(name);
    VOrionStorage parent = (VOrionStorage) this.createProject(path.segment(0));
    if (path.segmentCount() > 1) {
      return parent.create(path.removeFirstSegments(1).toString());
    }
    return parent;
  }

  public void mkdir() throws IOException {
View Full Code Here

    IPath path = new Path(pathInfo);
    if ( path.hasTrailingSeparator() ) {
      path = path.removeTrailingSeparator();
    }

    path = path.removeFirstSegments(1);
    String userName = path.segment(0);
    if ( path.segmentCount() < 4 || !path.segment(1).equals("ws") || !path.segment(2).equals("workspace") ) {
      theLogger.warning("incorrectly formed workspace path: " + path);
      resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
View Full Code Here

    if ( path.segmentCount() < 4 || !path.segment(1).equals("ws") || !path.segment(2).equals("workspace") ) {
      theLogger.warning("incorrectly formed workspace path: " + path);
      resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
      return;
    }
    path = path.removeFirstSegments(3);

    /* unlocking user directory to un-authenticated users */
    try {
      if ( user == null ) {
        user = ServerManager.getServerManager().getUserManager().getUser(userName);
View Full Code Here

  private boolean containsPublishedFiles(IStorage dir, IDesignerUser user, String timeStamp){
    for(Version version : user.getVersions()){
      if(!version.getTime().equals(timeStamp)) continue;
      for(String res : version.resources){
        IPath resPath = new Path(res);
        while(resPath.segment(0).equals(".")) resPath = resPath.removeFirstSegments(1);
        if(dir.getName().equals(resPath.segment(0))){
          return true;
        }
      }
    }
View Full Code Here

              if (files[i] == null) {
                  continue;
              }
              IPath myPath = new Path(this.resourcePointer.getPath());
              IPath itemPath = new Path(files[i].getPath());
              IPath newPath = itemPath.removeFirstSegments(myPath.matchingFirstSegments(itemPath));
              IVResource item = null;
             
              String[] pathSplit = newPath.segments();
             
              IVResource parent = this;
View Full Code Here

        // Path(virtualRoot).matchingFirstSegments(p1));
        URL[] files = this.library.find(p1.append(childName).toString(), false, this.sourceElement);
        for (int i = 0; i < files.length; i++) {
            IPath myPath = new Path(this.resourcePointer.getPath());
            IPath itemPath = new Path(files[i].getPath());
            IPath newPath = itemPath.removeFirstSegments(myPath.matchingFirstSegments(itemPath));
            IVResource item = new VLibraryResource(this.library, files[i],  newPath.removeTrailingSeparator().toString(), new Path(this.bundleRoot)
                    .append(newPath).toString());

            item.setParent(this);
            if (item != null) {
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.