Package org.eclipse.core.runtime

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


      if (root == null || root.segmentCount() <= 1) {
        throw new RuntimeException("Error getting composer vendor path");
      }

      vendorPath = root.removeLastSegments(1).addTrailingSeparator().append(vendor);
    }
    return vendorPath;
  }

  @Override
View Full Code Here


    final String fileContent = "<html><body>This is a test file</body></html>";
    WebResponse createdFile = createFileOnServer("", filename, fileContent);
    URL fileLocation = createdFile.getURL();
    IPath filepath = new Path(fileLocation.getPath());
    filepath = filepath.removeFirstSegments(new Path(FILE_SERVLET_LOCATION).segmentCount()); // chop off leading /file/
    filepath = filepath.removeLastSegments(1); // chop off trailing /foo.html
    filepath = filepath.makeAbsolute();
    filepath = filepath.addTrailingSeparator();
    String parentFolder = filepath.toString();

    // User B: Give access to test's workspace
View Full Code Here

    JSONArray diffs = new JSONArray();
    URI diffLocation = getURI(request);
    if (pattern != null) {
      IPath patternPath = new Path(pattern);
      IPath diffPath = new Path(diffLocation.getPath());
      diffPath = diffPath.removeLastSegments(patternPath.segmentCount());
      diffLocation = new URI(diffLocation.getScheme(), diffLocation.getAuthority(), diffPath.toPortableString(), null, null);
    }
    URI cloneLocation = BaseToCloneConverter.getCloneLocation(diffLocation, BaseToCloneConverter.DIFF);

    int page = request.getParameter("page") != null ? new Integer(request.getParameter("page")).intValue() : 0; //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

            && !f.getName().contains(".doc.source")) {
          String versionName = fPath
              .segment(fPath.segmentCount() - 3);
          String siteName = fPath.segment(fPath.segmentCount() - 4);

          displayNameFile = fPath.removeLastSegments(3).append(
              "displayname.txt").toFile();
          if (displayNameFile.exists()) {
            try {
              siteDisplayName = FileUtil.getContent(
                  displayNameFile, "UTF-8").toString().trim();
View Full Code Here

            if (element.equals(fProvider.getRoot())) {
                return null;
            }
            IPath path= new Path(fProvider.getFullPath(element));
            if (path.segmentCount() > 0) {
                return findElement(path.removeLastSegments(1));
            }
            return fProvider.getRoot();
        }
   
        /* non java-doc
View Full Code Here

  public ICompilationUnit createCompilationUnit(
      IPackageFragmentRoot fragmentRoot, String testsrc, String path)
      throws CoreException, IOException {
    IPath typepath = new Path(path);
    String pkgname = typepath.removeLastSegments(1).toString()
        .replace('/', '.');
    IPackageFragment fragment = createPackage(fragmentRoot, pkgname);
    StringBuffer sb = new StringBuffer();
    InputStream source = openTestResource(new Path(testsrc).append(typepath));
    Reader r = new InputStreamReader(source);
View Full Code Here

          while (true) {
            ZipEntry entry = zip.getNextEntry();
            if (entry == null) break;
            if (!entry.isDirectory() && entry.getName().startsWith(prefix) && entry.getName().endsWith(JAVA_EXT)) {
              IPath path = srcfolder.append(entry.getName().substring(prefix.length()));
              path.removeLastSegments(1).toFile().mkdirs();
              OutputStream out = new FileOutputStream(path.toFile());
              int len;
              while ((len = zip.read(buffer)) != -1) {
                out.write(buffer, 0, len);
              }
View Full Code Here

  MonitoredResource monitoredResourceForPath(IPath path) {
    IPath aPath = path;
    MonitoredResource resource = _resources.get(aPath);
    while (resource == null && !path.isRoot() && !"/".equals(aPath.toPortableString())) {
      aPath = aPath.removeLastSegments(1);
      resource = _resources.get(aPath);
    }
    return resource;
  }
View Full Code Here

      } catch (NumberFormatException e) {
        JdtPlugin.getDefault().getPluginLogger().log(e);
        throw new PathCoderException();
      }
      IPath entryPath = path.removeFirstSegments(i + 1);
      entryPath = entryPath.removeLastSegments(entryPath.segmentCount() - integer.intValue());
      arrayList.add(entryPath);
      i = i + integer.intValue() + 1;
    }
    return arrayList.toArray(new IPath[arrayList.size()]);
  }
View Full Code Here

    String gradlePath = null;
    boolean useWrapper = preferenceStore.getBoolean(GradleConstants.GRADLE_USE_WRAPPER);
    if (useWrapper){
      String file1 = configuration.getAttribute(GradleConstants.KEY_FILE_PATH,  "");
      IPath ipath = ResourcesPlugin.getWorkspace().getRoot().findMember(file1).getLocation();
      String filePath1 = ipath.removeLastSegments(1).toOSString();
      gradlePath = filePath1 + (isWindows?"\\gradlew.bat":"/gradlew");
      File gradlewFile = (new File(gradlePath));
      useWrapper = gradlewFile.exists();
    }
    if (!useWrapper){
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.