Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFile


      IContainer container =  (IContainer)selection.getFirstElement();     
      if(WGADesignStructureHelper.isValidPortletLocation((container))){
        _portletValidFolderSelected  = true;
      }
    }else if(selection.getFirstElement() instanceof IFile){
      IFile file = (IFile) selection.getFirstElement();
      if(WGADesignStructureHelper.isValidPortletLocation(file.getParent())){
        _portletValidFolderSelected   = true;
      }     
    } 
   
   
View Full Code Here


      IFolder html = helper.getTmlRoot().getFolder("html");
      if (!html.exists()) {
        html.create(false, true, new NullProgressMonitor());
      }
     
      IFile outerLayoutFile = html.getFile(new Path(outerLayoutName + ".tml"));
      InputStream outerLayoutTemplate = null;
      try {
        outerLayoutTemplate = Plugin.getDefault().getResourceAsStream("resources/templates/defaultOuterLayout.template");
        outerLayoutFile.create(outerLayoutTemplate, true, new NullProgressMonitor());
      } finally {
        if (outerLayoutTemplate != null) {
          try {
            outerLayoutTemplate.close();
          } catch (IOException e) {
          }
        }
      }
     
      IFolder inner = html.getFolder("inner");
      if (!inner.exists()) {
        inner.create(false, true, new NullProgressMonitor());
      }
     
      IFile innerLayoutFile = inner.getFile(innerLayoutName + ".tml");
      InputStream innerLayoutTemplate = null;
      try {
        innerLayoutTemplate = Plugin.getDefault().getResourceAsStream("resources/templates/defaultInnerLayout.template");       
        innerLayoutFile.create(innerLayoutTemplate, true, new NullProgressMonitor());
      } finally  {
        if (innerLayoutTemplate != null) {
          try {
            innerLayoutTemplate.close();
          } catch (IOException e) {
View Full Code Here

        if (currentIResources[i] instanceof IContainer) {
          IContainer current = (IContainer) currentIResources[i];
          insertFiles(current, path);
        }
        if (currentIResources[i] instanceof IFile) {
          IFile ifile = (IFile) currentIResources[i];
          addIntoDB(ifile);
        }
      }
  }
View Full Code Here

    super();
    setWindowTitle("New TML module");
  }
 
  public boolean performFinish() {
    IFile tmlFile = null;
    try {
      tmlFile = _tmlModulePage.getTmlFile();
      boolean isDirectAccess = _tmlModulePage.getIsTmlFileDirectAccess();
      boolean isCachable = _tmlModulePage.getIsTmlFileCachable();
     
          String header = Plugin.getDefault().getHeaderFileMap().get(Plugin.HEADER_TML_MODUL).getHeaderForProject(tmlFile.getProject())
          tmlFile.create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());   
     
      if(isCachable || isDirectAccess){
        TMLFileMetadataModel model = new TMLFileMetadataModel(tmlFile);
        model.setCachable(isCachable);
        model.setDirectAccess(isDirectAccess);
        model.saveChanges();
     
     

     
     
     
      WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), tmlFile, ResourceIDs.EDITOR_TML);
     
      try {
        WorkbenchUtils.setNavigationViewSelection(new SingleStructuredSelection(tmlFile));
      } catch (Exception e) {       
      }
     
      return true;
     
    } catch (CoreException e) {
      Plugin.getDefault().logError("Can not create TML module at " + tmlFile.getLocation(), e);
      return false;
    } catch (IOException e) {
      Plugin.getDefault().logError("Can not create  metadata for TML module " + tmlFile.getLocation(), e);
      return false;
    }
 
  }
View Full Code Here

      IContainer container =  (IContainer)selection.getFirstElement();     
      if(WGADesignStructureHelper.isValidTMLLocation(container)){
        _tmlValidFolderSelected  = true;
      }
    }else if(selection.getFirstElement() instanceof IFile){
      IFile file = (IFile) selection.getFirstElement();
      if(WGADesignStructureHelper.isValidTMLLocation(file.getParent())){
        _tmlValidFolderSelected  = true;
      }     
    } 
  }
View Full Code Here

                    nameOfmodelToCreate = nameOfmodelToCreate.substring(0, nameOfmodelToCreate.lastIndexOf("."));
                }              
            }      
           
            IFolder targetContainer = _selectedContainer.getFolder(new Path(nameOfmodelToCreate));
            IFile targetFile = _selectedContainer.getFile(new Path(nameOfmodelToCreate + "." + _typeLable.getText()));

            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 {
                _scriptFile = targetFile;
View Full Code Here

    }
  }

  @Override
  public boolean performFinish() {
    IFile target = _modulePage.getTargetFile();
        String header = Plugin.getDefault().getHeaderFileMap().get(_fileExtToHeader.get(target.getFileExtension())).getHeaderForProject(target.getProject());  
    if (_modulePage.getCopyFromFile() != null) {
      try {
        target.create(new ByteArrayInputStream((header + "\n").getBytes()), true, new NullProgressMonitor());
        target.appendContents(Plugin.getDefault().getResourceAsStream(_modulePage.getCopyFromFile()), true, false, new NullProgressMonitor());     
      } catch (CoreException e) {
        Plugin.getDefault().logError("Unable to create file " + target.getLocation(), e);
        return false;
      } catch (IOException e) {
        Plugin.getDefault().logError("Unable to cpoy from template in file " + target.getLocation(), e);
        return false;
      }
    }else{
      try {     
        target.create(new ByteArrayInputStream(header.getBytes()), true, new NullProgressMonitor());
      } catch (CoreException e) {
        Plugin.getDefault().logError("Unable to create file " + target.getLocation(), e);
        return false;
      }
    }
    try {
      if(target.getFileExtension().equals("tmlscript") || target.getFileExtension().equals("js") ){
        WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), target, ResourceIDs.EDITOR_TMLSCRIPT);
      }else{
        WorkbenchUtils.openEditor(Plugin.getDefault().getWorkbench(), target, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
     
     
    } catch (PartInitException e) {
      Plugin.getDefault().logWarning("Unable to open editor for file " + target.getLocation(), e);
    }
    return true;
  }
View Full Code Here

      IContainer container = (IContainer) selection.getFirstElement();
      if (WGADesignStructureHelper.isValidScriptLocation(container)) {
        _scriptValidFolderSelected = true;
      }
    } else if (selection.getFirstElement() instanceof IFile) {
      IFile file = (IFile) selection.getFirstElement();
      if (WGADesignStructureHelper.isValidScriptLocation(file.getParent())) {
        _scriptValidFolderSelected = true;
      }
    }
  }
View Full Code Here

      list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please specify a name for the portlet"));
    } else if (!WGADesignStructureHelper.isValidModuleName(_txtPortletName.getText())) {
      list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Invalid chars in portlet name."));
    } else {
      IContainer targetContainer = _selectedContainer.getFolder(new Path(_txtPortletName.getText()));
      IFile targetFile = _selectedContainer.getFile(new Path(_txtPortletName.getText()));

      if (targetContainer == null || targetContainer.exists()) {

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

      }
    }
View Full Code Here

      IStructuredSelection structSelection = (IStructuredSelection) selection;
      Object selectedElement = structSelection.getFirstElement();
      if (selectedElement instanceof IContainer) {
        IContainer container = (IContainer) selectedElement;

        IFile dirlink = container.getFile(new Path("dirlink.xml"));
        if (dirlink.exists()) {
          File linkedFile = WGUtils.resolveDirLink(container.getLocation().toFile());
          container = (IContainer) container.getWorkspace().getRoot().findContainersForLocationURI(linkedFile.toURI())[0];

        }
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.