Examples of IFile


Examples of org.eclipse.core.resources.IFile

  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

Examples of org.eclipse.core.resources.IFile

   
  }

  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

Examples of org.eclipse.core.resources.IFile

      }

 
 
  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

Examples of org.eclipse.core.resources.IFile

    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

Examples of org.eclipse.core.resources.IFile

  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

Examples of org.eclipse.core.resources.IFile

      return isWGADesignResource((IFile)resource);
    } else if (resource instanceof IContainer) {
      IContainer parent = (IContainer)resource;
      while (parent instanceof IFolder) {
        parent = parent.getParent();
        IFile syncInfo = parent.getFile(new Path(DesignDirectory.DESIGN_DEFINITION_FILE));
        if (syncInfo.exists()) {
          return true;
        }
        syncInfo = parent.getFile(new Path(DesignDirectory.SYNCINFO_FILE));
        if (syncInfo.exists()) {
          return true;
        }
      }
      return false;
    }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

      getScriptsRoot().setDefaultCharset(fEncoding, new NullProgressMonitor());
      getScriptsRoot().accept(new IResourceVisitor() {
 
        public boolean visit(IResource resource) throws CoreException {
          if (resource instanceof IFile) {
            IFile file = (IFile) resource;
            String defaultEncoding = fDefaultCharsetsByExtension.get(file.getFileExtension().toLowerCase());
            if (defaultEncoding != null) {
              String resourceCharset = file.getCharset();
              if (resourceCharset == null) {
                resourceCharset = defaultEncoding;
              }
              if (!fEncoding.equals(resourceCharset)) {
                // if design encoding differ from default encoding we define it explicit
                file.setCharset(fEncoding, new NullProgressMonitor());
              } else {
                file.setCharset(null, new NullProgressMonitor());
              }
            }
          }
          return true;
        }
View Full Code Here

Examples of org.eclipse.core.resources.IFile

  public static IContainer resolveDirLink(IContainer container) {
    return resolveDirLink(container.getFile(new Path(WGUtils.DIRLINK_FILE)));
  }

  public boolean hasPluginConfig() {
    IFile syncInfo = getSyncInfo();
    if (syncInfo.exists()) {     
      try {
        WGADesignConfigurationModelWrapper wrapper = new WGADesignConfigurationModelWrapper(syncInfo);
        return wrapper.hasPluginConfig();
      } catch (IOException e) {
      }     
View Full Code Here

Examples of org.eclipse.core.resources.IFile

                if(suffix.equals(".tml")){
                    nameOfmodelToCreate = nameOfmodelToCreate.substring(0, nameOfmodelToCreate.lastIndexOf("."));
                }              
            }
           
            IFile targetFile = _selectedContainer.getFile(new Path(nameOfmodelToCreate + ".tml"));

            if (targetContainer.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a folder named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else if (targetFile.exists()) {
                list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "There is already a file named \"" + nameOfmodelToCreate + "\" below \"" + _selectedContainer.getName() + "\"."));

            } else {
                _tmlFile = targetFile;
View Full Code Here

Examples of org.eclipse.core.resources.IFile

      IFolder labelContainer = designHelper.getLabelContainer(language);
       
      if (labelContainer != null && labelContainer.exists()) {
        Iterator<IFile> labelFiles = designHelper.getLabelFiles(labelContainer).iterator();
        while (labelFiles.hasNext()) {
          IFile labelFile = labelFiles.next();
          labelFilenames.add(labelFile.getName().substring(0, labelFile.getName().length() - (labelFile.getFileExtension().length() + 1)));
        }
      }
    } catch (CoreException e) {
      Plugin.getDefault().logError("Unable to lookup label files.", e);
    }
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.