Package org.eclipse.core.runtime

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


      exporter.write(file, destinationPath);
    }

    private String getDestinationPath(File file) {
      IPath filePath = new Path(file.getAbsolutePath());
      filePath = filePath.removeFirstSegments(path.segmentCount());
      filePath = filePath.setDevice(null);
      return filePath.toString();
    }
  }
View Full Code Here


      if (path.segmentCount() == 1) {
        varPath = variables.get(variableName);
      } else {
        varPath = variables.get(path.segment(0));
        if (varPath != null) {
          varPath = varPath.append(path.removeFirstSegments(1));
        }
      }
      return varPath;
    }
View Full Code Here

      // TODO lets for now hardcode this is arduino
      for (int cursegment = 0; cursegment < platformFilename.segmentCount(); cursegment++) {
    if (ARDUINO_HARDWARE_FOLDER_NAME.equals(platformFilename.segment(cursegment))) {

        platformFilename = getArduinoPath().append(ARDUINO_HARDWARE_FOLDER_NAME).append("arduino")
          .append(platformFilename.removeFirstSegments(cursegment + 2));
        cursegment = platformFilename.segmentCount();
    }
      }
  }
  String boardName = Common.getBuildEnvironmentVariable(confDesc, ArduinoConst.ENV_KEY_JANTJE_BOARD_NAME,
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

      throw new IllegalArgumentException(Messages.ArtifactHelper_Error_Artifact_Must_Not_Be_Null);
    }
   
    IPath m2repo = JavaCore.getClasspathVariable(BuildPathManager.M2_REPO); //always set
    IPath absolutePath = new Path(artifact.getFile().getAbsolutePath());
    IPath relativePath = absolutePath.removeFirstSegments(m2repo.segmentCount()).makeRelative().setDevice(null);
    return relativePath;
  }
 
  /**
   * Returns an IProject from a maven artifact
View Full Code Here

    getWizard().getContainer().run(true, true, scanner);

    if (scanner.getConsole() != null && scanner.getConsole().exists()) {
      IPath newConsolePath = new Path(scanner.getConsole().getAbsolutePath());
      newConsolePath = newConsolePath.removeFirstSegments(sourcePath.segmentCount());
      consoleButton.setText(newConsolePath.setDevice(null).toOSString());
      consolePath = newConsolePath;
    }

    if (scanner.getContainer() != null && scanner.getContainer().exists()) {
View Full Code Here

    String uriPath = uri.path();
    IPath p = new Path(uriPath);
    if("pptp".equals(p.getFileExtension()))
      return 0; // All pptp are searched first - ALWAYS
    if(uri.isPlatformResource())
      p = p.removeFirstSegments(2);
    for(int idx = 0; idx < searchPath.size(); idx++) {
      IPath q = searchPath.get(idx);
      if(isMatch(p, q))
        return idx + 1;
View Full Code Here

      // first check the location in the project that this pattern resolver is associated with (most likely path)
      Path path = new Path(((FileSystemResource) resource).getPath());
      IPath projectLocation = this.project.getLocation();
      if (projectLocation.isPrefixOf(path)) {
        int segmentsToRemove = projectLocation.segmentCount();
        IPath projectRelativePath = path.removeFirstSegments(segmentsToRemove);
        IFile file = this.project.getFile(projectRelativePath);
        if (file != null && file.exists()) {
          return new FileResource(file);
        }
      }
View Full Code Here

   * Create a CodeSetEntry that wraps a ZipEntry
   */
  private CodeSetEntry csEntry(final ZipFile zip, final ZipEntry e) {
    IPath zipPath = new Path(e.getName()); //path relative to zip file
    Assert.isTrue(root.isPrefixOf(zipPath));
    final IPath csPath = zipPath.removeFirstSegments(root.segmentCount());
    return new CodeSetEntry() {
      @Override
      public IPath getPath() {
        return csPath;
      }
View Full Code Here

      Enumeration<? extends ZipEntry> iter = zip.entries();
      while (iter.hasMoreElements() && result==null) {
        ZipEntry el = iter.nextElement();
        Path zipPath = new Path(el.getName());
        if (root.isPrefixOf(zipPath)) {
          String key = zipPath.removeFirstSegments(root.segmentCount()).toString();
          if ("".equals(key)) {
            //path maches exactly, this means we hit the root of the
            // code set. Do not store it because the root of a codeset
            // is not actually an element of the codeset!
          } else {
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.