Package org.eclipse.wst.common.componentcore.resources

Examples of org.eclipse.wst.common.componentcore.resources.IVirtualFile


            referenceRuntimePath = new Path(reference);
          }
          else {
            referenceRuntimePath = baseRuntimePath.removeLastSegments(1).append(reference);
          }
          IVirtualFile virtualFile = ComponentCore.createFile(project, referenceRuntimePath);
          if (virtualFile != null && virtualFile.exists()) {
            IFile[] underlyingFiles = virtualFile.getUnderlyingFiles();
            for (int j = 0; j < underlyingFiles.length; j++) {
              if (underlyingFiles[j].getProject().equals(project) && underlyingFiles[j].exists()) {
                mapForBaseResource.put(reference, new SoftReference(underlyingFiles[j].getFullPath()));
                resolved = underlyingFiles[j].getFullPath();
              }

            }
          }
        }
      }
      return resolved;
    }
    else {
      IVirtualFile virtualFile = ComponentCore.createFile(project, new Path(reference));
      if (virtualFile != null && virtualFile.exists()) {
        return virtualFile.getUnderlyingFile().getFullPath();
      }
    }
    return null;
  }
View Full Code Here


          else {
            IPath baseRuntimePath = virtualResources[i].getRuntimePath();
            referenceRuntimePath = baseRuntimePath.removeLastSegments(1).append(reference);
          }
         
          IVirtualFile virtualFile = ComponentCore.createFile(project, referenceRuntimePath);
          if (virtualFile != null && virtualFile.exists()) {
            IFile[] underlyingFiles = virtualFile.getUnderlyingFiles();
            for (int j = 0; j < underlyingFiles.length; j++) {
              if (underlyingFiles[j].getProject().equals(project) && underlyingFiles[j].isAccessible()) {
                return underlyingFiles[j].getFullPath();
              }

            }
          }
          else {
            // http://bugs.eclipse.org/338751
            IVirtualFolder virtualFolder = ComponentCore.createFolder(project, referenceRuntimePath);
            if (virtualFolder != null && virtualFolder.exists()) {
              IContainer[] underlyingFolders = virtualFolder.getUnderlyingFolders();
              for (int j = 0; j < underlyingFolders.length; j++) {
                if (underlyingFolders[j].getProject().equals(project) && underlyingFolders[j].isAccessible()) {
                  return underlyingFolders[j].getFullPath();
                }
              }
            }
          }
        }
      }
    }
    else {
      IVirtualFile virtualFile = ComponentCore.createFile(project, new Path(reference));
      if (virtualFile != null && virtualFile.exists()) {
        return virtualFile.getUnderlyingFile().getFullPath();
      }
    }
    return null;
  }
View Full Code Here

    IVirtualContainer webRoot = getWebRoot();
    if (! webRoot.exists()){
      getValidationMessages().add(new ValidationMessage( Messages.WebPathType_1));
    }
    else {
      IVirtualFile file = webRoot.getFile(new Path(value));
      if (!file.exists()) {
        //was this a valid file path string, or bogus url?
        getValidationMessages().add(new ValidationMessage(Messages.WebPathType_2));
      }                 
      //we could also validate the expected file-extensions from meta data
    }
View Full Code Here

        IPath filePath = resource.getFullPath();
    if (filePath.matchingFirstSegments(webContentPath) == webContentPath.segmentCount()) {
      filePath = filePath.removeFirstSegments(webContentPath.segmentCount());
      filePath = filePath.removeLastSegments(1);
      filePath = filePath.append(value);
      IVirtualFile file = getWebRoot().getFile(filePath);
      if (!file.exists()){
        getValidationMessages().add(new ValidationMessage(Messages.WebPathType_2));
      }
    }
  }
View Full Code Here

        value = value.substring(0, index);
      }
      if (value != null && value.length() > 1) {
        IVirtualFolder webRoot = ComponentCore.createComponent(jsp.getProject()).getRootFolder();
        if (value.charAt(0) == '/') {
          IVirtualFile file = webRoot.getFile(new Path(value));
          if (file.exists()) {
            return true;
          }
        } else {
          IPath webContentPath = webRoot.getUnderlyingFolder().getFullPath();
          IPath filePath = jsp.getFullPath();
          if (filePath.matchingFirstSegments(webContentPath) == webContentPath.segmentCount()) {
            String extension = filePath.getFileExtension();
            filePath = filePath.removeFirstSegments(webContentPath.segmentCount());
            filePath = filePath.removeLastSegments(1);
            filePath = filePath.append(value);
            if (filePath.getFileExtension() == null && extension != null) {
              filePath = filePath.addFileExtension(extension);
            }
            IVirtualFile file = webRoot.getFile(filePath);
            if (file.exists()) {
              return true;
            }
          }
        }
      }
View Full Code Here

          referenceRuntimePath = new Path(reference);
        }
        else {
          referenceRuntimePath = baseRuntimePath.removeLastSegments(1).append(reference);
        }
        IVirtualFile virtualFile = ComponentCore.createFile(project, referenceRuntimePath);
        if (virtualFile != null && virtualFile.exists()) {
          IFile[] underlyingFiles = virtualFile.getUnderlyingFiles();
          for (int j = 0; j < underlyingFiles.length; j++) {
            if (underlyingFiles[j].getProject().equals(project) && underlyingFiles[j].exists()) {
              return underlyingFiles[j].getFullPath();
            }

          }
        }
      }
    }
    else {
      IVirtualFile virtualFile = ComponentCore.createFile(project, new Path(reference));
      if (virtualFile != null && virtualFile.exists()) {
        return virtualFile.getUnderlyingFile().getFullPath();
      }
    }
    return null;
  }
View Full Code Here

      return;
    }
     
    if( isFile) {
      if( !map.containsKey(resource.getName()) ) {
        IVirtualFile virtFile = new VirtualFile(getProject(),
            getRuntimePath().append(((IFile)resource).getName()), (IFile)resource) {
         
          @Override
          public IPath getWorkspaceRelativePath() {
            IPath wrp = resource.getFullPath();
View Full Code Here

TOP

Related Classes of org.eclipse.wst.common.componentcore.resources.IVirtualFile

Copyright © 2018 www.massapicom. 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.