Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IFolder


                if(suffix.equals(_typeLable.getText())){
                    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() + "\"."));
View Full Code Here


        if (nameOfmodelToCreate.equals("")) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Please specify a name for the module."));
        } else if (!WGADesignStructureHelper.isValidModuleName(nameOfmodelToCreate)) {
            list.add(new Status(Status.ERROR, Plugin.PLUGIN_ID, "Invalid chars in module name."));
        } else {
            IFolder targetContainer = _selectedContainer.getFolder(new Path(nameOfmodelToCreate));
           
            if(nameOfmodelToCreate.contains(".")){
                String suffix = nameOfmodelToCreate.substring(nameOfmodelToCreate.lastIndexOf("."),nameOfmodelToCreate.length());
                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() + "\"."));
View Full Code Here

   
    try {
      WGADesignStructureHelper designHelper = new WGADesignStructureHelper(activeFile);
      String language = designHelper.getDevelopmentLanguage();
     
      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)));
        }
View Full Code Here

    }
    if (designRoot == null) {
      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() + "'."));   
        }
      }
    }
View Full Code Here

        String type = region.getAttributeValue("type");
        if (type != null && type.equals("file") && region.hasAttribute("doc") && !region.isDynamicAttributeValue("doc")) {
          String containername = region.getAttributeValue("doc");
          //final IFolder fContainer = new WGADesignStructureHelper(activeFile).getFileContainer(containername);

          final IFolder fContainer = WGADesignStructureHelper.findReferencedFileContainer(activeFile, containername);
         
          if (fContainer != null) {
            final Set<String> fReferences = references;
            try {
              fContainer.accept(new IResourceVisitor() {

                public boolean visit(IResource resource) throws CoreException {
                  if (resource instanceof IFile) {
                    fReferences.add(resource.getName().toLowerCase());
                    return true;
                  } else if (resource.equals(fContainer)) {
                    return true;
                  } else {
                    return false;
                  }
                }

              });
            } catch (CoreException e) {
              Plugin.getDefault().logError("Unable to lookup container file references of filecontainer '" + fContainer.getLocation() + "'.", e);
            }
          }
        }
      }
     
      if (tagName.equals("image") || tagName.equals("img")) {
       
        if (region.hasAttribute("doc") && !region.isDynamicAttributeValue("doc") && !region.hasAttribute("db")) {
          String containername = region.getAttributeValue("doc");
          //final IFolder fContainer = new WGADesignStructureHelper(activeFile).getFileContainer(containername);
          final IFolder fContainer = WGADesignStructureHelper.findReferencedFileContainer(activeFile, containername);
          if (fContainer != null) {
            final Set<String> fReferences = references;
            try {
              fContainer.accept(new IResourceVisitor() {

                public boolean visit(IResource resource) throws CoreException {
                  if (resource instanceof IFile) {
                    fReferences.add(resource.getName().toLowerCase());
                    return true;
                  } else if (resource.equals(fContainer)) {
                    return true;
                  } else {
                    return false;
                  }
                }

              });
            } catch (CoreException e) {
              Plugin.getDefault().logError("Unable to lookup container file references of filecontainer '" + fContainer.getLocation() + "'.", e);
            }
          }
        }
      }
     
View Full Code Here

      IContainer designRoot = (IContainer) _designFolderSelectionPage.getSelectedResource();
      String outerLayoutName = _layoutPage.getOuterLayoutName();
      String innerLayoutName = _layoutPage.getInnerLayoutName();
     
      WGADesignStructureHelper helper = new WGADesignStructureHelper(designRoot);
      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  {
View Full Code Here

    _comboFiles.clearSelection();

    Set<IFile> files = new HashSet<IFile>();
    Set<String> labelFiles = new TreeSet<String>();

    IFolder currentFolder = getCurrentSelectedLabelContainer(); // e.g.
    // labels_de
    if (!currentFolder.exists()) {
      files.add(getCurrentSelectedLabelContainer().getFile("general.properties"));
    } else {
      try {
        files = _wgaDesign.getLabelFiles(currentFolder);
      } catch (CoreException e) {
        Plugin.getDefault().logError(e);
      }
      // adds default file ("general-properties")
      files.add(currentFolder.getFile("general.properties"));
    }

    Iterator<IFile> it = files.iterator();
    while (it.hasNext()) {
      IFile current = it.next();
View Full Code Here

        WGADesignStructureHelper helper = new WGADesignStructureHelper(activeFile);
        VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(activeFile);
        Iterator<IFolder> containers = helper.getFileContainers().iterator();
        while (containers.hasNext()) {
           
            IFolder container = containers.next();
           
            if (versionCompliance != null && versionCompliance.toWGAVersion() != null && versionCompliance.toWGAVersion().isAtLeast(5, 4)) {                               
                IPath refPath = container.getFullPath().makeRelativeTo(helper.getFileContainerRoot().getFullPath());
              references.add(refPath.toString().toLowerCase().replaceAll("\\/",":"));
             
              IPath activeFolderPath = activeFile.getParent().getFullPath().makeRelativeTo(helper.getTmlRoot().getFullPath());
              // remove medium
              activeFolderPath = activeFolderPath.removeFirstSegments(1);
               if (activeFolderPath.segmentCount() > 0 && (refPath.segmentCount() >= activeFolderPath.segmentCount())) {
                    int a = refPath.segmentCount();
                    int b = activeFolderPath.segmentCount();
                    IPath tmp = refPath.removeLastSegments(a - b);
                    if (tmp.equals(activeFolderPath)) {
                        refPath = refPath.removeFirstSegments(tmp.segmentCount());
                        references.add("::" + refPath.toString().replaceAll("\\/", ":"));
                    }
   
                }
            } else {
                references.add(container.getName().toLowerCase());
            }
         
        }
    }
View Full Code Here

      while (moveFromFiles.hasNext()) {
        IFile moveFrom = moveFromFiles.next();
        IFile moveToFile = _metaDataFilesToMove.get(moveFrom);
        try {
          if (moveToFile.getParent() instanceof IFolder) {
            IFolder folder = (IFolder) moveToFile.getParent();
            if (!folder.exists()) {
              folder.create(true,true, new NullProgressMonitor());
            }
            moveFrom.move(moveToFile.getFullPath(), true, new NullProgressMonitor());
          }         
        } catch (CoreException e) {
          Plugin.getDefault().logError("Unable to execute TMLMetadataMaintenance." , e);
View Full Code Here

    action.setEnabled(false);
    if (selection != null && selection instanceof IStructuredSelection) {
      IStructuredSelection structSelection = (IStructuredSelection) selection;
      Object selectedElement = structSelection.getFirstElement();   
        if (selectedElement instanceof IFolder) {
          IFolder folder = (IFolder)selectedElement;
          if(WGADesignStructureHelper.isDirlinkFolder(folder)){
            _selectedFodler = folder;
            action.setEnabled(true);
          }
        }
        if (selectedElement instanceof IFile) {
          IFile file = (IFile)selectedElement;
          if(file.getParent() instanceof IFolder){ 
          IFolder folder = (IFolder)file.getParent();
            if(WGADesignStructureHelper.isDirlinkFolder(folder)){
              _selectedFodler = folder;
              action.setEnabled(true);
            }
        }
View Full Code Here

TOP

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

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.