Package org.eclipse.core.runtime

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


  }
 
  public ILibraryFinder getInstance(URI baseResource, String project) {
    // TODO Auto-generated method stub
    IPath p = new Path(baseResource.getPath());
    String projectPiece = p.segment(p.segmentCount()-1);
   
    return new DojoLibraryFinder(baseResource, project);
  }

  private static URI appendPath(URI u, String piece){
View Full Code Here


          destinationDir.mkdirs();
          IStorage libsSettingsSource = file.newInstance(file, IDavinciServerConstants.LIBS_SETTINGS);
          IStorage libsSettingsDestination = destinationDir.newInstance(destinationDir, IDavinciServerConstants.LIBS_SETTINGS);
          // Strip out the "WebContent/" string from the library paths in libs.settings before writing out to the template.
          copyFileStripWebContent(libsSettingsSource, libsSettingsDestination);
        }else if(file.isDirectory() && path.segmentCount() > 1 && path.segment(1).equals(IDavinciServerConstants.WEBCONTENT)){
          // Copy the contents of WebContent/* into the base folder for the template
          copyDirectory(file, templateDir);
        }else if (file.isFile()) {
          IStorage destination = templateDir.newInstance(templateDir, file.getName());
          copyFile(file, destination);
View Full Code Here

      String root = getRoot(srcLib, projectLibs);
      if (root.charAt(0) == '/') {
        root = root.substring(1);
      }
      IPath srcLibPath = new Path(root);
      IPath srcRelPath = srcPath.removeFirstSegments(srcLibPath.segmentCount());
      if (srcPath.toString().startsWith(root)) {
        URL url = srcLib.getURL(srcRelPath.toString(), true);
        if (url != null) {
          if (logger.isLoggable(Level.FINEST)) {
            logger.logp(Level.FINEST, getClass().getName(), "_getResource", "resource ["+srcPath.toString() +"] loaded from srclib ["+srcLib.getID()+"]");
View Full Code Here


  protected IVResource getLibFile(String p1) {
    IPath path = new Path(p1);
    IVResource root = this.workspace;
    for (int i = 0; i < path.segmentCount() && root != null; i++) {
      root = root.get(path.segment(i));

    }

    return root;
View Full Code Here

          /*
           * security check, dont want to return a resource BELOW the workspace
           * root
           */
          IPath workspaceRoot = new Path(this.userDirectory.getAbsolutePath());
          if (a.matchingFirstSegments(workspaceRoot) != workspaceRoot.segmentCount()) {
              return null;
          }

          File f1 = new File(a.toOSString());

View Full Code Here

        IPath path = new Path(file.getPath());
       
        if(path==null) return false;
       
        for (int i = 0; i < this.filterDirs.length; i++) {
            for(int k=0;k<path.segmentCount();k++){
              String seg = path.segment(k);
              if(seg!=null && seg.equalsIgnoreCase(filterDirs[i])) return true;
            }
           
           
View Full Code Here

   *            the IFileDelta containing the file name to get
   * @return the IFile
   */
  public IFile getFile(String delta) {
    IPath path = new Path(delta);
    if (path.segmentCount() > 1) {
      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (file != null && file.exists())
        return file;
    }
    return null;
View Full Code Here

    IResource baseResource = FileBuffers.getWorkspaceFileAtLocation(baseIPath);

    if (baseResource == null) {
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
      // Try the base path as a folder first
      if (baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFolder(baseIPath);
      }
      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
View Full Code Here

      // Try the base path as a folder first
      if (baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFolder(baseIPath);
      }
      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
      }
      if (baseResource == null && baseIPath.segmentCount() == 1) {
        baseResource = workspaceRoot.getProject(baseIPath.segment(0));
      }
View Full Code Here

      }
      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
      }
      if (baseResource == null && baseIPath.segmentCount() == 1) {
        baseResource = workspaceRoot.getProject(baseIPath.segment(0));
      }
    }

    if (baseResource == 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.