Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFile


   * @return true/false
   */

 
  public static boolean isDirlinkFolder(IFolder container){
    IFile dirlink = container.getFile(new Path(WGUtils.DIRLINK_FILE))
    return dirlink.exists();
  }
View Full Code Here


  }

  private static IFile lookupFileReference(String referencePath, IFolder folder) {
    if (referencePath != null) {
      // first try - use unmodified referencePath
      IFile referenceFile = folder.getFile(new Path(referencePath));
      if (referenceFile.exists()) {
        return referenceFile;
      }

      // second try - lowercase referencePath
      referenceFile = folder.getFile(new Path(referencePath.toLowerCase()));
      if (referenceFile.exists()) {
        return referenceFile;
      }

      // third try - case insensitiv match on all files in folder
      CaseInsensitivReferenceSearcher searcher = new CaseInsensitivReferenceSearcher(referencePath, folder);
View Full Code Here

  public String determineDesignEncoding() {
    return determineDesignEncoding(System.getProperty("file.encoding", "UTF-8"));
  }

  private String determineDesignEncoding(String fallBackEncoding) {
    IFile syncInfo = _syncInfo;
    if (syncInfo != null) {
      try {
        WGADesignConfigurationModel model = new WGADesignConfigurationModel(syncInfo.getLocation().toFile());
        Encoding encoding = model.getDesignEncoding();
        if (encoding != null && !encoding.getKey().equals(WGADesignConfigurationModel.STRING_NOT_SET)) {
          return encoding.getKey();
        } else {
          Activator.getDefault().getLog().log(
              new Status(Status.WARNING, Activator.PLUGIN_ID, "Design encoding not set for design '" + syncInfo.getParent().getLocation().toString() + "'. Using platform encoding '"
                  + fallBackEncoding + "'."));
          return fallBackEncoding;
        }
      } catch (IOException e) {
        Activator.getDefault().getLog().log(
            new Status(Status.ERROR, Activator.PLUGIN_ID, "Unable to determine design encoding for design '" + syncInfo.getParent().getLocation().toString()
                + "'. Using platform encoding '" + fallBackEncoding + "'."));
        return fallBackEncoding;
      }
    } else {
      Activator.getDefault().getLog().log(new Status(Status.WARNING, Activator.PLUGIN_ID, "TMLFile is not member of an WGADesign. Using platform encoding '" + fallBackEncoding + "'."));
View Full Code Here

  public Set<IFile> getLabelFiles(IFolder labelContainer) throws CoreException {

    Set<IFile> files = new HashSet<IFile>();
    for (IResource innercurrent : labelContainer.members()) {
      if (innercurrent instanceof IFile) {
        IFile currentFile = (IFile) innercurrent;
        if (currentFile.getFileExtension().equals("properties")) {
          files.add(currentFile);
        }

      }
    }
View Full Code Here

  public IFile getLabelFile(String labelFileName) throws CoreException {
    IFolder labelContainer = getLabelContainer(getDevelopmentLanguage());
    if (labelContainer != null) {
      String completeFilename = labelFileName + ".properties";
      IFile labelFile = labelContainer.getFile(completeFilename);
      if (labelFile.exists()) {
        return labelFile;
      } else {
        // try case insensitiv search
        CaseInsensitivSearcher searcher = new CaseInsensitivSearcher(completeFilename);
        labelContainer.accept(searcher, IResource.DEPTH_ONE, IResource.FILE);
View Full Code Here

  public static boolean isWGAVersionComplianceCompatible(IResource resource) {
      return getWGAVersionCompliance(resource, false) != null;
  }

  private static VersionCompliance getWGAVersionCompliance(IResource resource, boolean fallbackToDefault) { 
    IFile wgaConfFile = WGADesignStructureHelper.determineSyncInfo(resource);   
    VersionCompliance wgaVersionCompliance = null;
    if (wgaConfFile != null) {
      WGADesignConfigurationModel currentWGAConf;
      try {
        currentWGAConf = new WGADesignConfigurationModelWrapper(wgaConfFile);
View Full Code Here

   
  }

  public void createLabel(String labelFileName, String key, String value) throws CoreException {
    IFolder labelContainer = getLabelContainer(getDevelopmentLanguage(), true);
    IFile labelFile = labelContainer.getFile(new Path(labelFileName.toLowerCase()) + ".properties");
    createLabel(labelFile, key, value);
  }
View Full Code Here

      }

 
 
  public static void changeDirLink(IFolder dirlinkFolder, IContainer target) {
    IFile dirlink = dirlinkFolder.getFile(WGUtils.DIRLINK_FILE);
    String linkTarget = computeDirLinkTarget(dirlinkFolder, target);
    SAXReader saxReader = new SAXReader();
    try {
      File dirlinkFile = new File(dirlink.getLocationURI().getPath());
      Document document = saxReader.read(dirlinkFile);
      Element ele = (Element)document.selectSingleNode("/dirlink/path");    //TODO use statics
      ele.addAttribute("location", linkTarget);                //TODO use statics
        XMLWriter output = new XMLWriter(new FileWriter(dirlinkFile));
        try {
          output.write( document );
        } finally {
          try {
            output.close();
          } catch (IOException e) {           
          }
        }
    } catch (DocumentException e) {
      Activator.getDefault().logError("Can not parse xmlfile " + dirlink.getLocation(), e);
    } catch (IOException e) {
      Activator.getDefault().logError("Can not read/write file " + dirlink.getLocation(), e);
    }
  }
View Full Code Here

    IResource portletFolderResource = FileUtils.createFolder(parent, portletName);
    IFolder portletFolder = (IFolder) portletFolderResource;     
   
    String tmlInclude = header + "\n<tml:include ref=\"{'::mode-' + portlet.mode}\"/>";   
    ByteArrayInputStream input = new ByteArrayInputStream(tmlInclude.getBytes());
    IFile portletFile = portletFolder.getFile("portlet.tml");
    portletFile.create(input, true, new NullProgressMonitor());
   
    portletFolder.getFile("form.tml").create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());   
    //TODO Form for form.tml
   
   
View Full Code Here

  public static boolean isValidTMLLocation(IContainer container){
    if (container == null) {
      return false;
    }
   
    IFile syncinfo = determineSyncInfo(container);
    if (syncinfo==null || !syncinfo.exists()) {
      return false;           
    }
   
    WGADesignStructureHelper helper = new WGADesignStructureHelper(syncinfo);
    if (helper.getTmlRoot().getFullPath().isPrefixOf(container.getFullPath()) && !helper.getTmlRoot().getFullPath().equals(container.getFullPath())) {
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IFile

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.