Package org.aspectj.ajde.ui

Examples of org.aspectj.ajde.ui.BuildConfigNode


        //Set contentsSet = new TreeSet(fileContents);
        String fileContentsString = "";
        //List filesToWrite = null;
        Set includedFiles = new HashSet();
        for (Iterator it = importedNodes.iterator(); it.hasNext(); ) {
          BuildConfigNode node = (BuildConfigNode)it.next();
          fileContentsString += '@' + node.getResourcePath() + "\n";
          String parentPath = new File(filePath).getParent();
          String importedFilePath = parentPath + File.separator + node.getResourcePath();
          includedFiles.addAll(getIncludedFiles(importedFilePath, parentPath));
        }
       
        for (Iterator it = files.iterator(); it.hasNext(); ) {
          BuildConfigNode node = (BuildConfigNode)it.next();
          if (node.getName().endsWith(".lst") && !node.getResourcePath().startsWith("..")) {
            fileContentsString += '@';
            fileContentsString += node.getResourcePath() + "\n"
          } else {
            if (!includedFiles.contains(node.getResourcePath())) {
              fileContentsString += node.getResourcePath() + "\n"
            }
          }
        }
        writeFile(fileContentsString, filePath);   
  }
View Full Code Here


                new SourceLocation(pe.getFile(), pe.getLine(), 1));
            Ajde.getDefault().getMessageHandler().handleMessage(message);
      }
     
      List relativePaths = relativizeFilePaths(configFiles, rootPath);
        BuildConfigNode root = new BuildConfigNode(configFileName, BuildConfigNode.Kind.FILE_LST, rootPath);         
        buildDirTree(root, rootPath, importedFiles, configFileName);
        model.setRoot(root);
        addFilesToDirTree(model, relativePaths, badEntries);
       
        pruneEmptyDirs(root);
View Full Code Here

    return model;
  }

  private void addProblemEntries(BuildConfigNode root, List badEntries) {
    for (Iterator it = badEntries.iterator(); it.hasNext(); ) {
      root.addChild(new BuildConfigNode(
        it.next().toString(),
        BuildConfigNode.Kind.ERROR, null)
      );
    }
  }
View Full Code Here

 
  private void buildDirTree(BuildConfigNode node, String rootPath, List importedFiles, String configFileName) {
    File[] dirs = new File(node.getResourcePath()).listFiles(DIR_FILTER);
    if (dirs == null) return;
    for (int i = 0; i < dirs.length; i++) {
      BuildConfigNode dir = new BuildConfigNode(dirs[i].getName(), BuildConfigNode.Kind.DIRECTORY, dirs[i].getPath());     
      File[] files = dirs[i].listFiles(SOURCE_FILE_FILTER);
      for (int j = 0; j < files.length; j++) {
        if (files[j] != null) {// && !files[j].getName().endsWith(".lst")) { 
          String filePath = fileUpdater.relativizePath(files[j].getPath(), rootPath);
          BuildConfigNode.Kind kind = BuildConfigNode.Kind.FILE_JAVA;
          if (!files[j].getName().endsWith(".lst")) {
            //kind = BuildConfigNode.Kind.FILE_LST; 
            BuildConfigNode file = new BuildConfigNode(files[j].getName(), kind, filePath);         
            file.setActive(false);         
            dir.addChild(file);
          }
        }
      }
      node.addChild(dir);
//      boolean foundMatch = false;
      for (Iterator it = importedFiles.iterator(); it.hasNext(); ) {
        File importedFile = (File)it.next();
        if (importedFile.getParentFile().getAbsolutePath().equals(dirs[i].getAbsolutePath())) {
//          foundMatch = true;
          BuildConfigNode importedFileNode = new BuildConfigNode(
            importedFile.getName(),
            BuildConfigNode.Kind.FILE_LST,
            fileUpdater.relativizePath(importedFile.getPath(), rootPath));
          importedFileNode.setActive(true);
          //dir.getChildren().clear();
          boolean found = false;
          for (Iterator it2 = dir.getChildren().iterator(); it2.hasNext(); ) {
            if (((BuildConfigNode)it2.next()).getName().equals(importedFile.getName())) {
              found = true
            }
          }
          if (!found) dir.addChild(importedFileNode);
        }
         
      }
      //if (!foundMatch)
      buildDirTree(dir, rootPath, importedFiles, configFileName);
    }
   
    if (node.getName().endsWith(".lst")) {
      File[] files = new File(rootPath).listFiles(SOURCE_FILE_FILTER);
      if (files == null) return;
      for (int i = 0; i < files.length; i++) {
        if (files[i] != null && !files[i].getName().equals(configFileName)) {// && !files[i].getName().endsWith(".lst")) {
          BuildConfigNode.Kind kind = BuildConfigNode.Kind.FILE_JAVA;
          if (files[i].getName().endsWith(".lst")) {
            kind = BuildConfigNode.Kind.FILE_LST; 
          }
          BuildConfigNode file = new BuildConfigNode(files[i].getName(), kind, files[i].getName());         
          file.setActive(false);
          node.addChild(file);
        }
      }
    }
  }
