Package org.eclipse.core.resources

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


      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

  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

                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

      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

      messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "No design folder selected."));
    } else {
      WGADesignStructureHelper helper = new WGADesignStructureHelper(designRoot);
      IFolder html = helper.getTmlRoot().getFolder("html");
      if (html.exists()) {
        IFile outerLayoutFile = html.getFile(new Path(getOuterLayoutName() + ".tml"));
        if (outerLayoutFile.exists()) {
          messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "A module with name '" + outerLayoutName + "' already exists in '" + outerLayoutFile.getParent().getFullPath().toString() + "'."));   
        }
        IFile innerLayoutFile = html.getFile(new Path("inner").append(getInnerLayoutName() + ".tml"));
        if (innerLayoutFile.exists()) {
          messages.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "A module with name '" + innerLayoutName + "' already exists in '" + innerLayoutFile.getParent().getFullPath().toString() + "'."));   
        }
      }
    }
    return messages;
  }
View Full Code Here

    @Override
  protected void doSetInput(IEditorInput newInput) throws CoreException {
    super.doSetInput(newInput);
    if (getSite().getShell().isVisible()) {
        // check if design is compatible
        IFile input = getInputFile();
        if (input != null) {
            if (!WGADesignStructureHelper.isWGAVersionComplianceCompatible(input)) {
                MessageDialog.openWarning(getSite().getShell(), "Incompatible design version", "This design uses an incompatible compliance level. Please upgrade to the latest WDS version to work on this design with full feature support.");       
            }
        }
View Full Code Here

    super.editorSaved();
    validateAndMark();
  }

  protected void validateAndMark() {
      IFile file = getInputFile();
      if (file != null) {
        WGADesignResourceValidator.validate(file);
      }
  }
View Full Code Here

    return document;
  }
 
  protected IFile getInputFile() {
    IEditorInput editorInput = getEditorInput();
    IFile file = null;
    if (editorInput instanceof IFileEditorInput) {
      IFileEditorInput ife = (IFileEditorInput) getEditorInput();
      file = ife.getFile();
    }
    return file;
View Full Code Here

  public boolean performFinish() {

    if (_page != null) {
      try {         
          String header = Plugin.getDefault().getHeaderFileMap().get(Plugin.HEADER_TML_MODUL).getHeaderForProject(_page.getTargetContainer().getProject());     
        IFile portlet = WGADesignStructureHelper.createPortlet(_page.getModes(), _page.getPortletName(), (IFolder) _page.getTargetContainer(),header);
        WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), portlet.getParent().getFile(new Path("mode-view.tml")), ResourceIDs.EDITOR_TML);
        WorkbenchUtils.setNavigationViewSelection(new SingleStructuredSelection(portlet.getParent().getFile(new Path("mode-view.tml"))));
      } catch (CoreException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
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.