View Full Code Here

  private void addFilesToDirTree(BuildConfigModel model, List configFiles, List badEntries) {
    for (Iterator it = configFiles.iterator(); it.hasNext(); ) {
      String path = (String)it.next();
      if (path.startsWith("..")) {
        File file = new File(path);
        BuildConfigNode node = new BuildConfigNode(file.getName(), BuildConfigNode.Kind.FILE_JAVA, path);
        BuildConfigNode upPath = model.getNodeForPath(file.getParentFile().getPath());
        if (upPath == model.getRoot()) {
          upPath = new BuildConfigNode(file.getParentFile().getPath(), BuildConfigNode.Kind.DIRECTORY, file.getParentFile().getAbsolutePath())
          model.getRoot().addChild(upPath);
        }
        node.setActive(true);
        upPath.addChild(node);
      } else if (!(new File(path).isAbsolute())) {
//        String name = new File(path).getName();
        BuildConfigNode existingNode = model.getNodeForPath(path);
        existingNode.setActive(true);
      } else {
        badEntries.add("Use relative paths only, omitting: " + path);
      }
    }
  }
View Full Code Here

  }
 
  private boolean pruneEmptyDirs(BuildConfigNode node) {
    List nodesToRemove = new ArrayList();
    for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
      BuildConfigNode currNode = (BuildConfigNode)it.next();
      boolean hasValidChildren = pruneEmptyDirs(currNode);
      if (!currNode.isValidResource() && !hasValidChildren) {
        nodesToRemove.add(currNode);
      }
    }
   
    for (Iterator it = nodesToRemove.iterator(); it.hasNext(); ) {
      BuildConfigNode currNode = (BuildConfigNode)it.next();
      node.removeChild(currNode)
    }
    return node.getChildren().size() > 0;
  }
View Full Code Here

//   
  private void sortModel(BuildConfigNode node, Comparator comparator) {
    if (node == null || node.getChildren() == null) return;
    Collections.sort(node.getChildren(), comparator);
    for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
      BuildConfigNode nextNode = (BuildConfigNode)it.next();
      if (nextNode != null) sortModel(nextNode, comparator)
    }
  }
View Full Code Here

    }
   
    private ConfigTreeNode buildTree(BuildConfigNode node) {
      ConfigTreeNode treeNode = new ConfigTreeNode(node);
      for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
        BuildConfigNode childNode = (BuildConfigNode)it.next();
        treeNode.add(buildTree(childNode));
      }
      return treeNode;
   
View Full Code Here

    }
   
    private ConfigTreeNode buildTree(BuildConfigNode node) {
      ConfigTreeNode treeNode = new ConfigTreeNode(node);
      for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
        BuildConfigNode childNode = (BuildConfigNode)it.next();
        treeNode.add(buildTree(childNode));
      }
      return treeNode;
   
View Full Code Here

        //Set contentsSet = new TreeSet(fileContents);
        String fileContentsString = "";
        //List filesToWrite = null;
        Set includedFiles = new HashSet();
        for (Iterator it = importedNodes.iterator(); it.hasNext(); ) {
          BuildConfigNode node = (BuildConfigNode)it.next();
          fileContentsString += '@' + node.getResourcePath() + "\n";
          String parentPath = new File(filePath).getParent();
          String importedFilePath = parentPath + File.separator + node.getResourcePath();
          includedFiles.addAll(getIncludedFiles(importedFilePath, parentPath));
        }
       
        for (Iterator it = files.iterator(); it.hasNext(); ) {
          BuildConfigNode node = (BuildConfigNode)it.next();
          if (node.getName().endsWith(".lst") && !node.getResourcePath().startsWith("..")) {
            fileContentsString += '@';
            fileContentsString += node.getResourcePath() + "\n"
          } else {
            if (!includedFiles.contains(node.getResourcePath())) {
              fileContentsString += node.getResourcePath() + "\n"
            }
          }
        }
        writeFile(fileContentsString, filePath);   
  }
View Full Code Here

TOP

Related Classes of org.aspectj.ajde.ui.BuildConfigNode

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.